mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 18:19:02 +00:00
adm8668: Remove unmaintained target
This target only supports kernel 3.18, which is not supported in OpenWrt any more for multiple releases. It also looks like there is no active maintainer for this target. Remove the code and all the packages which are only used by this target. To add this target to OpenWrt again port it to a recent and supported kernel version. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
2d0a2ff1e0
commit
c35425f418
@ -1,24 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ARCH:=mipsel
|
||||
BOARD:=adm8668
|
||||
BOARDNAME:=Infineon WildPass ADM8668
|
||||
FEATURES:=squashfs usb pci source-only
|
||||
MAINTAINER:=Florian Fainelli <florian@openwrt.org>
|
||||
|
||||
KERNEL_PATCHVER:=3.18
|
||||
|
||||
define Target/Description
|
||||
Build firmware images for Infineon WildPass (ADM8668) based routers
|
||||
(e.g. T-Mobile branded Linksys WRTU54G-TM)
|
||||
endef
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
$(eval $(call BuildTarget))
|
@ -1,24 +0,0 @@
|
||||
config interface loopback
|
||||
option ifname lo
|
||||
option proto static
|
||||
option ipaddr 127.0.0.1
|
||||
option netmask 255.0.0.0
|
||||
|
||||
config interface lan
|
||||
option ifname eth0
|
||||
option type bridge
|
||||
option proto static
|
||||
option ipaddr 192.168.1.1
|
||||
option netmask 255.255.255.0
|
||||
option ip6assign 60
|
||||
|
||||
config interface wan
|
||||
option ifname eth1
|
||||
option proto dhcp
|
||||
|
||||
config interface wan6
|
||||
option ifname eth1
|
||||
option proto dhcpv6
|
||||
|
||||
config globals globals
|
||||
option ula_prefix auto
|
@ -1,21 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
|
||||
set_led() {
|
||||
local state="$1"
|
||||
[ -f "/proc/adm8668/sesled" ] && echo "$state" > "/proc/adm8668/sesled"
|
||||
}
|
||||
|
||||
set_state() {
|
||||
case "$1" in
|
||||
preinit)
|
||||
set_led 1
|
||||
;;
|
||||
failsafe)
|
||||
set_led 2
|
||||
;;
|
||||
done)
|
||||
set_led 0
|
||||
;;
|
||||
esac
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
init_hotplug_failsafe() {
|
||||
echo '/sbin/hotplug.failsafe' > /proc/sys/kernel/hotplug
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main init_hotplug_failsafe
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set_preinit_ifname() {
|
||||
ifname=eth0
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main set_preinit_ifname
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
PART_NAME=linux
|
||||
platform_check_image() {
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
case "$(get_magic_word "$1")" in
|
||||
# u-boot
|
||||
2705) return 0;;
|
||||
*)
|
||||
echo "Invalid image type. Please use only u-boot files"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# use default for platform_do_upgrade()
|
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
case "$1" in
|
||||
button) kill -USR1 1;;
|
||||
esac
|
@ -1,104 +0,0 @@
|
||||
CONFIG_ADM8668=y
|
||||
CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
|
||||
CONFIG_ARCH_DISCARD_MEMBLOCK=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_REQUIRE_GPIOLIB=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARM_AMBA=y
|
||||
# CONFIG_ARM_SP805_WATCHDOG is not set
|
||||
CONFIG_CEVT_R4K=y
|
||||
CONFIG_CEVT_R4K_LIB=y
|
||||
CONFIG_CMDLINE="console=ttyS0 earlyprintk"
|
||||
CONFIG_CMDLINE_BOOL=y
|
||||
CONFIG_CMDLINE_OVERRIDE=y
|
||||
CONFIG_CPU_HAS_PREFETCH=y
|
||||
CONFIG_CPU_HAS_SYNC=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_MIPS32=y
|
||||
CONFIG_CPU_MIPS32_R1=y
|
||||
CONFIG_CPU_MIPSR1=y
|
||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||
CONFIG_CSRC_R4K=y
|
||||
CONFIG_CSRC_R4K_LIB=y
|
||||
# CONFIG_DE2104X is not set
|
||||
# CONFIG_DE4X5 is not set
|
||||
CONFIG_DECOMPRESS_LZMA=y
|
||||
# CONFIG_DM9102 is not set
|
||||
CONFIG_DMA_NONCOHERENT=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_GENERIC_ATOMIC64=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
|
||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||
CONFIG_GENERIC_GPIO=y
|
||||
CONFIG_GENERIC_IRQ_SHOW=y
|
||||
CONFIG_GENERIC_PCI_IOMAP=y
|
||||
CONFIG_GPIOLIB=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_DMA_ATTRS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
|
||||
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
|
||||
CONFIG_HAVE_GENERIC_HARDIRQS=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_IRQ_WORK=y
|
||||
CONFIG_HAVE_MEMBLOCK=y
|
||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HW_HAS_PCI=y
|
||||
CONFIG_INITRAMFS_SOURCE=""
|
||||
CONFIG_IRQ_CPU=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_MIPS=y
|
||||
CONFIG_MIPS_L1_CACHE_SHIFT=5
|
||||
# CONFIG_MIPS_MACHINE is not set
|
||||
CONFIG_MIPS_MT_DISABLED=y
|
||||
CONFIG_MTD_ADM8668_NOR=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEED_PER_CPU_KM=y
|
||||
CONFIG_NET_TULIP=y
|
||||
CONFIG_NO_EXCEPT_FILL=y
|
||||
CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
|
||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCI_DOMAINS=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
# CONFIG_PREEMPT_RCU is not set
|
||||
# CONFIG_SCSI_DMA is not set
|
||||
# CONFIG_SERIAL_8250 is not set
|
||||
CONFIG_SERIAL_AMBA_PL010=y
|
||||
CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
|
||||
CONFIG_SERIAL_AMBA_PL010_NUMPORTS=2
|
||||
CONFIG_SERIAL_AMBA_PL010_PORTNAME="ttyS"
|
||||
# CONFIG_SERIAL_AMBA_PL011 is not set
|
||||
CONFIG_SWAP_IO_SPACE=y
|
||||
CONFIG_SYS_HAS_CPU_MIPS32_R1=y
|
||||
CONFIG_SYS_HAS_EARLY_PRINTK=y
|
||||
CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
|
||||
CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
|
||||
CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
|
||||
CONFIG_TULIP=y
|
||||
CONFIG_TULIP_NAPI=y
|
||||
# CONFIG_TULIP_NAPI_HW_MITIGATION is not set
|
||||
# CONFIG_TULIP_PCI is not set
|
||||
CONFIG_TULIP_PLATFORM=y
|
||||
# CONFIG_ULI526X is not set
|
||||
CONFIG_USB_ARCH_HAS_XHCI=y
|
||||
# CONFIG_USB_HCD_BCMA is not set
|
||||
# CONFIG_USB_HCD_SSB is not set
|
||||
CONFIG_USB_SUPPORT=y
|
||||
# CONFIG_WINBOND_840 is not set
|
||||
CONFIG_ZONE_DMA_FLAG=0
|
@ -1,2 +0,0 @@
|
||||
config ARM_AMBA
|
||||
def_bool y
|
@ -1,6 +0,0 @@
|
||||
#
|
||||
# something witty --neutronscott
|
||||
#
|
||||
|
||||
obj-y := irq.o prom.o platform.o gpio.o \
|
||||
setup.o clock.o time.o early_printk.o \
|
@ -1,6 +0,0 @@
|
||||
#
|
||||
# Infineon ADM8668 WildPass
|
||||
#
|
||||
platform-$(CONFIG_ADM8668) += adm8668/
|
||||
cflags-$(CONFIG_ADM8668) += -I$(srctree)/arch/mips/include/asm/mach-adm8668
|
||||
load-$(CONFIG_ADM8668) += 0xffffffff80002000
|
@ -1,76 +0,0 @@
|
||||
/*
|
||||
* ADM8668 minimal clock support
|
||||
*
|
||||
* Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
|
||||
*
|
||||
* Licensed under the terms of the GPLv2
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <adm8668.h>
|
||||
|
||||
struct clk {
|
||||
unsigned long rate;
|
||||
};
|
||||
|
||||
static struct clk uart_clk = {
|
||||
.rate = 62500000,
|
||||
};
|
||||
|
||||
static struct clk sys_clk;
|
||||
|
||||
struct clk *clk_get(struct device *dev, const char *id)
|
||||
{
|
||||
const char *lookup = id;
|
||||
|
||||
if (dev)
|
||||
lookup = dev_name(dev);
|
||||
|
||||
if (!strcmp(lookup, "apb:uart0"))
|
||||
return &uart_clk;
|
||||
if (!strcmp(lookup, "sys"))
|
||||
return &sys_clk;
|
||||
|
||||
return ERR_PTR(-ENOENT);
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get);
|
||||
|
||||
int clk_enable(struct clk *clk)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_enable);
|
||||
|
||||
void clk_disable(struct clk *clk)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL(clk_disable);
|
||||
|
||||
unsigned long clk_get_rate(struct clk *clk)
|
||||
{
|
||||
return clk->rate;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get_rate);
|
||||
|
||||
void clk_put(struct clk *clk)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL(clk_put);
|
||||
|
||||
void __init adm8668_init_clocks(void)
|
||||
{
|
||||
u32 adj;
|
||||
|
||||
/* adjustable clock selection
|
||||
* CR3 bit 14~11, 0000 -> 175MHz, 0001 -> 180MHz, etc...
|
||||
*/
|
||||
adj = (ADM8668_CONFIG_REG(ADM8668_CR3) >> 11) & 0xf;
|
||||
sys_clk.rate = 175000000 + (adj * 5000000);
|
||||
|
||||
pr_info("ADM8668 CPU clock: %lu MHz\n", sys_clk.rate / 1000000);
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/amba/serial.h>
|
||||
#include <adm8668.h>
|
||||
|
||||
#define UART_READ(r) \
|
||||
__raw_readl((void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r)))
|
||||
|
||||
#define UART_WRITE(v, r) \
|
||||
__raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM8668_UART0_BASE) + (r)))
|
||||
|
||||
void prom_putchar(char c)
|
||||
{
|
||||
UART_WRITE(c, UART01x_DR);
|
||||
while ((UART_READ(UART01x_FR) & UART01x_FR_TXFF) != 0)
|
||||
;
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* Infineon/ADMTek ADM8668 WildPass GPIO support
|
||||
*
|
||||
* Copyright (C) 2012 Florian Fainelli <florian@openwrt.org>
|
||||
*
|
||||
* Licensed under the terms of GPLv2.
|
||||
*
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <adm8668.h>
|
||||
|
||||
#define GPIO_MASK 0x3f
|
||||
|
||||
#define GPIO_IN_OFS 0
|
||||
#define GPIO_OUT_OFS 6
|
||||
#define GPIO_OE_OFS 12
|
||||
|
||||
struct adm8668_gpio_chip {
|
||||
void __iomem *base;
|
||||
struct gpio_chip chip;
|
||||
};
|
||||
|
||||
static int adm8668_gpio_dir_out(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct adm8668_gpio_chip *c =
|
||||
container_of(chip, struct adm8668_gpio_chip, chip);
|
||||
u32 mask;
|
||||
|
||||
/* clear input, set output enable and output value */
|
||||
mask = __raw_readl(c->base);
|
||||
mask &= ~(1 << offset);
|
||||
mask |= (1 << (offset + GPIO_OE_OFS));
|
||||
if (value)
|
||||
mask |= (1 << (offset + GPIO_OUT_OFS));
|
||||
else
|
||||
mask &= ~(1 << (offset + GPIO_OUT_OFS));
|
||||
__raw_writel(mask, c->base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adm8668_gpio_dir_in(struct gpio_chip *chip,
|
||||
unsigned offset)
|
||||
{
|
||||
struct adm8668_gpio_chip *c =
|
||||
container_of(chip, struct adm8668_gpio_chip, chip);
|
||||
u32 mask;
|
||||
|
||||
mask = __raw_readl(c->base);
|
||||
mask &= ~(((1 << (offset + GPIO_OE_OFS)) | (1 << (offset + GPIO_OUT_OFS))));
|
||||
mask |= (1 << offset);
|
||||
__raw_writel(mask, c->base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void adm8668_gpio_set(struct gpio_chip *chip,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct adm8668_gpio_chip *c =
|
||||
container_of(chip, struct adm8668_gpio_chip, chip);
|
||||
u32 mask;
|
||||
|
||||
mask = __raw_readl(c->base);
|
||||
if (value)
|
||||
mask |= (1 << (offset + GPIO_OUT_OFS));
|
||||
else
|
||||
mask &= ~(1 << (offset + GPIO_OUT_OFS));
|
||||
__raw_writel(mask, c->base);
|
||||
}
|
||||
|
||||
static int adm8668_gpio_get(struct gpio_chip *chip,
|
||||
unsigned offset)
|
||||
{
|
||||
struct adm8668_gpio_chip *c =
|
||||
container_of(chip, struct adm8668_gpio_chip, chip);
|
||||
u32 value;
|
||||
|
||||
value = __raw_readl(c->base) & GPIO_MASK;
|
||||
|
||||
return value & (1 << offset);
|
||||
}
|
||||
|
||||
static struct adm8668_gpio_chip adm8668_gpio_cpu = {
|
||||
.base = (void __iomem *)KSEG1ADDR(ADM8668_CONFIG_BASE + CRGPIO_REG),
|
||||
.chip = {
|
||||
.label = "adm8668-cpu-gpio",
|
||||
.direction_output = adm8668_gpio_dir_out,
|
||||
.direction_input = adm8668_gpio_dir_in,
|
||||
.set = adm8668_gpio_set,
|
||||
.get = adm8668_gpio_get,
|
||||
.ngpio = 6,
|
||||
},
|
||||
};
|
||||
|
||||
static struct adm8668_gpio_chip adm8668_gpio_wlan = {
|
||||
.base = (void __iomem *)KSEG1ADDR(ADM8668_WLAN_BASE + GPIO_REG),
|
||||
.chip = {
|
||||
.label = "adm8668-wlan-gpio",
|
||||
.direction_output = adm8668_gpio_dir_out,
|
||||
.direction_input = adm8668_gpio_dir_in,
|
||||
.set = adm8668_gpio_set,
|
||||
.get = adm8668_gpio_get,
|
||||
.ngpio = 6,
|
||||
.base = 6,
|
||||
},
|
||||
};
|
||||
|
||||
static int __init adm8668_gpio_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = gpiochip_add(&adm8668_gpio_cpu.chip);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return gpiochip_add(&adm8668_gpio_wlan.chip);
|
||||
}
|
||||
arch_initcall(adm8668_gpio_init);
|
@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
|
||||
* Copyright (C) 2012 Florian Fainelli <florian@openwrt.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/signal.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/irq.h>
|
||||
#include <asm/mipsregs.h>
|
||||
#include <asm/irq_cpu.h>
|
||||
#include <asm/irq.h>
|
||||
#include <adm8668.h>
|
||||
|
||||
/* interrupt controller */
|
||||
#define IRQ_STATUS_REG 0x00 /* Read */
|
||||
#define IRQ_ENABLE_REG 0x08 /* Read/Write */
|
||||
#define IRQ_DISABLE_REG 0x0C /* Write */
|
||||
|
||||
#define IRQ_MASK 0xffff
|
||||
|
||||
static inline void intc_write_reg(u32 val, unsigned int reg)
|
||||
{
|
||||
void __iomem *base = (void __iomem *)KSEG1ADDR(ADM8668_INTC_BASE);
|
||||
|
||||
__raw_writel(val, base + reg);
|
||||
}
|
||||
|
||||
static inline u32 intc_read_reg(unsigned int reg)
|
||||
{
|
||||
void __iomem *base = (void __iomem *)KSEG1ADDR(ADM8668_INTC_BASE);
|
||||
|
||||
return __raw_readl(base + reg);
|
||||
}
|
||||
|
||||
static void adm8668_irq_cascade(void)
|
||||
{
|
||||
int irq;
|
||||
u32 intsrc;
|
||||
|
||||
intsrc = intc_read_reg(IRQ_STATUS_REG) & IRQ_MASK;
|
||||
if (intsrc) {
|
||||
irq = fls(intsrc) - 1;
|
||||
do_IRQ(irq);
|
||||
} else
|
||||
spurious_interrupt();
|
||||
}
|
||||
|
||||
/*
|
||||
* System irq dispatch
|
||||
*/
|
||||
void plat_irq_dispatch(void)
|
||||
{
|
||||
unsigned int pending;
|
||||
|
||||
pending = read_c0_cause() & read_c0_status() & ST0_IM;
|
||||
|
||||
/* timer interrupt, that we renumbered */
|
||||
if (pending & STATUSF_IP7)
|
||||
do_IRQ(MIPS_CPU_IRQ_BASE + 7);
|
||||
else if (pending & STATUSF_IP2)
|
||||
adm8668_irq_cascade();
|
||||
else
|
||||
spurious_interrupt();
|
||||
}
|
||||
|
||||
/*
|
||||
* enable 8668 irq
|
||||
*/
|
||||
static void enable_adm8668_irq(struct irq_data *d)
|
||||
{
|
||||
intc_write_reg((1 << d->irq), IRQ_ENABLE_REG);
|
||||
}
|
||||
|
||||
|
||||
static void ack_adm8668_irq(struct irq_data *d)
|
||||
{
|
||||
intc_write_reg((1 << d->irq), IRQ_DISABLE_REG);
|
||||
}
|
||||
|
||||
/*
|
||||
* system irq type
|
||||
*/
|
||||
|
||||
static struct irq_chip adm8668_irq_type = {
|
||||
.name = "adm8668",
|
||||
.irq_ack = ack_adm8668_irq,
|
||||
.irq_mask = ack_adm8668_irq,
|
||||
.irq_unmask = enable_adm8668_irq
|
||||
};
|
||||
|
||||
/*
|
||||
* irq init
|
||||
*/
|
||||
static void __init init_adm8668_irqs(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* disable all interrupts for the moment */
|
||||
intc_write_reg(IRQ_MASK, IRQ_DISABLE_REG);
|
||||
|
||||
for (i = 0; i <= ADM8668_IRQ_MAX; i++)
|
||||
irq_set_chip_and_handler(i, &adm8668_irq_type,
|
||||
handle_level_irq);
|
||||
|
||||
/* hw0 is where our interrupts are uh.. interrupted at. */
|
||||
set_c0_status(IE_IRQ0);
|
||||
}
|
||||
|
||||
/*
|
||||
* system init
|
||||
*/
|
||||
void __init arch_init_irq(void)
|
||||
{
|
||||
mips_cpu_irq_init();
|
||||
init_adm8668_irqs();
|
||||
}
|
@ -1,196 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
|
||||
* Copyright (C) 2012 Florian Fainelli <florian@openwrt.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/platform_data/tulip.h>
|
||||
#include <linux/usb/ehci_pdriver.h>
|
||||
#include <linux/mtd/physmap.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/amba/bus.h>
|
||||
#include <linux/amba/serial.h>
|
||||
|
||||
#include <asm/reboot.h>
|
||||
#include <asm/time.h>
|
||||
#include <asm/addrspace.h>
|
||||
#include <asm/bootinfo.h>
|
||||
#include <asm/io.h>
|
||||
#include <adm8668.h>
|
||||
|
||||
#define ADM8868_UBOOT_ENV 0x20000
|
||||
#define ADM8868_UBOOT_WAN_MAC 0x5ac
|
||||
#define ADM8868_UBOOT_LAN_MAC 0x404
|
||||
|
||||
static void adm8668_uart_set_mctrl(struct amba_device *dev,
|
||||
void __iomem *base,
|
||||
unsigned int mcrtl)
|
||||
{
|
||||
}
|
||||
|
||||
static struct amba_pl010_data adm8668_uart0_data = {
|
||||
.set_mctrl = adm8668_uart_set_mctrl,
|
||||
};
|
||||
|
||||
static struct amba_device adm8668_uart0_device = {
|
||||
.dev = {
|
||||
.init_name = "apb:uart0",
|
||||
.platform_data = &adm8668_uart0_data,
|
||||
},
|
||||
.res = {
|
||||
.start = ADM8668_UART0_BASE,
|
||||
.end = ADM8668_UART0_BASE + 0xF,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
.irq = {
|
||||
ADM8668_UART0_IRQ,
|
||||
-1
|
||||
},
|
||||
.periphid = 0x0041010,
|
||||
};
|
||||
|
||||
static struct resource eth0_resources[] = {
|
||||
{
|
||||
.start = ADM8668_LAN_BASE,
|
||||
.end = ADM8668_LAN_BASE + 256,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.start = ADM8668_LAN_IRQ,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct tulip_platform_data eth0_pdata = {
|
||||
.chip_id = ADM8668,
|
||||
};
|
||||
|
||||
static struct platform_device adm8668_eth0_device = {
|
||||
.name = "tulip",
|
||||
.id = 0,
|
||||
.resource = eth0_resources,
|
||||
.num_resources = ARRAY_SIZE(eth0_resources),
|
||||
.dev.platform_data = ð0_pdata,
|
||||
};
|
||||
|
||||
static struct resource eth1_resources[] = {
|
||||
{
|
||||
.start = ADM8668_WAN_BASE,
|
||||
.end = ADM8668_WAN_BASE + 256,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.start = ADM8668_WAN_IRQ,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct tulip_platform_data eth1_pdata = {
|
||||
.chip_id = ADM8668,
|
||||
};
|
||||
|
||||
static struct platform_device adm8668_eth1_device = {
|
||||
.name = "tulip",
|
||||
.id = 1,
|
||||
.resource = eth1_resources,
|
||||
.num_resources = ARRAY_SIZE(eth1_resources),
|
||||
.dev.platform_data = ð1_pdata,
|
||||
};
|
||||
|
||||
static struct resource usb_resources[] = {
|
||||
{
|
||||
.start = ADM8668_USB_BASE,
|
||||
.end = ADM8668_USB_BASE + 0x1FFFFF,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
||||
.start = ADM8668_USB_IRQ,
|
||||
.end = ADM8668_USB_IRQ,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
static struct usb_ehci_pdata usb_pdata = {
|
||||
.caps_offset = 0x100,
|
||||
.has_tt = 1,
|
||||
};
|
||||
|
||||
static struct platform_device adm8668_usb_device = {
|
||||
.name = "ehci-platform",
|
||||
.id = -1,
|
||||
.resource = usb_resources,
|
||||
.num_resources = ARRAY_SIZE(usb_resources),
|
||||
.dev.platform_data = &usb_pdata,
|
||||
};
|
||||
|
||||
static struct platform_device *adm8668_devs[] = {
|
||||
&adm8668_eth0_device,
|
||||
&adm8668_eth1_device,
|
||||
&adm8668_usb_device,
|
||||
};
|
||||
|
||||
static void adm8668_fetch_mac(int unit)
|
||||
{
|
||||
u8 *mac;
|
||||
u32 offset;
|
||||
struct tulip_platform_data *pdata;
|
||||
|
||||
switch (unit) {
|
||||
case -1:
|
||||
case 0:
|
||||
offset = ADM8868_UBOOT_LAN_MAC;
|
||||
pdata = ð0_pdata;
|
||||
break;
|
||||
case 1:
|
||||
offset = ADM8868_UBOOT_WAN_MAC;
|
||||
pdata = ð1_pdata;
|
||||
break;
|
||||
default:
|
||||
pr_err("unsupported ethernet unit: %d\n", unit);
|
||||
return;
|
||||
}
|
||||
|
||||
mac = (u8 *)(KSEG1ADDR(ADM8668_SMEM1_BASE) + ADM8868_UBOOT_ENV + offset);
|
||||
|
||||
memcpy(pdata->mac, mac, sizeof(pdata->mac));
|
||||
}
|
||||
|
||||
static void adm8668_ehci_workaround(void)
|
||||
{
|
||||
u32 chipid;
|
||||
|
||||
chipid = ADM8668_CONFIG_REG(ADM8668_CR0);
|
||||
ADM8668_CONFIG_REG(ADM8668_CR66) = 0x0C1600D9;
|
||||
|
||||
if (chipid == 0x86880001)
|
||||
return;
|
||||
|
||||
ADM8668_CONFIG_REG(ADM8668_CR66) &= ~(3 << 20);
|
||||
ADM8668_CONFIG_REG(ADM8668_CR66) |= (1 << 20);
|
||||
pr_info("ADM8668: applied USB workaround\n");
|
||||
}
|
||||
|
||||
|
||||
int __init adm8668_devs_register(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = amba_device_register(&adm8668_uart0_device, &iomem_resource);
|
||||
if (ret)
|
||||
panic("failed to register AMBA UART");
|
||||
|
||||
adm8668_fetch_mac(0);
|
||||
adm8668_fetch_mac(1);
|
||||
adm8668_ehci_workaround();
|
||||
|
||||
return platform_add_devices(adm8668_devs, ARRAY_SIZE(adm8668_devs));
|
||||
}
|
||||
arch_initcall(adm8668_devs_register);
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
|
||||
*
|
||||
* based on work of rb532 prom.c
|
||||
* Copyright (C) 2003, Peter Sadik <peter.sadik@idt.com>
|
||||
* Copyright (C) 2005-2006, P.Christeas <p_christ@hol.gr>
|
||||
* Copyright (C) 2007, Gabor Juhos <juhosg@openwrt.org>
|
||||
* Felix Fietkau <nbd@nbd.name>
|
||||
* Florian Fainelli <florian@openwrt.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <asm/bootinfo.h>
|
||||
#include <adm8668.h>
|
||||
#include "u-boot.h"
|
||||
|
||||
register volatile struct global_data *gd asm ("k0");
|
||||
|
||||
void __init prom_free_prom_memory(void)
|
||||
{
|
||||
/* No prom memory to free */
|
||||
}
|
||||
|
||||
static inline int match_tag(char *arg, const char *tag)
|
||||
{
|
||||
return strncmp(arg, tag, strlen(tag)) == 0;
|
||||
}
|
||||
|
||||
static inline unsigned long tag2ul(char *arg, const char *tag)
|
||||
{
|
||||
char *num;
|
||||
|
||||
num = arg + strlen(tag);
|
||||
return simple_strtoul(num, 0, 10);
|
||||
}
|
||||
|
||||
void __init prom_setup_cmdline(void)
|
||||
{
|
||||
char *cp;
|
||||
int prom_argc;
|
||||
char **prom_argv;
|
||||
int i;
|
||||
|
||||
prom_argc = fw_arg0;
|
||||
prom_argv = (char **)KSEG0ADDR(fw_arg1);
|
||||
|
||||
cp = &(arcs_cmdline[0]);
|
||||
for (i = 1; i < prom_argc; i++) {
|
||||
prom_argv[i] = (char *)KSEG0ADDR(prom_argv[i]);
|
||||
|
||||
/* default bootargs has "console=/dev/ttyS0" yet console won't
|
||||
* show up at all if you include the '/dev/' nowadays ... */
|
||||
if (match_tag(prom_argv[i], "console=/dev/")) {
|
||||
char *ptr = prom_argv[i] + strlen("console=/dev/");
|
||||
|
||||
strcpy(cp, "console=");
|
||||
cp += strlen("console=");
|
||||
strcpy(cp, ptr);
|
||||
cp += strlen(ptr);
|
||||
*cp++ = ' ';
|
||||
continue;
|
||||
}
|
||||
strcpy(cp, prom_argv[i]);
|
||||
cp += strlen(prom_argv[i]);
|
||||
*cp++ = ' ';
|
||||
}
|
||||
if (prom_argc > 1)
|
||||
--cp; /* trailing space */
|
||||
|
||||
*cp = '\0';
|
||||
}
|
||||
|
||||
void __init prom_init(void)
|
||||
{
|
||||
bd_t *bd = gd->bd;
|
||||
int memsize;
|
||||
|
||||
memsize = bd->bi_memsize;
|
||||
printk("Board info:\n");
|
||||
printk(" RAM size: %d MB\n", (int)memsize/(1024*1024));
|
||||
printk(" NOR start: %#lx\n", bd->bi_flashstart);
|
||||
printk(" NOR size: %#lx\n", bd->bi_flashsize);
|
||||
|
||||
prom_setup_cmdline();
|
||||
add_memory_region(0, memsize, BOOT_MEM_RAM);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
#include <asm/reboot.h>
|
||||
#include <adm8668.h>
|
||||
|
||||
static void adm8668_restart(char *cmd)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* the real deal */
|
||||
for (i = 0; i < 1000; i++)
|
||||
;
|
||||
ADM8668_CONFIG_REG(ADM8668_CR1) = 1;
|
||||
}
|
||||
|
||||
void __init plat_mem_setup(void)
|
||||
{
|
||||
_machine_restart = adm8668_restart;
|
||||
}
|
||||
|
||||
const char *get_system_type(void)
|
||||
{
|
||||
unsigned long chipid = ADM8668_CONFIG_REG(ADM8668_CR0);
|
||||
int product, revision;
|
||||
static char ret[32];
|
||||
|
||||
product = chipid >> 16;
|
||||
revision = chipid & 0xffff;
|
||||
|
||||
/* i getting fancy :\ */
|
||||
snprintf(ret, sizeof(ret), "ADM%xr%x", product, revision);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <asm/time.h>
|
||||
#include <adm8668.h>
|
||||
|
||||
void __init plat_time_init(void)
|
||||
{
|
||||
struct clk *sys_clk;
|
||||
|
||||
adm8668_init_clocks();
|
||||
|
||||
sys_clk = clk_get(NULL, "sys");
|
||||
if (IS_ERR(sys_clk))
|
||||
panic("unable to get system clock\n");
|
||||
|
||||
mips_hpt_frequency = clk_get_rate(sys_clk) / 2;
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef _U_BOOT_H_
|
||||
#define _U_BOOT_H_ 1
|
||||
|
||||
typedef struct bd_info {
|
||||
int bi_baudrate; /* serial console baudrate */
|
||||
unsigned long bi_ip_addr; /* IP Address */
|
||||
unsigned char bi_enetaddr[6]; /* Ethernet adress */
|
||||
unsigned long bi_arch_number; /* unique id for this board */
|
||||
unsigned long bi_boot_params; /* where this board expects params */
|
||||
unsigned long bi_memstart; /* start of DRAM memory */
|
||||
unsigned long bi_memsize; /* size of DRAM memory in bytes */
|
||||
unsigned long bi_flashstart; /* start of FLASH memory */
|
||||
unsigned long bi_flashsize; /* size of FLASH memory */
|
||||
unsigned long bi_flashoffset; /* reserved area for startup monitor */
|
||||
} bd_t;
|
||||
|
||||
struct global_data {
|
||||
bd_t *bd; /* board data... */
|
||||
unsigned long flags;
|
||||
unsigned long baudrate;
|
||||
unsigned long have_console; /* serial_init() was called */
|
||||
unsigned long ram_size; /* RAM size */
|
||||
unsigned long reloc_off; /* Relocation Offset */
|
||||
unsigned long env_addr; /* Address of Environment struct */
|
||||
unsigned long env_valid; /* Checksum of Environment valid? */
|
||||
void **jt; /* jump table */
|
||||
};
|
||||
|
||||
#endif /* _U_BOOT_H_ */
|
@ -1,69 +0,0 @@
|
||||
/************************************************************************
|
||||
*
|
||||
* Copyright (c) 2005
|
||||
* Infineon Technologies AG
|
||||
* St. Martin Strasse 53; 81669 Muenchen; Germany
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef __ADM8668_H__
|
||||
#define __ADM8668_H__
|
||||
|
||||
/*======================= Physical Memory Map ============================*/
|
||||
#define ADM8668_SDRAM_BASE 0
|
||||
#define ADM8668_SMEM1_BASE 0x10000000
|
||||
#define ADM8668_MPMC_BASE 0x11000000
|
||||
#define ADM8668_USB_BASE 0x11200000
|
||||
#define ADM8668_CONFIG_BASE 0x11400000
|
||||
#define ADM8668_WAN_BASE 0x11600000
|
||||
#define ADM8668_WLAN_BASE 0x11800000
|
||||
#define ADM8668_LAN_BASE 0x11A00000
|
||||
#define ADM8668_INTC_BASE 0x1E000000
|
||||
#define ADM8668_TMR_BASE 0x1E200000
|
||||
#define ADM8668_UART0_BASE 0x1E400000
|
||||
#define ADM8668_SMEM0_BASE 0x1FC00000
|
||||
#define ADM8668_NAND_BASE 0x1FFFFF00
|
||||
|
||||
#define ADM8668_PCICFG_BASE 0x12200000
|
||||
#define ADM8668_PCIDAT_BASE 0x12400000
|
||||
|
||||
/* interrupt levels */
|
||||
#define ADM8668_SWI_IRQ 1
|
||||
#define ADM8668_COMMS_RX_IRQ 2
|
||||
#define ADM8668_COMMS_TX_IRQ 3
|
||||
#define ADM8668_TIMER0_IRQ 4
|
||||
#define ADM8668_TIMER1_IRQ 5
|
||||
#define ADM8668_UART0_IRQ 6
|
||||
#define ADM8668_LAN_IRQ 7
|
||||
#define ADM8668_WAN_IRQ 8
|
||||
#define ADM8668_WLAN_IRQ 9
|
||||
#define ADM8668_GPIO_IRQ 10
|
||||
#define ADM8668_IDE_IRQ 11
|
||||
#define ADM8668_PCI2_IRQ 12
|
||||
#define ADM8668_PCI1_IRQ 13
|
||||
#define ADM8668_PCI0_IRQ 14
|
||||
#define ADM8668_USB_IRQ 15
|
||||
#define ADM8668_IRQ_MAX ADM8668_USB_IRQ
|
||||
|
||||
/* register access macros */
|
||||
#define ADM8668_CONFIG_REG(_reg) \
|
||||
(*((volatile unsigned int *)(KSEG1ADDR(ADM8668_CONFIG_BASE + (_reg)))))
|
||||
|
||||
/* lan registers */
|
||||
#define NETCSR6 0x30
|
||||
#define NETCSR7 0x38
|
||||
#define NETCSR37 0xF8
|
||||
|
||||
/* known/used CPU configuration registers */
|
||||
#define ADM8668_CR0 0x00
|
||||
#define ADM8668_CR1 0x04
|
||||
#define ADM8668_CR3 0x0C
|
||||
#define ADM8668_CR66 0x108
|
||||
|
||||
/** For GPIO control **/
|
||||
#define GPIO_REG 0x5C /* on WLAN */
|
||||
#define CRGPIO_REG 0x20 /* on CPU */
|
||||
|
||||
void adm8668_init_clocks(void);
|
||||
|
||||
#endif /* __ADM8668_H__ */
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
/* DO NOT EDIT!! - this file automatically generated
|
||||
* from .s file by awk -f s2h.awk
|
||||
*/
|
||||
/* Size definitions
|
||||
* Copyright (C) ARM Limited 1998. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __sizes_h
|
||||
#define __sizes_h 1
|
||||
|
||||
/* handy sizes */
|
||||
#define SZ_16 0x00000010
|
||||
#define SZ_256 0x00000100
|
||||
#define SZ_512 0x00000200
|
||||
|
||||
#define SZ_1K 0x00000400
|
||||
#define SZ_4K 0x00001000
|
||||
#define SZ_8K 0x00002000
|
||||
#define SZ_16K 0x00004000
|
||||
#define SZ_64K 0x00010000
|
||||
#define SZ_128K 0x00020000
|
||||
#define SZ_256K 0x00040000
|
||||
#define SZ_512K 0x00080000
|
||||
|
||||
#define SZ_1M 0x00100000
|
||||
#define SZ_2M 0x00200000
|
||||
#define SZ_4M 0x00400000
|
||||
#define SZ_8M 0x00800000
|
||||
#define SZ_16M 0x01000000
|
||||
#define SZ_32M 0x02000000
|
||||
#define SZ_64M 0x04000000
|
||||
#define SZ_128M 0x08000000
|
||||
#define SZ_256M 0x10000000
|
||||
#define SZ_512M 0x20000000
|
||||
|
||||
#define SZ_1G 0x40000000
|
||||
#define SZ_2G 0x80000000
|
||||
|
||||
#endif
|
||||
|
||||
/* END */
|
@ -1,13 +0,0 @@
|
||||
#ifndef __ADM8668_GPIO_H__
|
||||
#define __ADM8668_GPIO_H__
|
||||
|
||||
#define gpio_to_irq(gpio) -1
|
||||
|
||||
#define gpio_get_value __gpio_get_value
|
||||
#define gpio_set_value __gpio_set_value
|
||||
|
||||
#define gpio_cansleep __gpio_cansleep
|
||||
|
||||
#include <asm-generic/gpio.h>
|
||||
|
||||
#endif
|
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Copyright (C) 2003 by Ralf Baechle
|
||||
*/
|
||||
#ifndef __ASM_MACH_ADM8668_IRQ_H
|
||||
#define __ASM_MACH_ADM8668_IRQ_H
|
||||
|
||||
#define NR_IRQS 32
|
||||
#define MIPS_CPU_IRQ_BASE 16
|
||||
|
||||
#endif /* __ASM_MACH_ADM8668_IRQ_H */
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
|
||||
*/
|
||||
#ifndef __ASM_MIPS_MACH_ADM8668_WAR_H
|
||||
#define __ASM_MIPS_MACH_ADM8668_WAR_H
|
||||
|
||||
#define R4600_V1_INDEX_ICACHEOP_WAR 0
|
||||
#define R4600_V1_HIT_CACHEOP_WAR 0
|
||||
#define R4600_V2_HIT_CACHEOP_WAR 0
|
||||
#define R5432_CP0_INTERRUPT_WAR 0
|
||||
#define BCM1250_M3_WAR 0
|
||||
#define SIBYTE_1956_WAR 0
|
||||
#define MIPS4K_ICACHE_REFILL_WAR 0
|
||||
#define MIPS_CACHE_SYNC_WAR 0
|
||||
#define TX49XX_ICACHE_INDEX_INV_WAR 0
|
||||
#define RM9000_CDEX_SMP_WAR 0
|
||||
#define ICACHE_REFILLS_WORKAROUND_WAR 0
|
||||
#define R10000_LLSC_WAR 0
|
||||
#define MIPS34K_MISSED_ITLB_WAR 0
|
||||
|
||||
#endif /* __ASM_MIPS_MACH_ADM8668_WAR_H */
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
|
||||
* Copyright (C) 2012 Florian Fainelli <florian@openwrt.org>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*
|
||||
* Note that this controller is identical to the ADM5120 one
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/pci.h>
|
||||
#include <adm8668.h>
|
||||
|
||||
static DEFINE_SPINLOCK(pci_lock);
|
||||
|
||||
#define PCI_ENABLE 0x80000000
|
||||
#define ADMPCI_IO_BASE 0x12600000
|
||||
#define ADMPCI_IO_SIZE 0x1fffff
|
||||
#define ADMPCI_MEM_BASE 0x16000000
|
||||
#define ADMPCI_MEM_SIZE 0x7ffffff
|
||||
|
||||
static inline void write_cfgaddr(u32 addr)
|
||||
{
|
||||
__raw_writel((addr | PCI_ENABLE),
|
||||
(void __iomem *)KSEG1ADDR(ADM8668_PCICFG_BASE));
|
||||
}
|
||||
|
||||
static inline void write_cfgdata(u32 data)
|
||||
{
|
||||
__raw_writel(data, (void __iomem *)KSEG1ADDR(ADM8668_PCIDAT_BASE));
|
||||
}
|
||||
|
||||
static inline u32 read_cfgdata(void)
|
||||
{
|
||||
return __raw_readl((void __iomem *)KSEG1ADDR(ADM8668_PCIDAT_BASE));
|
||||
}
|
||||
|
||||
static inline u32 mkaddr(struct pci_bus *bus, unsigned int devfn, int where)
|
||||
{
|
||||
return ((bus->number & 0xff) << 16) | ((devfn & 0xff) << 8) |
|
||||
(where & 0xfc);
|
||||
}
|
||||
|
||||
static int pci_read_config(struct pci_bus *bus, unsigned int devfn,
|
||||
int where, int size, u32 *val)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 data;
|
||||
|
||||
spin_lock_irqsave(&pci_lock, flags);
|
||||
write_cfgaddr(mkaddr(bus, devfn, where));
|
||||
data = read_cfgdata();
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
if (where & 1)
|
||||
data >>= 8;
|
||||
if (where & 2)
|
||||
data >>= 16;
|
||||
data &= 0xff;
|
||||
break;
|
||||
case 2:
|
||||
if (where & 2)
|
||||
data >>= 16;
|
||||
data &= 0xffff;
|
||||
break;
|
||||
}
|
||||
|
||||
*val = data;
|
||||
|
||||
spin_unlock_irqrestore(&pci_lock, flags);
|
||||
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
static int pci_write_config(struct pci_bus *bus, unsigned int devfn,
|
||||
int where, int size, u32 val)
|
||||
{
|
||||
unsigned long flags;
|
||||
u32 data;
|
||||
int s;
|
||||
|
||||
spin_lock_irqsave(&pci_lock, flags);
|
||||
|
||||
write_cfgaddr(mkaddr(bus, devfn, where));
|
||||
data = read_cfgdata();
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
s = ((where & 3) << 3);
|
||||
data &= ~(0xff << s);
|
||||
data |= ((val & 0xff) << s);
|
||||
break;
|
||||
case 2:
|
||||
s = ((where & 2) << 4);
|
||||
data &= ~(0xffff << s);
|
||||
data |= ((val & 0xffff) << s);
|
||||
break;
|
||||
case 4:
|
||||
data = val;
|
||||
break;
|
||||
}
|
||||
|
||||
write_cfgdata(data);
|
||||
|
||||
spin_unlock_irqrestore(&pci_lock, flags);
|
||||
|
||||
return PCIBIOS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
struct pci_ops adm8668_pci_ops = {
|
||||
.read = pci_read_config,
|
||||
.write = pci_write_config
|
||||
};
|
||||
|
||||
|
||||
struct resource pciioport_resource = {
|
||||
.name = "adm8668_pci",
|
||||
.start = ADMPCI_IO_BASE,
|
||||
.end = ADMPCI_IO_BASE + ADMPCI_IO_SIZE,
|
||||
.flags = IORESOURCE_IO
|
||||
};
|
||||
|
||||
struct resource pciiomem_resource = {
|
||||
.name = "adm8668_pci",
|
||||
.start = ADMPCI_MEM_BASE,
|
||||
.end = ADMPCI_MEM_BASE + ADMPCI_MEM_SIZE,
|
||||
.flags = IORESOURCE_MEM
|
||||
};
|
||||
|
||||
struct pci_controller adm8668_pci_controller = {
|
||||
.pci_ops = &adm8668_pci_ops,
|
||||
.io_resource = &pciioport_resource,
|
||||
.mem_resource = &pciiomem_resource,
|
||||
};
|
||||
|
||||
int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
||||
{
|
||||
switch (slot) {
|
||||
case 1:
|
||||
return 14;
|
||||
case 2:
|
||||
return 13;
|
||||
case 3:
|
||||
return 12;
|
||||
default:
|
||||
return dev->irq;
|
||||
}
|
||||
}
|
||||
|
||||
int pcibios_plat_dev_init(struct pci_dev *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void adm8668_pci_fixup(struct pci_dev *dev)
|
||||
{
|
||||
if (dev->devfn != 0)
|
||||
return;
|
||||
|
||||
pr_info("PCI: fixing up ADM8668 controller\n");
|
||||
|
||||
/* setup COMMAND register */
|
||||
pci_write_config_word(dev, PCI_COMMAND,
|
||||
(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER));
|
||||
|
||||
/* setup CACHE_LINE_SIZE register */
|
||||
pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 4);
|
||||
|
||||
/* setup BARS */
|
||||
pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0);
|
||||
pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0);
|
||||
}
|
||||
DECLARE_PCI_FIXUP_HEADER(0x1317, 0x8688, adm8668_pci_fixup);
|
||||
|
||||
static int __init adm8668_pci_init(void)
|
||||
{
|
||||
void __iomem *io_map_base;
|
||||
|
||||
ioport_resource.start = ADMPCI_IO_BASE;
|
||||
ioport_resource.end = ADMPCI_IO_BASE + ADMPCI_IO_SIZE;
|
||||
|
||||
io_map_base = ioremap(ADMPCI_IO_BASE, ADMPCI_IO_SIZE);
|
||||
if (!io_map_base)
|
||||
printk("io_map_base didn't work.\n");
|
||||
|
||||
adm8668_pci_controller.io_map_base = (unsigned long)io_map_base;
|
||||
register_pci_controller(&adm8668_pci_controller);
|
||||
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(adm8668_pci_init);
|
@ -1,334 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
|
||||
* Copyright (C) 2006 Felix Fietkau <nbd@nbd.name>
|
||||
* Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org>
|
||||
* Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
|
||||
*
|
||||
* original functions for finding root filesystem from Mike Baker
|
||||
*
|
||||
* 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* 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.,
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
* Copyright 2004, Broadcom Corporation
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
|
||||
* KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
|
||||
* SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
|
||||
*
|
||||
* Flash mapping for adm8668 boards
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/map.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/crc32.h>
|
||||
#include <linux/magic.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define WINDOW_ADDR 0x10000000
|
||||
#define WINDOW_SIZE 0x800000
|
||||
#define BANKWIDTH 2
|
||||
|
||||
/* first a little bit about the headers i need.. */
|
||||
|
||||
/* just interested in part of the full struct */
|
||||
struct squashfs_super_block {
|
||||
__le32 s_magic;
|
||||
__le32 pad0[9]; /* it's not really padding */
|
||||
__le64 bytes_used;
|
||||
};
|
||||
|
||||
#define IH_MAGIC 0x56190527 /* Image Magic Number */
|
||||
struct uboot_header {
|
||||
uint32_t ih_magic; /* Image Header Magic Number */
|
||||
uint32_t ih_hcrc; /* Image Header CRC Checksum */
|
||||
uint32_t ih_time; /* Image Creation Timestamp */
|
||||
uint32_t ih_size; /* Image Data Size */
|
||||
uint32_t ih_load; /* Data Load Address */
|
||||
uint32_t ih_ep; /* Entry Point Address */
|
||||
uint32_t ih_dcrc; /* Image Data CRC Checksum */
|
||||
uint8_t ih_os; /* Operating System */
|
||||
uint8_t ih_arch; /* CPU architecture */
|
||||
uint8_t ih_type; /* Image Type */
|
||||
uint8_t ih_comp; /* Compression Type */
|
||||
char ih_name[32]; /* image name */
|
||||
};
|
||||
|
||||
/************************************************/
|
||||
|
||||
static struct mtd_info *adm8668_mtd;
|
||||
|
||||
struct map_info adm8668_map = {
|
||||
name: "adm8668-nor",
|
||||
size: WINDOW_SIZE,
|
||||
phys: WINDOW_ADDR,
|
||||
bankwidth: BANKWIDTH,
|
||||
};
|
||||
|
||||
/*
|
||||
* Copied from mtdblock.c
|
||||
*
|
||||
* Cache stuff...
|
||||
*
|
||||
* Since typical flash erasable sectors are much larger than what Linux's
|
||||
* buffer cache can handle, we must implement read-modify-write on flash
|
||||
* sectors for each block write requests. To avoid over-erasing flash sectors
|
||||
* and to speed things up, we locally cache a whole flash sector while it is
|
||||
* being written to until a different sector is required.
|
||||
*/
|
||||
|
||||
static void erase_callback(struct erase_info *done)
|
||||
{
|
||||
wait_queue_head_t *wait_q = (wait_queue_head_t *)done->priv;
|
||||
wake_up(wait_q);
|
||||
}
|
||||
|
||||
static int erase_write (struct mtd_info *mtd, unsigned long pos,
|
||||
int len, const char *buf)
|
||||
{
|
||||
struct erase_info erase;
|
||||
DECLARE_WAITQUEUE(wait, current);
|
||||
wait_queue_head_t wait_q;
|
||||
size_t retlen;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* First, let's erase the flash block.
|
||||
*/
|
||||
|
||||
init_waitqueue_head(&wait_q);
|
||||
erase.mtd = mtd;
|
||||
erase.callback = erase_callback;
|
||||
erase.addr = pos;
|
||||
erase.len = len;
|
||||
erase.priv = (u_long)&wait_q;
|
||||
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
add_wait_queue(&wait_q, &wait);
|
||||
|
||||
ret = mtd->_erase(mtd, &erase);
|
||||
if (ret) {
|
||||
set_current_state(TASK_RUNNING);
|
||||
remove_wait_queue(&wait_q, &wait);
|
||||
printk (KERN_WARNING "erase of region [0x%lx, 0x%x] "
|
||||
"on \"%s\" failed\n",
|
||||
pos, len, mtd->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
schedule(); /* Wait for erase to finish. */
|
||||
remove_wait_queue(&wait_q, &wait);
|
||||
|
||||
/*
|
||||
* Next, write data to flash.
|
||||
*/
|
||||
|
||||
ret = mtd->_write (mtd, pos, len, &retlen, buf);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (retlen != len)
|
||||
return -EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* decent defaults in case... shrug */
|
||||
static struct mtd_partition adm8668_parts[] = {
|
||||
{ name: "linux", offset: 0x40000, size: WINDOW_SIZE-0x40000, },
|
||||
{ name: "rootfs", offset: 0xe0000, size: 0x140000, },
|
||||
{ name: "uboot_env", offset: 0x20000, size: 0x20000, },
|
||||
{ name: NULL, },
|
||||
};
|
||||
|
||||
/* in case i wanna change stuff later, and to clarify the math section... */
|
||||
#define PART_LINUX 0
|
||||
#define PART_ROOTFS 1
|
||||
#define NR_PARTS 3
|
||||
|
||||
static int __init
|
||||
init_mtd_partitions(struct mtd_info *mtd, size_t size)
|
||||
{
|
||||
struct uboot_header uhdr;
|
||||
int off, blocksize;
|
||||
size_t len, linux_len;
|
||||
struct squashfs_super_block shdr;
|
||||
|
||||
blocksize = mtd->erasesize;
|
||||
if (blocksize < 0x10000)
|
||||
blocksize = 0x10000;
|
||||
|
||||
/* now find squashfs */
|
||||
memset(&shdr, 0xe5, sizeof(shdr));
|
||||
for (off = adm8668_parts[PART_LINUX].offset; off < size; off += blocksize) {
|
||||
/*
|
||||
* Read into buffer
|
||||
*/
|
||||
if (mtd->_read(mtd, off, sizeof(shdr), &len, (char *)&shdr) ||
|
||||
len != sizeof(shdr))
|
||||
continue;
|
||||
|
||||
if (shdr.s_magic == SQUASHFS_MAGIC) {
|
||||
uint32_t fs_size = (uint32_t)shdr.bytes_used;
|
||||
|
||||
printk(KERN_INFO "%s: Filesystem type: squashfs, size=%dkB\n",
|
||||
mtd->name, fs_size>>10);
|
||||
|
||||
/* Update rootfs based on the superblock info, and
|
||||
* stretch to end of MTD. rootfs_split will split it */
|
||||
adm8668_parts[PART_ROOTFS].offset = off;
|
||||
adm8668_parts[PART_ROOTFS].size = mtd->size -
|
||||
adm8668_parts[PART_ROOTFS].offset;
|
||||
|
||||
/* kernel ends where rootfs starts
|
||||
* but we'll keep it full-length for upgrades */
|
||||
linux_len = adm8668_parts[PART_LINUX+1].offset -
|
||||
adm8668_parts[PART_LINUX].offset;
|
||||
#if 1
|
||||
adm8668_parts[PART_LINUX].size = mtd->size -
|
||||
adm8668_parts[PART_LINUX].offset;
|
||||
#else
|
||||
adm8668_parts[PART_LINUX].size = linux_len;
|
||||
#endif
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
printk(KERN_NOTICE
|
||||
"%s: Couldn't find root filesystem\n",
|
||||
mtd->name);
|
||||
return NR_PARTS;
|
||||
|
||||
found:
|
||||
if (mtd->_read(mtd, adm8668_parts[PART_LINUX].offset, sizeof(uhdr), &len, (char *)&uhdr) ||
|
||||
len != sizeof(uhdr))
|
||||
return NR_PARTS;
|
||||
|
||||
/* that's odd. how'd ya boot it then */
|
||||
if (uhdr.ih_magic != IH_MAGIC)
|
||||
return NR_PARTS;
|
||||
|
||||
if (be32_to_cpu(uhdr.ih_size) != (linux_len - sizeof(uhdr))) {
|
||||
unsigned char *block, *data;
|
||||
unsigned int offset;
|
||||
|
||||
offset = adm8668_parts[PART_LINUX].offset +
|
||||
sizeof(struct uboot_header);
|
||||
data = (unsigned char *)(WINDOW_ADDR | 0xA0000000 | offset);
|
||||
|
||||
printk(KERN_NOTICE "Updating U-boot image:\n");
|
||||
printk(KERN_NOTICE " old: [size: %8d crc32: 0x%08x]\n",
|
||||
be32_to_cpu(uhdr.ih_size), be32_to_cpu(uhdr.ih_dcrc));
|
||||
|
||||
/* Update the data length & crc32 */
|
||||
uhdr.ih_size = cpu_to_be32(linux_len - sizeof(uhdr));
|
||||
uhdr.ih_dcrc = crc32_le(~0, data, linux_len - sizeof(uhdr)) ^ (~0);
|
||||
uhdr.ih_dcrc = cpu_to_be32(uhdr.ih_dcrc);
|
||||
|
||||
printk(KERN_NOTICE " new: [size: %8d crc32: 0x%08x]\n",
|
||||
be32_to_cpu(uhdr.ih_size), be32_to_cpu(uhdr.ih_dcrc));
|
||||
|
||||
/* update header's crc... */
|
||||
uhdr.ih_hcrc = 0;
|
||||
uhdr.ih_hcrc = crc32_le(~0, (unsigned char *)&uhdr,
|
||||
sizeof(uhdr)) ^ (~0);
|
||||
uhdr.ih_hcrc = cpu_to_be32(uhdr.ih_hcrc);
|
||||
|
||||
/* read first eraseblock from the image */
|
||||
block = kmalloc(mtd->erasesize, GFP_KERNEL);
|
||||
if (mtd->_read(mtd, adm8668_parts[PART_LINUX].offset, mtd->erasesize, &len, block) || len != mtd->erasesize) {
|
||||
printk("Error copying first eraseblock\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Write updated header to the flash */
|
||||
memcpy(block, &uhdr, sizeof(uhdr));
|
||||
if (mtd->_unlock)
|
||||
mtd->_unlock(mtd, off, mtd->erasesize);
|
||||
erase_write(mtd, adm8668_parts[PART_LINUX].offset, mtd->erasesize, block);
|
||||
if (mtd->_sync)
|
||||
mtd->_sync(mtd);
|
||||
kfree(block);
|
||||
printk(KERN_NOTICE "Done\n");
|
||||
}
|
||||
|
||||
return NR_PARTS;
|
||||
}
|
||||
|
||||
int __init init_adm8668_map(void)
|
||||
{
|
||||
int nr_parts, ret;
|
||||
|
||||
adm8668_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
|
||||
|
||||
if (!adm8668_map.virt) {
|
||||
printk(KERN_ERR "Failed to ioremap\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
simple_map_init(&adm8668_map);
|
||||
if (!(adm8668_mtd = do_map_probe("cfi_probe", &adm8668_map))) {
|
||||
printk(KERN_ERR "cfi_probe failed\n");
|
||||
iounmap((void *)adm8668_map.virt);
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
adm8668_mtd->owner = THIS_MODULE;
|
||||
|
||||
nr_parts = init_mtd_partitions(adm8668_mtd, adm8668_mtd->size);
|
||||
ret = mtd_device_register(adm8668_mtd, adm8668_parts, nr_parts);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "Flash: mtd_device_register failed\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
if (adm8668_mtd)
|
||||
map_destroy(adm8668_mtd);
|
||||
if (adm8668_map.virt)
|
||||
iounmap((void *) adm8668_map.virt);
|
||||
adm8668_map.virt = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void __exit cleanup_adm8668_map(void)
|
||||
{
|
||||
mtd_device_unregister(adm8668_mtd);
|
||||
map_destroy(adm8668_mtd);
|
||||
iounmap((void *) adm8668_map.virt);
|
||||
adm8668_map.virt = 0;
|
||||
}
|
||||
|
||||
module_init(init_adm8668_map);
|
||||
module_exit(cleanup_adm8668_map);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Scott Nicholas <neutronscott@scottn.us>");
|
||||
MODULE_DESCRIPTION("MTD map driver for ADM8668 NOR Flash");
|
@ -1,60 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
|
||||
UIMAGE:=$(IMG_PREFIX)-uImage
|
||||
|
||||
define kernel_entry
|
||||
-a 0x80002000 -e 0x80002000
|
||||
endef
|
||||
|
||||
|
||||
define CompressGzip
|
||||
gzip -9n -c $(1) > $(2)
|
||||
endef
|
||||
|
||||
define MkImage
|
||||
mkimage -A mips -O linux -T kernel $(call kernel_entry) -C $(1) $(2) \
|
||||
-n "ADM8668 Linux Kernel(2.4.31)" \
|
||||
-d $(3) $(4)
|
||||
endef
|
||||
|
||||
define Build/Clean
|
||||
$(MAKE) -C lzma-loader clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
$(MAKE) -C lzma-loader \
|
||||
KDIR="$(KDIR)" \
|
||||
clean compile
|
||||
rm -f $(KDIR)/fs_mark
|
||||
touch $(KDIR)/fs_mark
|
||||
$(call prepare_generic_squashfs,$(KDIR)/fs_mark)
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
./my-mkimage $(KDIR)/loader.bin $(KDIR)/root.squashfs \
|
||||
$(KDIR)/fs_mark $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
|
||||
endef
|
||||
|
||||
define Image/BuildKernel
|
||||
cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
|
||||
cp $(KDIR)/vmlinux $(VMLINUX).bin
|
||||
$(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz)
|
||||
$(call MkImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(BIN_DIR)/$(UIMAGE)-gzip.bin)
|
||||
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
||||
cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
|
||||
cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin
|
||||
$(call CompressGzip,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.gz)
|
||||
$(call MkImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(BIN_DIR)/$(UIMAGE)-initramfs-gzip.bin)
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildImage))
|
@ -1,41 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME := loader
|
||||
PKG_VERSION := 0.05
|
||||
|
||||
PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)-$(PKG_VERSION)$(LOADER_TYPE)
|
||||
|
||||
$(PKG_BUILD_DIR)/.prepared:
|
||||
mkdir $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
touch $@
|
||||
|
||||
$(PKG_BUILD_DIR)/lzma.elf: $(PKG_BUILD_DIR)/.prepared $(PKG_BUILD_DIR)/vmlinux.lzma
|
||||
PATH="$(TARGET_PATH)" $(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
CC="$(TARGET_CC)" CROSS_COMPILE="$(TARGET_CROSS)"
|
||||
|
||||
$(PKG_BUILD_DIR)/vmlinux.lzma: $(KDIR)/vmlinux.lzma
|
||||
$(CP) $< $@
|
||||
|
||||
$(KDIR)/loader$(LOADER_TYPE).elf: $(PKG_BUILD_DIR)/lzma.elf
|
||||
$(CP) $< $@
|
||||
|
||||
$(KDIR)/loader$(LOADER_TYPE).bin: $(PKG_BUILD_DIR)/lzma.bin
|
||||
$(CP) $< $@
|
||||
|
||||
download:
|
||||
prepare: $(PKG_BUILD_DIR)/.prepared
|
||||
compile: $(KDIR)/loader$(LOADER_TYPE).elf $(KDIR)/loader$(LOADER_TYPE).bin
|
||||
install:
|
||||
|
||||
clean:
|
||||
rm -rf $(PKG_BUILD_DIR)
|
||||
rm -f $(KDIR)/loader.elf
|
||||
rm -f $(KDIR)/loader.bin
|
@ -1,590 +0,0 @@
|
||||
/*
|
||||
LzmaDecode.c
|
||||
LZMA Decoder (optimized for Speed version)
|
||||
|
||||
LZMA SDK 4.22 Copyright (c) 1999-2005 Igor Pavlov (2005-06-10)
|
||||
http://www.7-zip.org/
|
||||
|
||||
LZMA SDK is licensed under two licenses:
|
||||
1) GNU Lesser General Public License (GNU LGPL)
|
||||
2) Common Public License (CPL)
|
||||
It means that you can select one of these two licenses and
|
||||
follow rules of that license.
|
||||
|
||||
SPECIAL EXCEPTION:
|
||||
Igor Pavlov, as the author of this Code, expressly permits you to
|
||||
statically or dynamically link your Code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked Code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
to this file, however, are subject to the LGPL or CPL terms.
|
||||
*/
|
||||
|
||||
#include "LzmaDecode.h"
|
||||
|
||||
#ifndef Byte
|
||||
#define Byte unsigned char
|
||||
#endif
|
||||
|
||||
#define kNumTopBits 24
|
||||
#define kTopValue ((UInt32)1 << kNumTopBits)
|
||||
|
||||
#define kNumBitModelTotalBits 11
|
||||
#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
||||
#define kNumMoveBits 5
|
||||
|
||||
#define RC_READ_BYTE (*Buffer++)
|
||||
|
||||
#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \
|
||||
{ int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }}
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
|
||||
#define RC_TEST { if (Buffer == BufferLim) \
|
||||
{ SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \
|
||||
BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }}
|
||||
|
||||
#define RC_INIT Buffer = BufferLim = 0; RC_INIT2
|
||||
|
||||
#else
|
||||
|
||||
#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; }
|
||||
|
||||
#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2
|
||||
|
||||
#endif
|
||||
|
||||
#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; }
|
||||
|
||||
#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound)
|
||||
#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits;
|
||||
#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits;
|
||||
|
||||
#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \
|
||||
{ UpdateBit0(p); mi <<= 1; A0; } else \
|
||||
{ UpdateBit1(p); mi = (mi + mi) + 1; A1; }
|
||||
|
||||
#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;)
|
||||
|
||||
#define RangeDecoderBitTreeDecode(probs, numLevels, res) \
|
||||
{ int i = numLevels; res = 1; \
|
||||
do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \
|
||||
res -= (1 << numLevels); }
|
||||
|
||||
|
||||
#define kNumPosBitsMax 4
|
||||
#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
||||
|
||||
#define kLenNumLowBits 3
|
||||
#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
||||
#define kLenNumMidBits 3
|
||||
#define kLenNumMidSymbols (1 << kLenNumMidBits)
|
||||
#define kLenNumHighBits 8
|
||||
#define kLenNumHighSymbols (1 << kLenNumHighBits)
|
||||
|
||||
#define LenChoice 0
|
||||
#define LenChoice2 (LenChoice + 1)
|
||||
#define LenLow (LenChoice2 + 1)
|
||||
#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
|
||||
#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
||||
#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||
|
||||
|
||||
#define kNumStates 12
|
||||
#define kNumLitStates 7
|
||||
|
||||
#define kStartPosModelIndex 4
|
||||
#define kEndPosModelIndex 14
|
||||
#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
|
||||
|
||||
#define kNumPosSlotBits 6
|
||||
#define kNumLenToPosStates 4
|
||||
|
||||
#define kNumAlignBits 4
|
||||
#define kAlignTableSize (1 << kNumAlignBits)
|
||||
|
||||
#define kMatchMinLen 2
|
||||
|
||||
#define IsMatch 0
|
||||
#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
|
||||
#define IsRepG0 (IsRep + kNumStates)
|
||||
#define IsRepG1 (IsRepG0 + kNumStates)
|
||||
#define IsRepG2 (IsRepG1 + kNumStates)
|
||||
#define IsRep0Long (IsRepG2 + kNumStates)
|
||||
#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
|
||||
#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
|
||||
#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
|
||||
#define LenCoder (Align + kAlignTableSize)
|
||||
#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||
#define Literal (RepLenCoder + kNumLenProbs)
|
||||
|
||||
#if Literal != LZMA_BASE_SIZE
|
||||
StopCompilingDueBUG
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size)
|
||||
{
|
||||
unsigned char prop0;
|
||||
if (size < LZMA_PROPERTIES_SIZE)
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
prop0 = propsData[0];
|
||||
if (prop0 >= (9 * 5 * 5))
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
{
|
||||
for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5));
|
||||
for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9);
|
||||
propsRes->lc = prop0;
|
||||
/*
|
||||
unsigned char remainder = (unsigned char)(prop0 / 9);
|
||||
propsRes->lc = prop0 % 9;
|
||||
propsRes->pb = remainder / 5;
|
||||
propsRes->lp = remainder % 5;
|
||||
*/
|
||||
}
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
{
|
||||
int i;
|
||||
propsRes->DictionarySize = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8);
|
||||
if (propsRes->DictionarySize == 0)
|
||||
propsRes->DictionarySize = 1;
|
||||
}
|
||||
#endif
|
||||
return LZMA_RESULT_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define kLzmaStreamWasFinishedId (-1)
|
||||
|
||||
int LzmaDecode(CLzmaDecoderState *vs,
|
||||
#ifdef _LZMA_IN_CB
|
||||
ILzmaInCallback *InCallback,
|
||||
#else
|
||||
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
|
||||
#endif
|
||||
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed)
|
||||
{
|
||||
CProb *p = vs->Probs;
|
||||
SizeT nowPos = 0;
|
||||
Byte previousByte = 0;
|
||||
UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1;
|
||||
UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1;
|
||||
int lc = vs->Properties.lc;
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
|
||||
UInt32 Range = vs->Range;
|
||||
UInt32 Code = vs->Code;
|
||||
#ifdef _LZMA_IN_CB
|
||||
const Byte *Buffer = vs->Buffer;
|
||||
const Byte *BufferLim = vs->BufferLim;
|
||||
#else
|
||||
const Byte *Buffer = inStream;
|
||||
const Byte *BufferLim = inStream + inSize;
|
||||
#endif
|
||||
int state = vs->State;
|
||||
UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
|
||||
int len = vs->RemainLen;
|
||||
UInt32 globalPos = vs->GlobalPos;
|
||||
UInt32 distanceLimit = vs->DistanceLimit;
|
||||
|
||||
Byte *dictionary = vs->Dictionary;
|
||||
UInt32 dictionarySize = vs->Properties.DictionarySize;
|
||||
UInt32 dictionaryPos = vs->DictionaryPos;
|
||||
|
||||
Byte tempDictionary[4];
|
||||
|
||||
#ifndef _LZMA_IN_CB
|
||||
*inSizeProcessed = 0;
|
||||
#endif
|
||||
*outSizeProcessed = 0;
|
||||
if (len == kLzmaStreamWasFinishedId)
|
||||
return LZMA_RESULT_OK;
|
||||
|
||||
if (dictionarySize == 0)
|
||||
{
|
||||
dictionary = tempDictionary;
|
||||
dictionarySize = 1;
|
||||
tempDictionary[0] = vs->TempDictionary[0];
|
||||
}
|
||||
|
||||
if (len == kLzmaNeedInitId)
|
||||
{
|
||||
{
|
||||
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
|
||||
UInt32 i;
|
||||
for (i = 0; i < numProbs; i++)
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
rep0 = rep1 = rep2 = rep3 = 1;
|
||||
state = 0;
|
||||
globalPos = 0;
|
||||
distanceLimit = 0;
|
||||
dictionaryPos = 0;
|
||||
dictionary[dictionarySize - 1] = 0;
|
||||
#ifdef _LZMA_IN_CB
|
||||
RC_INIT;
|
||||
#else
|
||||
RC_INIT(inStream, inSize);
|
||||
#endif
|
||||
}
|
||||
len = 0;
|
||||
}
|
||||
while(len != 0 && nowPos < outSize)
|
||||
{
|
||||
UInt32 pos = dictionaryPos - rep0;
|
||||
if (pos >= dictionarySize)
|
||||
pos += dictionarySize;
|
||||
outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
|
||||
if (++dictionaryPos == dictionarySize)
|
||||
dictionaryPos = 0;
|
||||
len--;
|
||||
}
|
||||
if (dictionaryPos == 0)
|
||||
previousByte = dictionary[dictionarySize - 1];
|
||||
else
|
||||
previousByte = dictionary[dictionaryPos - 1];
|
||||
|
||||
#else /* if !_LZMA_OUT_READ */
|
||||
|
||||
int state = 0;
|
||||
UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
|
||||
int len = 0;
|
||||
const Byte *Buffer;
|
||||
const Byte *BufferLim;
|
||||
UInt32 Range;
|
||||
UInt32 Code;
|
||||
|
||||
#ifndef _LZMA_IN_CB
|
||||
*inSizeProcessed = 0;
|
||||
#endif
|
||||
*outSizeProcessed = 0;
|
||||
|
||||
{
|
||||
UInt32 i;
|
||||
UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp));
|
||||
for (i = 0; i < numProbs; i++)
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
}
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
RC_INIT;
|
||||
#else
|
||||
RC_INIT(inStream, inSize);
|
||||
#endif
|
||||
|
||||
#endif /* _LZMA_OUT_READ */
|
||||
|
||||
while(nowPos < outSize)
|
||||
{
|
||||
CProb *prob;
|
||||
UInt32 bound;
|
||||
int posState = (int)(
|
||||
(nowPos
|
||||
#ifdef _LZMA_OUT_READ
|
||||
+ globalPos
|
||||
#endif
|
||||
)
|
||||
& posStateMask);
|
||||
|
||||
prob = p + IsMatch + (state << kNumPosBitsMax) + posState;
|
||||
IfBit0(prob)
|
||||
{
|
||||
int symbol = 1;
|
||||
UpdateBit0(prob)
|
||||
prob = p + Literal + (LZMA_LIT_SIZE *
|
||||
(((
|
||||
(nowPos
|
||||
#ifdef _LZMA_OUT_READ
|
||||
+ globalPos
|
||||
#endif
|
||||
)
|
||||
& literalPosMask) << lc) + (previousByte >> (8 - lc))));
|
||||
|
||||
if (state >= kNumLitStates)
|
||||
{
|
||||
int matchByte;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
UInt32 pos = dictionaryPos - rep0;
|
||||
if (pos >= dictionarySize)
|
||||
pos += dictionarySize;
|
||||
matchByte = dictionary[pos];
|
||||
#else
|
||||
matchByte = outStream[nowPos - rep0];
|
||||
#endif
|
||||
do
|
||||
{
|
||||
int bit;
|
||||
CProb *probLit;
|
||||
matchByte <<= 1;
|
||||
bit = (matchByte & 0x100);
|
||||
probLit = prob + 0x100 + bit + symbol;
|
||||
RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break)
|
||||
}
|
||||
while (symbol < 0x100);
|
||||
}
|
||||
while (symbol < 0x100)
|
||||
{
|
||||
CProb *probLit = prob + symbol;
|
||||
RC_GET_BIT(probLit, symbol)
|
||||
}
|
||||
previousByte = (Byte)symbol;
|
||||
|
||||
outStream[nowPos++] = previousByte;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (distanceLimit < dictionarySize)
|
||||
distanceLimit++;
|
||||
|
||||
dictionary[dictionaryPos] = previousByte;
|
||||
if (++dictionaryPos == dictionarySize)
|
||||
dictionaryPos = 0;
|
||||
#endif
|
||||
if (state < 4) state = 0;
|
||||
else if (state < 10) state -= 3;
|
||||
else state -= 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRep + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
rep3 = rep2;
|
||||
rep2 = rep1;
|
||||
rep1 = rep0;
|
||||
state = state < kNumLitStates ? 0 : 3;
|
||||
prob = p + LenCoder;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRepG0 + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState;
|
||||
IfBit0(prob)
|
||||
{
|
||||
#ifdef _LZMA_OUT_READ
|
||||
UInt32 pos;
|
||||
#endif
|
||||
UpdateBit0(prob);
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (distanceLimit == 0)
|
||||
#else
|
||||
if (nowPos == 0)
|
||||
#endif
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
|
||||
state = state < kNumLitStates ? 9 : 11;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
pos = dictionaryPos - rep0;
|
||||
if (pos >= dictionarySize)
|
||||
pos += dictionarySize;
|
||||
previousByte = dictionary[pos];
|
||||
dictionary[dictionaryPos] = previousByte;
|
||||
if (++dictionaryPos == dictionarySize)
|
||||
dictionaryPos = 0;
|
||||
#else
|
||||
previousByte = outStream[nowPos - rep0];
|
||||
#endif
|
||||
outStream[nowPos++] = previousByte;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (distanceLimit < dictionarySize)
|
||||
distanceLimit++;
|
||||
#endif
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 distance;
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRepG1 + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
distance = rep1;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
prob = p + IsRepG2 + state;
|
||||
IfBit0(prob)
|
||||
{
|
||||
UpdateBit0(prob);
|
||||
distance = rep2;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(prob);
|
||||
distance = rep3;
|
||||
rep3 = rep2;
|
||||
}
|
||||
rep2 = rep1;
|
||||
}
|
||||
rep1 = rep0;
|
||||
rep0 = distance;
|
||||
}
|
||||
state = state < kNumLitStates ? 8 : 11;
|
||||
prob = p + RepLenCoder;
|
||||
}
|
||||
{
|
||||
int numBits, offset;
|
||||
CProb *probLen = prob + LenChoice;
|
||||
IfBit0(probLen)
|
||||
{
|
||||
UpdateBit0(probLen);
|
||||
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
||||
offset = 0;
|
||||
numBits = kLenNumLowBits;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(probLen);
|
||||
probLen = prob + LenChoice2;
|
||||
IfBit0(probLen)
|
||||
{
|
||||
UpdateBit0(probLen);
|
||||
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
||||
offset = kLenNumLowSymbols;
|
||||
numBits = kLenNumMidBits;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateBit1(probLen);
|
||||
probLen = prob + LenHigh;
|
||||
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
||||
numBits = kLenNumHighBits;
|
||||
}
|
||||
}
|
||||
RangeDecoderBitTreeDecode(probLen, numBits, len);
|
||||
len += offset;
|
||||
}
|
||||
|
||||
if (state < 4)
|
||||
{
|
||||
int posSlot;
|
||||
state += kNumLitStates;
|
||||
prob = p + PosSlot +
|
||||
((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
kNumPosSlotBits);
|
||||
RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot);
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
{
|
||||
int numDirectBits = ((posSlot >> 1) - 1);
|
||||
rep0 = (2 | ((UInt32)posSlot & 1));
|
||||
if (posSlot < kEndPosModelIndex)
|
||||
{
|
||||
rep0 <<= numDirectBits;
|
||||
prob = p + SpecPos + rep0 - posSlot - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
numDirectBits -= kNumAlignBits;
|
||||
do
|
||||
{
|
||||
RC_NORMALIZE
|
||||
Range >>= 1;
|
||||
rep0 <<= 1;
|
||||
if (Code >= Range)
|
||||
{
|
||||
Code -= Range;
|
||||
rep0 |= 1;
|
||||
}
|
||||
}
|
||||
while (--numDirectBits != 0);
|
||||
prob = p + Align;
|
||||
rep0 <<= kNumAlignBits;
|
||||
numDirectBits = kNumAlignBits;
|
||||
}
|
||||
{
|
||||
int i = 1;
|
||||
int mi = 1;
|
||||
do
|
||||
{
|
||||
CProb *prob3 = prob + mi;
|
||||
RC_GET_BIT2(prob3, mi, ; , rep0 |= i);
|
||||
i <<= 1;
|
||||
}
|
||||
while(--numDirectBits != 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
rep0 = posSlot;
|
||||
if (++rep0 == (UInt32)(0))
|
||||
{
|
||||
/* it's for stream version */
|
||||
len = kLzmaStreamWasFinishedId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
len += kMatchMinLen;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (rep0 > distanceLimit)
|
||||
#else
|
||||
if (rep0 > nowPos)
|
||||
#endif
|
||||
return LZMA_RESULT_DATA_ERROR;
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
if (dictionarySize - distanceLimit > (UInt32)len)
|
||||
distanceLimit += len;
|
||||
else
|
||||
distanceLimit = dictionarySize;
|
||||
#endif
|
||||
|
||||
do
|
||||
{
|
||||
#ifdef _LZMA_OUT_READ
|
||||
UInt32 pos = dictionaryPos - rep0;
|
||||
if (pos >= dictionarySize)
|
||||
pos += dictionarySize;
|
||||
previousByte = dictionary[pos];
|
||||
dictionary[dictionaryPos] = previousByte;
|
||||
if (++dictionaryPos == dictionarySize)
|
||||
dictionaryPos = 0;
|
||||
#else
|
||||
previousByte = outStream[nowPos - rep0];
|
||||
#endif
|
||||
len--;
|
||||
outStream[nowPos++] = previousByte;
|
||||
}
|
||||
while(len != 0 && nowPos < outSize);
|
||||
}
|
||||
}
|
||||
RC_NORMALIZE;
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
vs->Range = Range;
|
||||
vs->Code = Code;
|
||||
vs->DictionaryPos = dictionaryPos;
|
||||
vs->GlobalPos = globalPos + (UInt32)nowPos;
|
||||
vs->DistanceLimit = distanceLimit;
|
||||
vs->Reps[0] = rep0;
|
||||
vs->Reps[1] = rep1;
|
||||
vs->Reps[2] = rep2;
|
||||
vs->Reps[3] = rep3;
|
||||
vs->State = state;
|
||||
vs->RemainLen = len;
|
||||
vs->TempDictionary[0] = tempDictionary[0];
|
||||
#endif
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
vs->Buffer = Buffer;
|
||||
vs->BufferLim = BufferLim;
|
||||
#else
|
||||
*inSizeProcessed = (SizeT)(Buffer - inStream);
|
||||
#endif
|
||||
*outSizeProcessed = nowPos;
|
||||
return LZMA_RESULT_OK;
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
/*
|
||||
LzmaDecode.h
|
||||
LZMA Decoder interface
|
||||
|
||||
LZMA SDK 4.21 Copyright (c) 1999-2005 Igor Pavlov (2005-06-08)
|
||||
http://www.7-zip.org/
|
||||
|
||||
LZMA SDK is licensed under two licenses:
|
||||
1) GNU Lesser General Public License (GNU LGPL)
|
||||
2) Common Public License (CPL)
|
||||
It means that you can select one of these two licenses and
|
||||
follow rules of that license.
|
||||
|
||||
SPECIAL EXCEPTION:
|
||||
Igor Pavlov, as the author of this code, expressly permits you to
|
||||
statically or dynamically link your code (or bind by name) to the
|
||||
interfaces of this file without subjecting your linked code to the
|
||||
terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
to this file, however, are subject to the LGPL or CPL terms.
|
||||
*/
|
||||
|
||||
#ifndef __LZMADECODE_H
|
||||
#define __LZMADECODE_H
|
||||
|
||||
/* #define _LZMA_IN_CB */
|
||||
/* Use callback for input data */
|
||||
|
||||
/* #define _LZMA_OUT_READ */
|
||||
/* Use read function for output data */
|
||||
|
||||
/* #define _LZMA_PROB32 */
|
||||
/* It can increase speed on some 32-bit CPUs,
|
||||
but memory usage will be doubled in that case */
|
||||
|
||||
/* #define _LZMA_LOC_OPT */
|
||||
/* Enable local speed optimizations inside code */
|
||||
|
||||
/* #define _LZMA_SYSTEM_SIZE_T */
|
||||
/* Use system's size_t. You can use it to enable 64-bit sizes supporting*/
|
||||
|
||||
#ifndef UInt32
|
||||
#ifdef _LZMA_UINT32_IS_ULONG
|
||||
#define UInt32 unsigned long
|
||||
#else
|
||||
#define UInt32 unsigned int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SizeT
|
||||
#ifdef _LZMA_SYSTEM_SIZE_T
|
||||
#include <stddef.h>
|
||||
#define SizeT size_t
|
||||
#else
|
||||
#define SizeT UInt32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _LZMA_PROB32
|
||||
#define CProb UInt32
|
||||
#else
|
||||
#define CProb unsigned short
|
||||
#endif
|
||||
|
||||
#define LZMA_RESULT_OK 0
|
||||
#define LZMA_RESULT_DATA_ERROR 1
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
typedef struct _ILzmaInCallback
|
||||
{
|
||||
int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize);
|
||||
} ILzmaInCallback;
|
||||
#endif
|
||||
|
||||
#define LZMA_BASE_SIZE 1846
|
||||
#define LZMA_LIT_SIZE 768
|
||||
|
||||
#define LZMA_PROPERTIES_SIZE 5
|
||||
|
||||
typedef struct _CLzmaProperties
|
||||
{
|
||||
int lc;
|
||||
int lp;
|
||||
int pb;
|
||||
#ifdef _LZMA_OUT_READ
|
||||
UInt32 DictionarySize;
|
||||
#endif
|
||||
}CLzmaProperties;
|
||||
|
||||
int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size);
|
||||
|
||||
#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
|
||||
|
||||
#define kLzmaNeedInitId (-2)
|
||||
|
||||
typedef struct _CLzmaDecoderState
|
||||
{
|
||||
CLzmaProperties Properties;
|
||||
CProb *Probs;
|
||||
|
||||
#ifdef _LZMA_IN_CB
|
||||
const unsigned char *Buffer;
|
||||
const unsigned char *BufferLim;
|
||||
#endif
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
unsigned char *Dictionary;
|
||||
UInt32 Range;
|
||||
UInt32 Code;
|
||||
UInt32 DictionaryPos;
|
||||
UInt32 GlobalPos;
|
||||
UInt32 DistanceLimit;
|
||||
UInt32 Reps[4];
|
||||
int State;
|
||||
int RemainLen;
|
||||
unsigned char TempDictionary[4];
|
||||
#endif
|
||||
} CLzmaDecoderState;
|
||||
|
||||
#ifdef _LZMA_OUT_READ
|
||||
#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; }
|
||||
#endif
|
||||
|
||||
int LzmaDecode(CLzmaDecoderState *vs,
|
||||
#ifdef _LZMA_IN_CB
|
||||
ILzmaInCallback *inCallback,
|
||||
#else
|
||||
const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
|
||||
#endif
|
||||
unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
|
||||
|
||||
#endif
|
@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
RAMSTART = 0x80000000
|
||||
RAMSIZE = 0x00800000 # 8MB
|
||||
LOADADDR = 0x80400000 # RAM start + 4M
|
||||
KERNEL_ENTRY = 0x80002000
|
||||
|
||||
CROSS_COMPILE = mipsel-openwrt-linux-
|
||||
|
||||
OBJCOPY:= $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
|
||||
CFLAGS := -I./include -fno-builtin -Os -G 0 -ffunction-sections -mno-abicalls -fno-pic -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -Wall -DRAMSTART=${RAMSTART} -DRAMSIZE=${RAMSIZE} -DKERNEL_ENTRY=${KERNEL_ENTRY}
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $*.o
|
||||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
LD = $(CROSS_COMPILE)ld
|
||||
OBJDUMP = $(CROSS_COMPILE)objdump
|
||||
|
||||
O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
|
||||
|
||||
# Drop some uninteresting sections in the kernel.
|
||||
# This is only relevant for ELF kernels but doesn't hurt a.out
|
||||
drop-sections = .reginfo .mdebug .comment
|
||||
strip-flags = $(addprefix --remove-section=,$(drop-sections))
|
||||
|
||||
all : lzma.elf lzma.bin
|
||||
|
||||
lzma.lds: lzma.lds.in
|
||||
sed -e 's,@LOADADDR@,$(LOADADDR),g' $< >$@
|
||||
|
||||
kernel.o: vmlinux.lzma lzma.lds
|
||||
$(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $<
|
||||
|
||||
lzma.bin: lzma.elf
|
||||
$(OBJCOPY) $< $@
|
||||
|
||||
lzma.elf: decompress.o stubs.o LzmaDecode.o kernel.o lzma.lds
|
||||
$(LD) -T lzma.lds -o $@ $^
|
||||
#-s ^
|
||||
|
||||
clean:
|
||||
rm -f *.o lzma.elf lzma.bin *.tmp *.lds
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* LZMA compressed kernel decompressor for bcm947xx boards
|
||||
*
|
||||
* Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*
|
||||
* Please note, this was code based on the bunzip2 decompressor code
|
||||
* by Manuel Novoa III (mjn3@codepoet.org), although the only thing left
|
||||
* is an idea and part of original vendor code
|
||||
*
|
||||
*
|
||||
* 12-Mar-2005 Mineharu Takahara <mtakahar@yahoo.com>
|
||||
* pass actual output size to decoder (stream mode
|
||||
* compressed input is not a requirement anymore)
|
||||
*
|
||||
* 24-Apr-2005 Oleg I. Vdovikin
|
||||
* reordered functions using lds script, removed forward decl
|
||||
*
|
||||
* ??-Nov-2005 Mike Baker
|
||||
* reorder the script as an lzma wrapper; do not depend on flash access
|
||||
*/
|
||||
|
||||
#include "LzmaDecode.h"
|
||||
#include <exports.h>
|
||||
|
||||
#define KSEG0ADDR(addr) (0x80000000|addr)
|
||||
|
||||
register volatile gd_t *gd asm ("k0");
|
||||
unsigned char *data;
|
||||
|
||||
static __inline__ unsigned char get_byte()
|
||||
{
|
||||
unsigned char *buffer;
|
||||
|
||||
buffer = data;
|
||||
data++;
|
||||
|
||||
return *buffer;
|
||||
}
|
||||
|
||||
/* This puts lzma workspace 128k below RAM end.
|
||||
* That should be enough for both lzma and stack
|
||||
*/
|
||||
static char *buffer = (char *)(RAMSTART + RAMSIZE - 0x00020000);
|
||||
extern char _binary_vmlinux_lzma_start[];
|
||||
extern char _binary_vmlinux_lzma_end[];
|
||||
extern char lzma_start[];
|
||||
extern char lzma_end[];
|
||||
|
||||
/* should be the first function */
|
||||
void entry(unsigned int arg0, unsigned int arg1,
|
||||
unsigned int arg2, unsigned int arg3)
|
||||
{
|
||||
unsigned int i; /* temp value */
|
||||
unsigned int isize; /* compressed size */
|
||||
unsigned int osize; /* uncompressed size */
|
||||
int argc = arg0;
|
||||
char **argv = (char **)arg1;
|
||||
char **envp = (char **)arg2;
|
||||
|
||||
CLzmaDecoderState vs;
|
||||
|
||||
data = (unsigned char *)_binary_vmlinux_lzma_start;
|
||||
isize = _binary_vmlinux_lzma_end - _binary_vmlinux_lzma_start + 1;
|
||||
|
||||
puts("\nLZMA kernel loader\n");
|
||||
|
||||
printf("lzma data @ %#x - %#x\n", _binary_vmlinux_lzma_start, _binary_vmlinux_lzma_end);
|
||||
printf("load addr @ %#x\n\n", KERNEL_ENTRY);
|
||||
printf("jump table @ %#x\n", gd->jt[3]);
|
||||
|
||||
/* lzma args */
|
||||
i = get_byte();
|
||||
vs.Properties.lc = i % 9, i = i / 9;
|
||||
vs.Properties.lp = i % 5, vs.Properties.pb = i / 5;
|
||||
|
||||
vs.Probs = (CProb *)buffer;
|
||||
|
||||
/* skip rest of the LZMA coder property */
|
||||
data += 4;
|
||||
|
||||
/* read the lower half of uncompressed size in the header */
|
||||
osize = ((unsigned int)get_byte()) +
|
||||
((unsigned int)get_byte() << 8) +
|
||||
((unsigned int)get_byte() << 16) +
|
||||
((unsigned int)get_byte() << 24);
|
||||
|
||||
/* skip rest of the header (upper half of uncompressed size) */
|
||||
data += 4;
|
||||
|
||||
/* decompress kernel */
|
||||
puts("\nDecompressing kernel...");
|
||||
if ((i = LzmaDecode(&vs,
|
||||
(unsigned char*)data, isize, &isize,
|
||||
(unsigned char*)KERNEL_ENTRY, osize, &osize)) == LZMA_RESULT_OK)
|
||||
{
|
||||
puts("success!\n");
|
||||
|
||||
/* Jump to load address */
|
||||
// ((void (*)(int a0, int a1, int a2, int a3))KERNEL_ENTRY)(0,0,0,0);
|
||||
((void (*)(int a0, int a1, int a2, int a3))KERNEL_ENTRY)(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
puts("failure!\n");
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
EXPORT_FUNC(get_version)
|
||||
EXPORT_FUNC(getc)
|
||||
EXPORT_FUNC(tstc)
|
||||
EXPORT_FUNC(putc)
|
||||
EXPORT_FUNC(puts)
|
||||
EXPORT_FUNC(printf)
|
||||
EXPORT_FUNC(install_hdlr)
|
||||
EXPORT_FUNC(free_hdlr)
|
||||
EXPORT_FUNC(malloc)
|
||||
EXPORT_FUNC(free)
|
||||
EXPORT_FUNC(udelay)
|
||||
EXPORT_FUNC(get_timer)
|
||||
EXPORT_FUNC(vprintf)
|
||||
EXPORT_FUNC(do_reset)
|
||||
#if (CONFIG_COMMANDS & CFG_CMD_I2C)
|
||||
EXPORT_FUNC(i2c_write)
|
||||
EXPORT_FUNC(i2c_read)
|
||||
#endif /* CFG_CMD_I2C */
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2002-2003
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __ASM_GBL_DATA_H
|
||||
#define __ASM_GBL_DATA_H
|
||||
|
||||
#include <asm/regdef.h>
|
||||
|
||||
/*
|
||||
* The following data structure is placed in some memory wich is
|
||||
* available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
|
||||
* some locked parts of the data cache) to allow for a minimum set of
|
||||
* global variables during system initialization (until we have set
|
||||
* up the memory controller so that we can use RAM).
|
||||
*
|
||||
* Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t)
|
||||
*/
|
||||
|
||||
typedef struct global_data {
|
||||
bd_t *bd;
|
||||
unsigned long flags;
|
||||
unsigned long baudrate;
|
||||
unsigned long have_console; /* serial_init() was called */
|
||||
unsigned long ram_size; /* RAM size */
|
||||
unsigned long reloc_off; /* Relocation Offset */
|
||||
unsigned long env_addr; /* Address of Environment struct */
|
||||
unsigned long env_valid; /* Checksum of Environment valid? */
|
||||
void **jt; /* jump table */
|
||||
} gd_t;
|
||||
|
||||
/*
|
||||
* Global Data Flags
|
||||
*/
|
||||
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
|
||||
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
|
||||
#define GD_FLG_SILENT 0x00004 /* Silent mode */
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0")
|
||||
|
||||
#endif /* __ASM_GBL_DATA_H */
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2003
|
||||
* Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef _U_BOOT_H_
|
||||
#define _U_BOOT_H_ 1
|
||||
|
||||
typedef struct bd_info {
|
||||
int bi_baudrate; /* serial console baudrate */
|
||||
unsigned long bi_ip_addr; /* IP Address */
|
||||
unsigned char bi_enetaddr[6]; /* Ethernet adress */
|
||||
unsigned long bi_arch_number; /* unique id for this board */
|
||||
unsigned long bi_boot_params; /* where this board expects params */
|
||||
unsigned long bi_memstart; /* start of DRAM memory */
|
||||
unsigned long bi_memsize; /* size of DRAM memory in bytes */
|
||||
unsigned long bi_flashstart; /* start of FLASH memory */
|
||||
unsigned long bi_flashsize; /* size of FLASH memory */
|
||||
unsigned long bi_flashoffset; /* reserved area for startup monitor */
|
||||
} bd_t;
|
||||
#define bi_env_data bi_env->data
|
||||
#define bi_env_crc bi_env->crc
|
||||
|
||||
#endif /* _U_BOOT_H_ */
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2000-2004
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __COMMON_H_
|
||||
#define __COMMON_H_ 1
|
||||
|
||||
#undef _LINUX_CONFIG_H
|
||||
#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
|
||||
|
||||
typedef unsigned char uchar;
|
||||
typedef volatile unsigned long vu_long;
|
||||
typedef volatile unsigned short vu_short;
|
||||
typedef volatile unsigned char vu_char;
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/string.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <stdarg.h>
|
||||
#include <image.h>
|
||||
|
||||
typedef void (interrupt_handler_t)(void *);
|
||||
|
||||
#include <asm/u-boot.h> /* boot information for Linux kernel */
|
||||
#include <asm/global_data.h> /* global data used for startup functions */
|
||||
|
||||
|
||||
#endif /* __COMMON_H_ */
|
@ -1,38 +0,0 @@
|
||||
#ifndef __EXPORTS_H__
|
||||
#define __EXPORTS_H__
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <common.h>
|
||||
|
||||
/* These are declarations of exported functions available in C code */
|
||||
unsigned long get_version(void);
|
||||
int getc(void);
|
||||
int tstc(void);
|
||||
void putc(const char);
|
||||
void puts(const char*);
|
||||
void printf(const char* fmt, ...);
|
||||
void install_hdlr(int, interrupt_handler_t*, void*);
|
||||
void free_hdlr(int);
|
||||
void *malloc(size_t);
|
||||
void free(void*);
|
||||
void udelay(unsigned long);
|
||||
unsigned long get_timer(unsigned long);
|
||||
void vprintf(const char *, va_list);
|
||||
void do_reset (void);
|
||||
|
||||
void app_startup(char **);
|
||||
|
||||
#endif /* ifndef __ASSEMBLY__ */
|
||||
|
||||
enum {
|
||||
#define EXPORT_FUNC(x) XF_ ## x ,
|
||||
#include <_exports.h>
|
||||
#undef EXPORT_FUNC
|
||||
|
||||
XF_MAX
|
||||
};
|
||||
|
||||
#define XF_VERSION 2
|
||||
|
||||
#endif /* __EXPORTS_H__ */
|
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright 2000
|
||||
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __IMAGE_H__
|
||||
#define __IMAGE_H__
|
||||
|
||||
/*
|
||||
* Operating System Codes
|
||||
*/
|
||||
#define IH_OS_INVALID 0 /* Invalid OS */
|
||||
#define IH_OS_OPENBSD 1 /* OpenBSD */
|
||||
#define IH_OS_NETBSD 2 /* NetBSD */
|
||||
#define IH_OS_FREEBSD 3 /* FreeBSD */
|
||||
#define IH_OS_4_4BSD 4 /* 4.4BSD */
|
||||
#define IH_OS_LINUX 5 /* Linux */
|
||||
#define IH_OS_SVR4 6 /* SVR4 */
|
||||
#define IH_OS_ESIX 7 /* Esix */
|
||||
#define IH_OS_SOLARIS 8 /* Solaris */
|
||||
#define IH_OS_IRIX 9 /* Irix */
|
||||
#define IH_OS_SCO 10 /* SCO */
|
||||
#define IH_OS_DELL 11 /* Dell */
|
||||
#define IH_OS_NCR 12 /* NCR */
|
||||
#define IH_OS_LYNXOS 13 /* LynxOS */
|
||||
#define IH_OS_VXWORKS 14 /* VxWorks */
|
||||
#define IH_OS_PSOS 15 /* pSOS */
|
||||
#define IH_OS_QNX 16 /* QNX */
|
||||
#define IH_OS_U_BOOT 17 /* Firmware */
|
||||
#define IH_OS_RTEMS 18 /* RTEMS */
|
||||
#define IH_OS_ARTOS 19 /* ARTOS */
|
||||
#define IH_OS_UNITY 20 /* Unity OS */
|
||||
|
||||
/*
|
||||
* CPU Architecture Codes (supported by Linux)
|
||||
*/
|
||||
#define IH_CPU_INVALID 0 /* Invalid CPU */
|
||||
#define IH_CPU_ALPHA 1 /* Alpha */
|
||||
#define IH_CPU_ARM 2 /* ARM */
|
||||
#define IH_CPU_I386 3 /* Intel x86 */
|
||||
#define IH_CPU_IA64 4 /* IA64 */
|
||||
#define IH_CPU_MIPS 5 /* MIPS */
|
||||
#define IH_CPU_MIPS64 6 /* MIPS 64 Bit */
|
||||
#define IH_CPU_PPC 7 /* PowerPC */
|
||||
#define IH_CPU_S390 8 /* IBM S390 */
|
||||
#define IH_CPU_SH 9 /* SuperH */
|
||||
#define IH_CPU_SPARC 10 /* Sparc */
|
||||
#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */
|
||||
#define IH_CPU_M68K 12 /* M68K */
|
||||
#define IH_CPU_NIOS 13 /* Nios-32 */
|
||||
#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */
|
||||
#define IH_CPU_NIOS2 15 /* Nios-II */
|
||||
|
||||
/*
|
||||
* Image Types
|
||||
*
|
||||
* "Standalone Programs" are directly runnable in the environment
|
||||
* provided by U-Boot; it is expected that (if they behave
|
||||
* well) you can continue to work in U-Boot after return from
|
||||
* the Standalone Program.
|
||||
* "OS Kernel Images" are usually images of some Embedded OS which
|
||||
* will take over control completely. Usually these programs
|
||||
* will install their own set of exception handlers, device
|
||||
* drivers, set up the MMU, etc. - this means, that you cannot
|
||||
* expect to re-enter U-Boot except by resetting the CPU.
|
||||
* "RAMDisk Images" are more or less just data blocks, and their
|
||||
* parameters (address, size) are passed to an OS kernel that is
|
||||
* being started.
|
||||
* "Multi-File Images" contain several images, typically an OS
|
||||
* (Linux) kernel image and one or more data images like
|
||||
* RAMDisks. This construct is useful for instance when you want
|
||||
* to boot over the network using BOOTP etc., where the boot
|
||||
* server provides just a single image file, but you want to get
|
||||
* for instance an OS kernel and a RAMDisk image.
|
||||
*
|
||||
* "Multi-File Images" start with a list of image sizes, each
|
||||
* image size (in bytes) specified by an "uint32_t" in network
|
||||
* byte order. This list is terminated by an "(uint32_t)0".
|
||||
* Immediately after the terminating 0 follow the images, one by
|
||||
* one, all aligned on "uint32_t" boundaries (size rounded up to
|
||||
* a multiple of 4 bytes - except for the last file).
|
||||
*
|
||||
* "Firmware Images" are binary images containing firmware (like
|
||||
* U-Boot or FPGA images) which usually will be programmed to
|
||||
* flash memory.
|
||||
*
|
||||
* "Script files" are command sequences that will be executed by
|
||||
* U-Boot's command interpreter; this feature is especially
|
||||
* useful when you configure U-Boot to use a real shell (hush)
|
||||
* as command interpreter (=> Shell Scripts).
|
||||
*/
|
||||
|
||||
#define IH_TYPE_INVALID 0 /* Invalid Image */
|
||||
#define IH_TYPE_STANDALONE 1 /* Standalone Program */
|
||||
#define IH_TYPE_KERNEL 2 /* OS Kernel Image */
|
||||
#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */
|
||||
#define IH_TYPE_MULTI 4 /* Multi-File Image */
|
||||
#define IH_TYPE_FIRMWARE 5 /* Firmware Image */
|
||||
#define IH_TYPE_SCRIPT 6 /* Script file */
|
||||
#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */
|
||||
|
||||
/*
|
||||
* Compression Types
|
||||
*/
|
||||
#define IH_COMP_NONE 0 /* No Compression Used */
|
||||
#define IH_COMP_GZIP 1 /* gzip Compression Used */
|
||||
#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */
|
||||
|
||||
#define IH_MAGIC 0x27051956 /* Image Magic Number */
|
||||
#define IH_NMLEN 32 /* Image Name Length */
|
||||
|
||||
#define IH_NAMEMAGIC 0x86680001 /* Name Magic Number */
|
||||
#define IH_SIZEMAX 5800000 /* Max image size */
|
||||
/*
|
||||
* all data in network byte order (aka natural aka bigendian)
|
||||
*/
|
||||
|
||||
typedef struct image_header {
|
||||
uint32_t ih_magic; /* Image Header Magic Number */
|
||||
uint32_t ih_hcrc; /* Image Header CRC Checksum */
|
||||
uint32_t ih_time; /* Image Creation Timestamp */
|
||||
uint32_t ih_size; /* Image Data Size */
|
||||
uint32_t ih_load; /* Data Load Address */
|
||||
uint32_t ih_ep; /* Entry Point Address */
|
||||
uint32_t ih_dcrc; /* Image Data CRC Checksum */
|
||||
uint8_t ih_os; /* Operating System */
|
||||
uint8_t ih_arch; /* CPU architecture */
|
||||
uint8_t ih_type; /* Image Type */
|
||||
uint8_t ih_comp; /* Compression Type */
|
||||
#ifdef NEW_IMAGE_HEADER
|
||||
uint32_t ih_namemagic; /* image name CRC */
|
||||
uint8_t ih_name[IH_NMLEN-4]; /* image name */
|
||||
#else
|
||||
uint8_t ih_name[IH_NMLEN]; /* Image Name */
|
||||
#endif
|
||||
} image_header_t;
|
||||
|
||||
|
||||
#endif /* __IMAGE_H__ */
|
@ -1,24 +0,0 @@
|
||||
OUTPUT_ARCH(mips)
|
||||
ENTRY(entry)
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
. = @LOADADDR@;
|
||||
.text :
|
||||
{
|
||||
_ftext = . ;
|
||||
*(.text.entry)
|
||||
*(.text)
|
||||
lzma_start = .;
|
||||
kernel.o
|
||||
lzma_end = .;
|
||||
*(.rodata)
|
||||
} =0
|
||||
|
||||
.reginfo : { *(.reginfo) }
|
||||
|
||||
.bss :
|
||||
{
|
||||
*(.bss)
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
#include <exports.h>
|
||||
|
||||
#ifndef GCC_VERSION
|
||||
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
|
||||
#endif /* GCC_VERSION */
|
||||
|
||||
/*
|
||||
* k0 ($26) holds the pointer to the global_data; t9 ($25) is a call-
|
||||
* clobbered register that is also used to set gp ($26). Note that the
|
||||
* jr instruction also executes the instruction immediately following
|
||||
* it; however, GCC/mips generates an additional `nop' after each asm
|
||||
* statement
|
||||
*/
|
||||
#define EXPORT_FUNC(x) \
|
||||
asm volatile ( \
|
||||
" .globl " #x "\n" \
|
||||
#x ":\n" \
|
||||
" lw $25, %0($26)\n" \
|
||||
" lw $25, %1($25)\n" \
|
||||
" jr $25\n" \
|
||||
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
|
||||
|
||||
/* This function is necessary to prevent the compiler from
|
||||
* generating prologue/epilogue, preparing stack frame etc.
|
||||
* The stub functions are special, they do not use the stack
|
||||
* frame passed to them, but pass it intact to the actual
|
||||
* implementation. On the other hand, asm() statements with
|
||||
* arguments can be used only inside the functions (gcc limitation)
|
||||
*/
|
||||
#if GCC_VERSION < 3004
|
||||
static
|
||||
#endif /* GCC_VERSION */
|
||||
void __attribute__((unused)) dummy(void)
|
||||
{
|
||||
#include <_exports.h>
|
||||
}
|
||||
|
||||
#if 0
|
||||
extern unsigned long __bss_start, _end;
|
||||
|
||||
void app_startup(char **argv)
|
||||
{
|
||||
unsigned long * cp = &__bss_start;
|
||||
|
||||
/* Zero out BSS */
|
||||
while (cp < &_end) {
|
||||
*cp++ = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef EXPORT_FUNC
|
@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
# my-mkimage
|
||||
# This will pad given files to 64k boundaries to make a single u-boot image.
|
||||
# we have to be fancy because u-boot mkimage is going to add 64 byte header, ...
|
||||
# and i only know basic arithmetic.. ;)
|
||||
#
|
||||
# Copyright (C) 2010 Scott Nicholas <neutronscott@scottn.us>
|
||||
[ $# -lt 2 ] && {
|
||||
echo usage: $0 loader.bin [rootfs.squashfs [fs_mark [...]]] output.bin
|
||||
}
|
||||
|
||||
OLDSIZE=$(stat -c%s $1)
|
||||
NEWSIZE=$(((OLDSIZE / 65536 + 1) * 65536 - 64))
|
||||
|
||||
dd if=$1 of=vmlinuz.tmp bs=$NEWSIZE conv=sync >/dev/null 2>&1
|
||||
shift
|
||||
appends=$(($# - 1))
|
||||
echo
|
||||
while [ $appends -gt 0 ]; do
|
||||
dd if=$1 of=temp bs=64k conv=sync >/dev/null 2>&1
|
||||
printf "### '%s' starts at 0x%x\n" "`basename $1`" "$((NEWSIZE+64))"
|
||||
cat temp >>vmlinuz.tmp
|
||||
shift
|
||||
appends=$((appends-1))
|
||||
NEWSIZE=$(stat -c%s vmlinuz.tmp)
|
||||
done
|
||||
echo
|
||||
../../../../staging_dir/host/bin/mkimage -A mips -O linux -T kernel \
|
||||
-C none -a 0x80400000 -e 0x80400000 -n "ADM8668 Linux Kernel(2.4.31)" \
|
||||
-d vmlinuz.tmp $1
|
||||
|
||||
rm temp vmlinuz.tmp
|
@ -1,48 +0,0 @@
|
||||
--- a/arch/mips/Kbuild.platforms
|
||||
+++ b/arch/mips/Kbuild.platforms
|
||||
@@ -30,6 +30,7 @@ platforms += sibyte
|
||||
platforms += sni
|
||||
platforms += txx9
|
||||
platforms += vr41xx
|
||||
+platforms += adm8668
|
||||
|
||||
# include the platform specific files
|
||||
include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
|
||||
--- a/arch/mips/Kconfig
|
||||
+++ b/arch/mips/Kconfig
|
||||
@@ -136,6 +136,27 @@ config BCM47XX
|
||||
help
|
||||
Support for BCM47XX based boards
|
||||
|
||||
+config ADM8668
|
||||
+ bool "WildPass ADM8668"
|
||||
+ select SYS_HAS_CPU_MIPS32_R1
|
||||
+ select BOOT_RAW
|
||||
+ select NO_EXCEPT_FILL
|
||||
+ select IRQ_CPU
|
||||
+ select CEVT_R4K
|
||||
+ select CSRC_R4K
|
||||
+ select HW_HAS_PCI
|
||||
+ select PCI
|
||||
+ select SYS_SUPPORTS_LITTLE_ENDIAN
|
||||
+ select SYS_SUPPORTS_32BIT_KERNEL
|
||||
+ select DMA_NONCOHERENT
|
||||
+ select SWAP_IO_SPACE
|
||||
+ select SYS_HAS_EARLY_PRINTK
|
||||
+ select ARCH_REQUIRE_GPIOLIB
|
||||
+ select HAVE_CLK
|
||||
+ help
|
||||
+ ADM8668 board support by neutronscott
|
||||
+ Scott Nicholas <neutronscott@scottn.us>
|
||||
+
|
||||
config BCM63XX
|
||||
bool "Broadcom BCM63XX based boards"
|
||||
select BOOT_RAW
|
||||
@@ -837,6 +858,7 @@ config MIPS_PARAVIRT
|
||||
|
||||
endchoice
|
||||
|
||||
+source "arch/mips/adm8668/Kconfig"
|
||||
source "arch/mips/alchemy/Kconfig"
|
||||
source "arch/mips/ath79/Kconfig"
|
||||
source "arch/mips/bcm47xx/Kconfig"
|
@ -1,22 +0,0 @@
|
||||
--- a/arch/mips/pci/Makefile
|
||||
+++ b/arch/mips/pci/Makefile
|
||||
@@ -58,6 +58,7 @@ obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32
|
||||
obj-$(CONFIG_CAVIUM_OCTEON_SOC) += pci-octeon.o pcie-octeon.o
|
||||
obj-$(CONFIG_CPU_XLR) += pci-xlr.o
|
||||
obj-$(CONFIG_CPU_XLP) += pci-xlp.o
|
||||
+obj-$(CONFIG_ADM8668) += pci-adm8668.o
|
||||
|
||||
ifdef CONFIG_PCI_MSI
|
||||
obj-$(CONFIG_CAVIUM_OCTEON_SOC) += msi-octeon.o
|
||||
--- a/include/linux/pci_ids.h
|
||||
+++ b/include/linux/pci_ids.h
|
||||
@@ -1821,6 +1821,9 @@
|
||||
|
||||
#define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */
|
||||
|
||||
+#define PCI_VENDOR_ADMTEK 0x1317
|
||||
+#define PCI_DEVICE_ID_ADM8668 0x8688
|
||||
+
|
||||
#define PCI_VENDOR_ID_SIIG 0x131f
|
||||
#define PCI_SUBVENDOR_ID_SIIG 0x131f
|
||||
#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
|
@ -1,22 +0,0 @@
|
||||
--- a/drivers/mtd/maps/Kconfig
|
||||
+++ b/drivers/mtd/maps/Kconfig
|
||||
@@ -97,6 +97,12 @@ config MSP_FLASH_MAP_LIMIT
|
||||
default "0x02000000"
|
||||
depends on MSP_FLASH_MAP_LIMIT_32M
|
||||
|
||||
+config MTD_ADM8668_NOR
|
||||
+ tristate "ADM8668 NOR mapping"
|
||||
+ depends on ADM8668 && MTD_CFI
|
||||
+ help
|
||||
+ mapping driver for ADM8668 NOR
|
||||
+
|
||||
config MTD_SUN_UFLASH
|
||||
tristate "Sun Microsystems userflash support"
|
||||
depends on SPARC && MTD_CFI && PCI
|
||||
--- a/drivers/mtd/maps/Makefile
|
||||
+++ b/drivers/mtd/maps/Makefile
|
||||
@@ -43,3 +43,4 @@ obj-$(CONFIG_MTD_VMU) += vmu-flash.o
|
||||
obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o
|
||||
obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o
|
||||
obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o
|
||||
+obj-$(CONFIG_MTD_ADM8668_NOR) += adm8668.o
|
@ -1,452 +0,0 @@
|
||||
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
|
||||
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
|
||||
@@ -206,6 +206,7 @@ struct tulip_chip_table tulip_tbl[] = {
|
||||
};
|
||||
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
static const struct pci_device_id tulip_pci_tbl[] = {
|
||||
{ 0x1011, 0x0009, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 },
|
||||
{ 0x1011, 0x0019, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21143 },
|
||||
@@ -249,7 +250,7 @@ static const struct pci_device_id tulip_
|
||||
{ } /* terminate list */
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, tulip_pci_tbl);
|
||||
-
|
||||
+#endif
|
||||
|
||||
/* A full-duplex map for media types. */
|
||||
const char tulip_media_cap[32] =
|
||||
@@ -267,11 +268,14 @@ static void tulip_down(struct net_device
|
||||
static struct net_device_stats *tulip_get_stats(struct net_device *dev);
|
||||
static int private_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
|
||||
static void set_rx_mode(struct net_device *dev);
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
static void tulip_set_wolopts(struct pci_dev *pdev, u32 wolopts);
|
||||
+#endif
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
static void poll_tulip(struct net_device *dev);
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
static void tulip_set_power_state (struct tulip_private *tp,
|
||||
int sleep, int snooze)
|
||||
{
|
||||
@@ -288,7 +292,7 @@ static void tulip_set_power_state (struc
|
||||
}
|
||||
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
|
||||
static void tulip_up(struct net_device *dev)
|
||||
{
|
||||
@@ -302,6 +306,7 @@ static void tulip_up(struct net_device *
|
||||
napi_enable(&tp->napi);
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
/* Wake the chip from sleep/snooze mode. */
|
||||
tulip_set_power_state (tp, 0, 0);
|
||||
|
||||
@@ -309,6 +314,7 @@ static void tulip_up(struct net_device *
|
||||
pci_enable_wake(tp->pdev, PCI_D3hot, 0);
|
||||
pci_enable_wake(tp->pdev, PCI_D3cold, 0);
|
||||
tulip_set_wolopts(tp->pdev, 0);
|
||||
+#endif
|
||||
|
||||
/* On some chip revs we must set the MII/SYM port before the reset!? */
|
||||
if (tp->mii_cnt || (tp->mtable && tp->mtable->has_mii))
|
||||
@@ -316,18 +322,22 @@ static void tulip_up(struct net_device *
|
||||
|
||||
/* Reset the chip, holding bit 0 set at least 50 PCI cycles. */
|
||||
iowrite32(0x00000001, ioaddr + CSR0);
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */
|
||||
+#endif
|
||||
udelay(100);
|
||||
|
||||
/* Deassert reset.
|
||||
Wait the specified 50 PCI cycles after a reset by initializing
|
||||
Tx and Rx queues and the address filter list. */
|
||||
iowrite32(tp->csr0, ioaddr + CSR0);
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_read_config_dword(tp->pdev, PCI_COMMAND, ®); /* flush write */
|
||||
+#endif
|
||||
udelay(100);
|
||||
|
||||
if (tulip_debug > 1)
|
||||
- netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->pdev->irq);
|
||||
+ netdev_dbg(dev, "tulip_up(), irq==%d\n", tp->irq);
|
||||
|
||||
iowrite32(tp->rx_ring_dma, ioaddr + CSR3);
|
||||
iowrite32(tp->tx_ring_dma, ioaddr + CSR4);
|
||||
@@ -361,9 +371,11 @@ static void tulip_up(struct net_device *
|
||||
*setup_frm++ = eaddrs[1]; *setup_frm++ = eaddrs[1];
|
||||
*setup_frm++ = eaddrs[2]; *setup_frm++ = eaddrs[2];
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
mapping = pci_map_single(tp->pdev, tp->setup_frame,
|
||||
sizeof(tp->setup_frame),
|
||||
PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
tp->tx_buffers[tp->cur_tx].skb = NULL;
|
||||
tp->tx_buffers[tp->cur_tx].mapping = mapping;
|
||||
|
||||
@@ -519,7 +531,7 @@ tulip_open(struct net_device *dev)
|
||||
|
||||
tulip_init_ring (dev);
|
||||
|
||||
- retval = request_irq(tp->pdev->irq, tulip_interrupt, IRQF_SHARED,
|
||||
+ retval = request_irq(tp->irq, tulip_interrupt, IRQF_SHARED,
|
||||
dev->name, dev);
|
||||
if (retval)
|
||||
goto free_ring;
|
||||
@@ -643,8 +655,10 @@ static void tulip_init_ring(struct net_d
|
||||
tp->rx_buffers[i].skb = skb;
|
||||
if (skb == NULL)
|
||||
break;
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
mapping = pci_map_single(tp->pdev, skb->data,
|
||||
PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
|
||||
+#endif
|
||||
tp->rx_buffers[i].mapping = mapping;
|
||||
tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */
|
||||
tp->rx_ring[i].buffer1 = cpu_to_le32(mapping);
|
||||
@@ -677,8 +691,10 @@ tulip_start_xmit(struct sk_buff *skb, st
|
||||
entry = tp->cur_tx % TX_RING_SIZE;
|
||||
|
||||
tp->tx_buffers[entry].skb = skb;
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
mapping = pci_map_single(tp->pdev, skb->data,
|
||||
skb->len, PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
tp->tx_buffers[entry].mapping = mapping;
|
||||
tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping);
|
||||
|
||||
@@ -729,16 +745,19 @@ static void tulip_clean_tx_ring(struct t
|
||||
if (tp->tx_buffers[entry].skb == NULL) {
|
||||
/* test because dummy frames not mapped */
|
||||
if (tp->tx_buffers[entry].mapping)
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_unmap_single(tp->pdev,
|
||||
tp->tx_buffers[entry].mapping,
|
||||
sizeof(tp->setup_frame),
|
||||
PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
continue;
|
||||
}
|
||||
-
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping,
|
||||
tp->tx_buffers[entry].skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
|
||||
/* Free the original skb. */
|
||||
dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
|
||||
@@ -789,7 +808,9 @@ static void tulip_down (struct net_devic
|
||||
dev->if_port = tp->saved_if_port;
|
||||
|
||||
/* Leave the driver in snooze, not sleep, mode. */
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
tulip_set_power_state (tp, 0, 1);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void tulip_free_ring (struct net_device *dev)
|
||||
@@ -810,8 +831,10 @@ static void tulip_free_ring (struct net_
|
||||
/* An invalid address. */
|
||||
tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0);
|
||||
if (skb) {
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
+#endif
|
||||
dev_kfree_skb (skb);
|
||||
}
|
||||
}
|
||||
@@ -820,8 +843,10 @@ static void tulip_free_ring (struct net_
|
||||
struct sk_buff *skb = tp->tx_buffers[i].skb;
|
||||
|
||||
if (skb != NULL) {
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping,
|
||||
skb->len, PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
dev_kfree_skb (skb);
|
||||
}
|
||||
tp->tx_buffers[i].skb = NULL;
|
||||
@@ -842,7 +867,7 @@ static int tulip_close (struct net_devic
|
||||
netdev_dbg(dev, "Shutting down ethercard, status was %02x\n",
|
||||
ioread32 (ioaddr + CSR5));
|
||||
|
||||
- free_irq (tp->pdev->irq, dev);
|
||||
+ free_irq (tp->irq, dev);
|
||||
|
||||
tulip_free_ring (dev);
|
||||
|
||||
@@ -873,7 +898,9 @@ static void tulip_get_drvinfo(struct net
|
||||
struct tulip_private *np = netdev_priv(dev);
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info));
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -886,7 +913,9 @@ static int tulip_ethtool_set_wol(struct
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
tp->wolinfo.wolopts = wolinfo->wolopts;
|
||||
- device_set_wakeup_enable(&tp->pdev->dev, tp->wolinfo.wolopts);
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
+ device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts);
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1164,9 +1193,11 @@ static void set_rx_mode(struct net_devic
|
||||
|
||||
tp->tx_buffers[entry].skb = NULL;
|
||||
tp->tx_buffers[entry].mapping =
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_map_single(tp->pdev, tp->setup_frame,
|
||||
sizeof(tp->setup_frame),
|
||||
PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
/* Put the setup frame on the Tx list. */
|
||||
if (entry == TX_RING_SIZE-1)
|
||||
tx_flags |= DESC_RING_WRAP; /* Wrap ring. */
|
||||
@@ -1263,19 +1294,22 @@ out:
|
||||
netdev_dbg(dev, "MWI config cacheline=%d, csr0=%08x\n",
|
||||
cache, csr0);
|
||||
}
|
||||
-#endif
|
||||
|
||||
/*
|
||||
* Chips that have the MRM/reserved bit quirk and the burst quirk. That
|
||||
* is the DM910X and the on chip ULi devices
|
||||
*/
|
||||
+#endif
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
static int tulip_uli_dm_quirk(struct pci_dev *pdev)
|
||||
{
|
||||
if (pdev->vendor == 0x1282 && pdev->device == 0x9102)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
+
|
||||
|
||||
static const struct net_device_ops tulip_netdev_ops = {
|
||||
.ndo_open = tulip_open,
|
||||
@@ -1293,6 +1327,7 @@ static const struct net_device_ops tulip
|
||||
#endif
|
||||
};
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
const struct pci_device_id early_486_chipsets[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82424) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_496) },
|
||||
@@ -1470,6 +1505,8 @@ static int tulip_init_one(struct pci_dev
|
||||
}
|
||||
}
|
||||
tp->pdev = pdev;
|
||||
+ tp->kdev = &pdev->dev;
|
||||
+ tp->irq = irq;
|
||||
tp->base_addr = ioaddr;
|
||||
tp->revision = pdev->revision;
|
||||
tp->csr0 = csr0;
|
||||
@@ -1800,6 +1837,7 @@ err_out_free_netdev:
|
||||
}
|
||||
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
/* set the registers according to the given wolopts */
|
||||
static void tulip_set_wolopts (struct pci_dev *pdev, u32 wolopts)
|
||||
{
|
||||
@@ -1828,6 +1866,7 @@ static void tulip_set_wolopts (struct pc
|
||||
iowrite32(tmp, ioaddr + CSR13);
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
@@ -1942,6 +1981,7 @@ static void tulip_remove_one(struct pci_
|
||||
|
||||
/* pci_power_off (pdev, -1); */
|
||||
}
|
||||
+#endif /* CONFIG_TULIP_PCI */
|
||||
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
/*
|
||||
@@ -1963,7 +2003,8 @@ static void poll_tulip (struct net_devic
|
||||
}
|
||||
#endif
|
||||
|
||||
-static struct pci_driver tulip_driver = {
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
+static struct pci_driver tulip_pci_driver = {
|
||||
.name = DRV_NAME,
|
||||
.id_table = tulip_pci_tbl,
|
||||
.probe = tulip_init_one,
|
||||
@@ -1973,10 +2014,12 @@ static struct pci_driver tulip_driver =
|
||||
.resume = tulip_resume,
|
||||
#endif /* CONFIG_PM */
|
||||
};
|
||||
+#endif
|
||||
|
||||
|
||||
static int __init tulip_init (void)
|
||||
{
|
||||
+ int ret = 0;
|
||||
#ifdef MODULE
|
||||
pr_info("%s", version);
|
||||
#endif
|
||||
@@ -1992,13 +2035,18 @@ static int __init tulip_init (void)
|
||||
tulip_max_interrupt_work = max_interrupt_work;
|
||||
|
||||
/* probe for and init boards */
|
||||
- return pci_register_driver(&tulip_driver);
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
+ ret = pci_register_driver(&tulip_pci_driver);
|
||||
+#endif
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
static void __exit tulip_cleanup (void)
|
||||
{
|
||||
- pci_unregister_driver (&tulip_driver);
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
+ pci_unregister_driver (&tulip_pci_driver);
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
--- a/drivers/net/ethernet/dec/tulip/interrupt.c
|
||||
+++ b/drivers/net/ethernet/dec/tulip/interrupt.c
|
||||
@@ -73,10 +73,11 @@ int tulip_refill_rx(struct net_device *d
|
||||
netdev_alloc_skb(dev, PKT_BUF_SZ);
|
||||
if (skb == NULL)
|
||||
break;
|
||||
-
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
- if (dma_mapping_error(&tp->pdev->dev, mapping)) {
|
||||
+#endif
|
||||
+ if (dma_mapping_error(tp->kdev, mapping)) {
|
||||
dev_kfree_skb(skb);
|
||||
tp->rx_buffers[entry].skb = NULL;
|
||||
break;
|
||||
@@ -210,9 +211,11 @@ int tulip_poll(struct napi_struct *napi,
|
||||
if (pkt_len < tulip_rx_copybreak &&
|
||||
(skb = netdev_alloc_skb(dev, pkt_len + 2)) != NULL) {
|
||||
skb_reserve(skb, 2); /* 16 byte align the IP header */
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_dma_sync_single_for_cpu(tp->pdev,
|
||||
tp->rx_buffers[entry].mapping,
|
||||
pkt_len, PCI_DMA_FROMDEVICE);
|
||||
+#endif
|
||||
#if ! defined(__alpha__)
|
||||
skb_copy_to_linear_data(skb, tp->rx_buffers[entry].skb->data,
|
||||
pkt_len);
|
||||
@@ -222,9 +225,11 @@ int tulip_poll(struct napi_struct *napi,
|
||||
tp->rx_buffers[entry].skb->data,
|
||||
pkt_len);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_dma_sync_single_for_device(tp->pdev,
|
||||
tp->rx_buffers[entry].mapping,
|
||||
pkt_len, PCI_DMA_FROMDEVICE);
|
||||
+#endif
|
||||
} else { /* Pass up the skb already on the Rx ring. */
|
||||
char *temp = skb_put(skb = tp->rx_buffers[entry].skb,
|
||||
pkt_len);
|
||||
@@ -239,9 +244,10 @@ int tulip_poll(struct napi_struct *napi,
|
||||
skb->head, temp);
|
||||
}
|
||||
#endif
|
||||
-
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping,
|
||||
PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
|
||||
+#endif
|
||||
|
||||
tp->rx_buffers[entry].skb = NULL;
|
||||
tp->rx_buffers[entry].mapping = 0;
|
||||
@@ -597,10 +603,12 @@ irqreturn_t tulip_interrupt(int irq, voi
|
||||
if (tp->tx_buffers[entry].skb == NULL) {
|
||||
/* test because dummy frames not mapped */
|
||||
if (tp->tx_buffers[entry].mapping)
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_unmap_single(tp->pdev,
|
||||
tp->tx_buffers[entry].mapping,
|
||||
sizeof(tp->setup_frame),
|
||||
PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -628,10 +636,11 @@ irqreturn_t tulip_interrupt(int irq, voi
|
||||
dev->stats.collisions += (status >> 3) & 15;
|
||||
dev->stats.tx_packets++;
|
||||
}
|
||||
-
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
pci_unmap_single(tp->pdev, tp->tx_buffers[entry].mapping,
|
||||
tp->tx_buffers[entry].skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
+#endif
|
||||
|
||||
/* Free the original skb. */
|
||||
dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
|
||||
--- a/drivers/net/ethernet/dec/tulip/Kconfig
|
||||
+++ b/drivers/net/ethernet/dec/tulip/Kconfig
|
||||
@@ -40,8 +40,12 @@ config DE2104X_DSL
|
||||
Default is 0, and range is 0 to 31.
|
||||
|
||||
config TULIP
|
||||
+ tristate
|
||||
+
|
||||
+config TULIP_PCI
|
||||
tristate "DECchip Tulip (dc2114x) PCI support"
|
||||
depends on PCI
|
||||
+ select TULIP
|
||||
select CRC32
|
||||
---help---
|
||||
This driver is developed for the SMC EtherPower series Ethernet
|
||||
@@ -58,7 +62,7 @@ config TULIP
|
||||
|
||||
config TULIP_MWI
|
||||
bool "New bus configuration"
|
||||
- depends on TULIP
|
||||
+ depends on TULIP_PCI
|
||||
---help---
|
||||
This configures your Tulip card specifically for the card and
|
||||
system cache line size type you are using.
|
||||
@@ -69,7 +73,7 @@ config TULIP_MWI
|
||||
|
||||
config TULIP_MMIO
|
||||
bool "Use PCI shared mem for NIC registers"
|
||||
- depends on TULIP
|
||||
+ depends on TULIP_PCI
|
||||
---help---
|
||||
Use PCI shared memory for the NIC registers, rather than going through
|
||||
the Tulip's PIO (programmed I/O ports). Faster, but could produce
|
||||
--- a/drivers/net/ethernet/dec/tulip/tulip.h
|
||||
+++ b/drivers/net/ethernet/dec/tulip/tulip.h
|
||||
@@ -447,6 +447,8 @@ struct tulip_private {
|
||||
int cur_index; /* Current media index. */
|
||||
int saved_if_port;
|
||||
struct pci_dev *pdev;
|
||||
+ struct device *kdev;
|
||||
+ int irq;
|
||||
int ttimer;
|
||||
int susp_rx;
|
||||
unsigned long nir;
|
@ -1,490 +0,0 @@
|
||||
--- a/drivers/net/ethernet/dec/tulip/Kconfig
|
||||
+++ b/drivers/net/ethernet/dec/tulip/Kconfig
|
||||
@@ -60,6 +60,14 @@ config TULIP_PCI
|
||||
To compile this driver as a module, choose M here. The module will
|
||||
be called tulip.
|
||||
|
||||
+config TULIP_PLATFORM
|
||||
+ tristate "DECchip Tulip (dc2114x) Platform support"
|
||||
+ depends on HAS_IOMEM
|
||||
+ select TULIP
|
||||
+ select CRC32
|
||||
+ ---help---
|
||||
+ This driver is for the platform variant.
|
||||
+
|
||||
config TULIP_MWI
|
||||
bool "New bus configuration"
|
||||
depends on TULIP_PCI
|
||||
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
|
||||
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/etherdevice.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/platform_data/tulip.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/crc32.h>
|
||||
@@ -203,6 +205,9 @@ struct tulip_chip_table tulip_tbl[] = {
|
||||
{ "Conexant LANfinity", 256, 0x0001ebef,
|
||||
HAS_MII | HAS_ACPI, tulip_timer, tulip_media_task },
|
||||
|
||||
+ { "Infineon ADM8668", 256, 0x0001a451,
|
||||
+ MC_HASH_ONLY | COMET_MAC_ADDR, tulip_timer, tulip_media_task, },
|
||||
+
|
||||
};
|
||||
|
||||
|
||||
@@ -376,6 +381,11 @@ static void tulip_up(struct net_device *
|
||||
sizeof(tp->setup_frame),
|
||||
PCI_DMA_TODEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ mapping = dma_map_single(&tp->pldev->dev, tp->setup_frame,
|
||||
+ sizeof(tp->setup_frame),
|
||||
+ DMA_TO_DEVICE);
|
||||
+#endif
|
||||
tp->tx_buffers[tp->cur_tx].skb = NULL;
|
||||
tp->tx_buffers[tp->cur_tx].mapping = mapping;
|
||||
|
||||
@@ -395,6 +405,7 @@ static void tulip_up(struct net_device *
|
||||
i = 0;
|
||||
if (tp->mtable == NULL)
|
||||
goto media_picked;
|
||||
+
|
||||
if (dev->if_port) {
|
||||
int looking_for = tulip_media_cap[dev->if_port] & MediaIsMII ? 11 :
|
||||
(dev->if_port == 12 ? 0 : dev->if_port);
|
||||
@@ -488,6 +499,10 @@ media_picked:
|
||||
iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88);
|
||||
dev->if_port = tp->mii_cnt ? 11 : 0;
|
||||
tp->csr6 = 0x00040000;
|
||||
+ } else if (tp->chip_id == ADM8668) {
|
||||
+ /* Enable automatic Tx underrun recovery. */
|
||||
+ iowrite32(ioread32(ioaddr + 0x88) | 1, ioaddr + 0x88);
|
||||
+ tp->csr6 = 0x00040000;
|
||||
} else if (tp->chip_id == AX88140) {
|
||||
tp->csr6 = tp->mii_cnt ? 0x00040100 : 0x00000100;
|
||||
} else
|
||||
@@ -659,6 +674,10 @@ static void tulip_init_ring(struct net_d
|
||||
mapping = pci_map_single(tp->pdev, skb->data,
|
||||
PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ mapping = dma_map_single(&tp->pldev->dev, skb->data,
|
||||
+ PKT_BUF_SZ, DMA_FROM_DEVICE);
|
||||
+#endif
|
||||
tp->rx_buffers[i].mapping = mapping;
|
||||
tp->rx_ring[i].status = cpu_to_le32(DescOwned); /* Owned by Tulip chip */
|
||||
tp->rx_ring[i].buffer1 = cpu_to_le32(mapping);
|
||||
@@ -695,6 +714,11 @@ tulip_start_xmit(struct sk_buff *skb, st
|
||||
mapping = pci_map_single(tp->pdev, skb->data,
|
||||
skb->len, PCI_DMA_TODEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ mapping = dma_map_single(&tp->pldev->dev, skb->data,
|
||||
+ skb->len,
|
||||
+ DMA_TO_DEVICE);
|
||||
+#endif
|
||||
tp->tx_buffers[entry].mapping = mapping;
|
||||
tp->tx_ring[entry].buffer1 = cpu_to_le32(mapping);
|
||||
|
||||
@@ -751,6 +775,13 @@ static void tulip_clean_tx_ring(struct t
|
||||
sizeof(tp->setup_frame),
|
||||
PCI_DMA_TODEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ dma_unmap_single(&tp->pldev->dev,
|
||||
+ tp->tx_buffers[entry].mapping,
|
||||
+ sizeof(tp->setup_frame),
|
||||
+ DMA_TO_DEVICE);
|
||||
+#endif
|
||||
+
|
||||
continue;
|
||||
}
|
||||
#ifdef CONFIG_TULIP_PCI
|
||||
@@ -758,6 +789,11 @@ static void tulip_clean_tx_ring(struct t
|
||||
tp->tx_buffers[entry].skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping,
|
||||
+ tp->tx_buffers[entry].skb->len,
|
||||
+ DMA_TO_DEVICE);
|
||||
+#endif
|
||||
|
||||
/* Free the original skb. */
|
||||
dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
|
||||
@@ -835,6 +871,10 @@ static void tulip_free_ring (struct net_
|
||||
pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ dma_unmap_single(&tp->pldev->dev, mapping, PKT_BUF_SZ,
|
||||
+ DMA_FROM_DEVICE);
|
||||
+#endif
|
||||
dev_kfree_skb (skb);
|
||||
}
|
||||
}
|
||||
@@ -847,6 +887,10 @@ static void tulip_free_ring (struct net_
|
||||
pci_unmap_single(tp->pdev, tp->tx_buffers[i].mapping,
|
||||
skb->len, PCI_DMA_TODEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[i].mapping,
|
||||
+ skb->len, DMA_TO_DEVICE);
|
||||
+#endif
|
||||
dev_kfree_skb (skb);
|
||||
}
|
||||
tp->tx_buffers[i].skb = NULL;
|
||||
@@ -901,6 +945,9 @@ static void tulip_get_drvinfo(struct net
|
||||
#ifdef CONFIG_TULIP_PCI
|
||||
strlcpy(info->bus_info, pci_name(np->pdev), sizeof(info->bus_info));
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ strlcpy(info->bus_info, "platform", sizeof(info->bus_info));
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -916,6 +963,9 @@ static int tulip_ethtool_set_wol(struct
|
||||
#ifdef CONFIG_TULIP_PCI
|
||||
device_set_wakeup_enable(tp->kdev, tp->wolinfo.wolopts);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ device_set_wakeup_enable(&tp->pldev->dev, tp->wolinfo.wolopts);
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1191,13 +1241,20 @@ static void set_rx_mode(struct net_devic
|
||||
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
tp->tx_buffers[entry].skb = NULL;
|
||||
tp->tx_buffers[entry].mapping =
|
||||
-#ifdef CONFIG_TULIP_PCI
|
||||
pci_map_single(tp->pdev, tp->setup_frame,
|
||||
sizeof(tp->setup_frame),
|
||||
PCI_DMA_TODEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ tp->tx_buffers[entry].skb = NULL;
|
||||
+ tp->tx_buffers[entry].mapping =
|
||||
+ dma_map_single(&tp->pldev->dev, tp->setup_frame,
|
||||
+ sizeof(tp->setup_frame),
|
||||
+ DMA_TO_DEVICE);
|
||||
+#endif
|
||||
/* Put the setup frame on the Tx list. */
|
||||
if (entry == TX_RING_SIZE-1)
|
||||
tx_flags |= DESC_RING_WRAP; /* Wrap ring. */
|
||||
@@ -1217,6 +1274,9 @@ static void set_rx_mode(struct net_devic
|
||||
spin_unlock_irqrestore(&tp->lock, flags);
|
||||
}
|
||||
|
||||
+ if (tp->chip_id == ADM8668)
|
||||
+ csr6 |= (1 << 9); /* force 100Mbps full duplex */
|
||||
+
|
||||
iowrite32(csr6, ioaddr + CSR6);
|
||||
}
|
||||
|
||||
@@ -1983,6 +2043,126 @@ static void tulip_remove_one(struct pci_
|
||||
}
|
||||
#endif /* CONFIG_TULIP_PCI */
|
||||
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+static int tulip_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct tulip_private *tp;
|
||||
+ struct tulip_platform_data *pdata;
|
||||
+ struct net_device *dev;
|
||||
+ struct resource *res;
|
||||
+ void __iomem *ioaddr;
|
||||
+ int irq;
|
||||
+
|
||||
+ if (pdev->id < 0 || pdev->id >= MAX_UNITS)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (!(res = platform_get_resource(pdev, IORESOURCE_IRQ, 0)))
|
||||
+ return -ENODEV;
|
||||
+ irq = res->start;
|
||||
+ if (!(res = platform_get_resource(pdev, IORESOURCE_MEM, 0)))
|
||||
+ return -ENODEV;
|
||||
+ if (!(ioaddr = ioremap(res->start, res->end - res->start)))
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ pdata = pdev->dev.platform_data;
|
||||
+ if (!pdata)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ if (!(dev = alloc_etherdev(sizeof (*tp))))
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ /* setup net dev */
|
||||
+ dev->base_addr = (unsigned long)res->start;
|
||||
+ dev->irq = irq;
|
||||
+ SET_NETDEV_DEV(dev, &pdev->dev);
|
||||
+
|
||||
+ /* tulip private struct */
|
||||
+ tp = netdev_priv(dev);
|
||||
+ tp->dev = dev;
|
||||
+ tp->base_addr = ioaddr;
|
||||
+ tp->csr0 = 0;
|
||||
+ tp->pldev = pdev;
|
||||
+ tp->kdev = &pdev->dev;
|
||||
+ tp->irq = irq;
|
||||
+ tp->rx_ring = dma_alloc_coherent(&pdev->dev,
|
||||
+ sizeof(struct tulip_rx_desc) * RX_RING_SIZE +
|
||||
+ sizeof(struct tulip_tx_desc) * TX_RING_SIZE,
|
||||
+ &tp->rx_ring_dma, GFP_KERNEL);
|
||||
+ if (!tp->rx_ring)
|
||||
+ return -ENODEV;
|
||||
+ tp->tx_ring = (struct tulip_tx_desc *)(tp->rx_ring + RX_RING_SIZE);
|
||||
+ tp->tx_ring_dma = tp->rx_ring_dma + sizeof(struct tulip_rx_desc) * RX_RING_SIZE;
|
||||
+
|
||||
+ tp->chip_id = pdata->chip_id;
|
||||
+ tp->flags = tulip_tbl[tp->chip_id].flags;
|
||||
+
|
||||
+ spin_lock_init(&tp->lock);
|
||||
+ spin_lock_init(&tp->mii_lock);
|
||||
+
|
||||
+ init_timer(&tp->timer);
|
||||
+ tp->timer.data = (unsigned long)dev;
|
||||
+ tp->timer.function = tulip_tbl[tp->chip_id].media_timer;
|
||||
+
|
||||
+ INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task);
|
||||
+
|
||||
+ /* Stop the chip's Tx and Rx processes. */
|
||||
+ tulip_stop_rxtx(tp);
|
||||
+
|
||||
+ /* Clear the missed-packet counter. */
|
||||
+ ioread32(ioaddr + CSR8);
|
||||
+
|
||||
+ if (!is_valid_ether_addr(pdata->mac)) {
|
||||
+ dev_info(&pdev->dev, "generating random ethernet MAC\n");
|
||||
+ random_ether_addr(dev->dev_addr);
|
||||
+ } else
|
||||
+ memcpy(dev->dev_addr, pdata->mac, ETH_ALEN);
|
||||
+
|
||||
+ /* The Tulip-specific entries in the device structure. */
|
||||
+ dev->netdev_ops = &tulip_netdev_ops;
|
||||
+ dev->watchdog_timeo = TX_TIMEOUT;
|
||||
+ netif_napi_add(dev, &tp->napi, tulip_poll, 16);
|
||||
+ dev->ethtool_ops = &ops;
|
||||
+
|
||||
+ if (register_netdev(dev))
|
||||
+ goto err_out_free_ring;
|
||||
+
|
||||
+ dev_info(&dev->dev,
|
||||
+ "tulip_platform (%s) at MMIO %#lx %pM, IRQ %d\n",
|
||||
+ tulip_tbl[tp->chip_id].chip_name,
|
||||
+ (unsigned long)dev->base_addr, dev->dev_addr, irq);
|
||||
+
|
||||
+ platform_set_drvdata(pdev, dev);
|
||||
+ return 0;
|
||||
+
|
||||
+err_out_free_ring:
|
||||
+ dma_free_coherent(&pdev->dev,
|
||||
+ sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
|
||||
+ sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
|
||||
+ tp->rx_ring, tp->rx_ring_dma);
|
||||
+ return -ENODEV;
|
||||
+}
|
||||
+
|
||||
+static int tulip_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct net_device *dev = platform_get_drvdata (pdev);
|
||||
+ struct tulip_private *tp;
|
||||
+
|
||||
+ if (!dev)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ tp = netdev_priv(dev);
|
||||
+ unregister_netdev(dev);
|
||||
+ dma_free_coherent(&pdev->dev,
|
||||
+ sizeof (struct tulip_rx_desc) * RX_RING_SIZE +
|
||||
+ sizeof (struct tulip_tx_desc) * TX_RING_SIZE,
|
||||
+ tp->rx_ring, tp->rx_ring_dma);
|
||||
+ iounmap(tp->base_addr);
|
||||
+ free_netdev(dev);
|
||||
+ platform_set_drvdata(pdev, NULL);
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_NET_POLL_CONTROLLER
|
||||
/*
|
||||
* Polling 'interrupt' - used by things like netconsole to send skbs
|
||||
@@ -2016,6 +2196,17 @@ static struct pci_driver tulip_pci_drive
|
||||
};
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+static struct platform_driver tulip_platform_driver = {
|
||||
+ .probe = tulip_probe,
|
||||
+ .remove = tulip_remove,
|
||||
+ .driver = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .name = DRV_NAME,
|
||||
+ },
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
|
||||
static int __init tulip_init (void)
|
||||
{
|
||||
@@ -2038,6 +2229,9 @@ static int __init tulip_init (void)
|
||||
#ifdef CONFIG_TULIP_PCI
|
||||
ret = pci_register_driver(&tulip_pci_driver);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ ret = platform_driver_register(&tulip_platform_driver);
|
||||
+#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2047,6 +2241,9 @@ static void __exit tulip_cleanup (void)
|
||||
#ifdef CONFIG_TULIP_PCI
|
||||
pci_unregister_driver (&tulip_pci_driver);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ platform_driver_unregister (&tulip_platform_driver);
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
||||
--- a/drivers/net/ethernet/dec/tulip/tulip.h
|
||||
+++ b/drivers/net/ethernet/dec/tulip/tulip.h
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <linux/timer.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/platform_data/tulip.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/unaligned.h>
|
||||
@@ -69,28 +71,6 @@ enum tbl_flag {
|
||||
};
|
||||
|
||||
|
||||
-/* chip types. careful! order is VERY IMPORTANT here, as these
|
||||
- * are used throughout the driver as indices into arrays */
|
||||
-/* Note 21142 == 21143. */
|
||||
-enum chips {
|
||||
- DC21040 = 0,
|
||||
- DC21041 = 1,
|
||||
- DC21140 = 2,
|
||||
- DC21142 = 3, DC21143 = 3,
|
||||
- LC82C168,
|
||||
- MX98713,
|
||||
- MX98715,
|
||||
- MX98725,
|
||||
- AX88140,
|
||||
- PNIC2,
|
||||
- COMET,
|
||||
- COMPEX9881,
|
||||
- I21145,
|
||||
- DM910X,
|
||||
- CONEXANT,
|
||||
-};
|
||||
-
|
||||
-
|
||||
enum MediaIs {
|
||||
MediaIsFD = 1,
|
||||
MediaAlwaysFD = 2,
|
||||
@@ -446,7 +426,12 @@ struct tulip_private {
|
||||
struct mediatable *mtable;
|
||||
int cur_index; /* Current media index. */
|
||||
int saved_if_port;
|
||||
+#ifdef CONFIG_TULIP_PCI
|
||||
struct pci_dev *pdev;
|
||||
+#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ struct platform_device *pldev;
|
||||
+#endif
|
||||
struct device *kdev;
|
||||
int irq;
|
||||
int ttimer;
|
||||
--- a/drivers/net/ethernet/dec/tulip/interrupt.c
|
||||
+++ b/drivers/net/ethernet/dec/tulip/interrupt.c
|
||||
@@ -77,6 +77,10 @@ int tulip_refill_rx(struct net_device *d
|
||||
mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
|
||||
PCI_DMA_FROMDEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ mapping = dma_map_single(&tp->pldev->dev, skb->data, PKT_BUF_SZ,
|
||||
+ DMA_FROM_DEVICE);
|
||||
+#endif
|
||||
if (dma_mapping_error(tp->kdev, mapping)) {
|
||||
dev_kfree_skb(skb);
|
||||
tp->rx_buffers[entry].skb = NULL;
|
||||
@@ -204,8 +208,7 @@ int tulip_poll(struct napi_struct *napi,
|
||||
dev->stats.rx_fifo_errors++;
|
||||
}
|
||||
} else {
|
||||
- struct sk_buff *skb;
|
||||
-
|
||||
+ struct sk_buff *skb;
|
||||
/* Check if the packet is long enough to accept without copying
|
||||
to a minimally-sized skbuff. */
|
||||
if (pkt_len < tulip_rx_copybreak &&
|
||||
@@ -248,6 +251,10 @@ int tulip_poll(struct napi_struct *napi,
|
||||
pci_unmap_single(tp->pdev, tp->rx_buffers[entry].mapping,
|
||||
PKT_BUF_SZ, PCI_DMA_FROMDEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ dma_unmap_single(&tp->pldev->dev, tp->rx_buffers[entry].mapping,
|
||||
+ PKT_BUF_SZ, DMA_FROM_DEVICE);
|
||||
+#endif
|
||||
|
||||
tp->rx_buffers[entry].skb = NULL;
|
||||
tp->rx_buffers[entry].mapping = 0;
|
||||
@@ -641,6 +648,11 @@ irqreturn_t tulip_interrupt(int irq, voi
|
||||
tp->tx_buffers[entry].skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
#endif
|
||||
+#ifdef CONFIG_TULIP_PLATFORM
|
||||
+ dma_unmap_single(&tp->pldev->dev, tp->tx_buffers[entry].mapping,
|
||||
+ tp->tx_buffers[entry].skb->len,
|
||||
+ DMA_TO_DEVICE);
|
||||
+#endif
|
||||
|
||||
/* Free the original skb. */
|
||||
dev_kfree_skb_irq(tp->tx_buffers[entry].skb);
|
||||
--- /dev/null
|
||||
+++ b/include/linux/platform_data/tulip.h
|
||||
@@ -0,0 +1,31 @@
|
||||
+#ifndef _LINUX_TULIP_PDATA_H
|
||||
+#define _LINUX_TULIP_PDATA_H
|
||||
+
|
||||
+/* chip types. careful! order is VERY IMPORTANT here, as these
|
||||
+ * are used throughout the driver as indices into arrays */
|
||||
+/* Note 21142 == 21143. */
|
||||
+enum chips {
|
||||
+ DC21040 = 0,
|
||||
+ DC21041 = 1,
|
||||
+ DC21140 = 2,
|
||||
+ DC21142 = 3, DC21143 = 3,
|
||||
+ LC82C168,
|
||||
+ MX98713,
|
||||
+ MX98715,
|
||||
+ MX98725,
|
||||
+ AX88140,
|
||||
+ PNIC2,
|
||||
+ COMET,
|
||||
+ COMPEX9881,
|
||||
+ I21145,
|
||||
+ DM910X,
|
||||
+ CONEXANT,
|
||||
+ ADM8668,
|
||||
+};
|
||||
+
|
||||
+struct tulip_platform_data {
|
||||
+ u8 mac[6];
|
||||
+ enum chips chip_id;
|
||||
+};
|
||||
+
|
||||
+#endif
|
@ -1,377 +0,0 @@
|
||||
--- a/drivers/tty/serial/amba-pl010.c
|
||||
+++ b/drivers/tty/serial/amba-pl010.c
|
||||
@@ -48,11 +48,10 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
-#define UART_NR 8
|
||||
-
|
||||
#define SERIAL_AMBA_MAJOR 204
|
||||
#define SERIAL_AMBA_MINOR 16
|
||||
-#define SERIAL_AMBA_NR UART_NR
|
||||
+#define SERIAL_AMBA_NR CONFIG_SERIAL_AMBA_PL010_NUMPORTS
|
||||
+#define SERIAL_AMBA_NAME CONFIG_SERIAL_AMBA_PL010_PORTNAME
|
||||
|
||||
#define AMBA_ISR_PASS_LIMIT 256
|
||||
|
||||
@@ -78,9 +77,9 @@ static void pl010_stop_tx(struct uart_po
|
||||
struct uart_amba_port *uap = (struct uart_amba_port *)port;
|
||||
unsigned int cr;
|
||||
|
||||
- cr = readb(uap->port.membase + UART010_CR);
|
||||
+ cr = __raw_readl(uap->port.membase + UART010_CR);
|
||||
cr &= ~UART010_CR_TIE;
|
||||
- writel(cr, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(cr, uap->port.membase + UART010_CR);
|
||||
}
|
||||
|
||||
static void pl010_start_tx(struct uart_port *port)
|
||||
@@ -88,9 +87,9 @@ static void pl010_start_tx(struct uart_p
|
||||
struct uart_amba_port *uap = (struct uart_amba_port *)port;
|
||||
unsigned int cr;
|
||||
|
||||
- cr = readb(uap->port.membase + UART010_CR);
|
||||
+ cr = __raw_readl(uap->port.membase + UART010_CR);
|
||||
cr |= UART010_CR_TIE;
|
||||
- writel(cr, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(cr, uap->port.membase + UART010_CR);
|
||||
}
|
||||
|
||||
static void pl010_stop_rx(struct uart_port *port)
|
||||
@@ -98,9 +97,9 @@ static void pl010_stop_rx(struct uart_po
|
||||
struct uart_amba_port *uap = (struct uart_amba_port *)port;
|
||||
unsigned int cr;
|
||||
|
||||
- cr = readb(uap->port.membase + UART010_CR);
|
||||
+ cr = __raw_readl(uap->port.membase + UART010_CR);
|
||||
cr &= ~(UART010_CR_RIE | UART010_CR_RTIE);
|
||||
- writel(cr, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(cr, uap->port.membase + UART010_CR);
|
||||
}
|
||||
|
||||
static void pl010_enable_ms(struct uart_port *port)
|
||||
@@ -108,18 +107,18 @@ static void pl010_enable_ms(struct uart_
|
||||
struct uart_amba_port *uap = (struct uart_amba_port *)port;
|
||||
unsigned int cr;
|
||||
|
||||
- cr = readb(uap->port.membase + UART010_CR);
|
||||
+ cr = __raw_readl(uap->port.membase + UART010_CR);
|
||||
cr |= UART010_CR_MSIE;
|
||||
- writel(cr, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(cr, uap->port.membase + UART010_CR);
|
||||
}
|
||||
|
||||
static void pl010_rx_chars(struct uart_amba_port *uap)
|
||||
{
|
||||
unsigned int status, ch, flag, rsr, max_count = 256;
|
||||
|
||||
- status = readb(uap->port.membase + UART01x_FR);
|
||||
+ status = __raw_readl(uap->port.membase + UART01x_FR);
|
||||
while (UART_RX_DATA(status) && max_count--) {
|
||||
- ch = readb(uap->port.membase + UART01x_DR);
|
||||
+ ch = __raw_readl(uap->port.membase + UART01x_DR);
|
||||
flag = TTY_NORMAL;
|
||||
|
||||
uap->port.icount.rx++;
|
||||
@@ -128,9 +127,9 @@ static void pl010_rx_chars(struct uart_a
|
||||
* Note that the error handling code is
|
||||
* out of the main execution path
|
||||
*/
|
||||
- rsr = readb(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
|
||||
+ rsr = __raw_readl(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX;
|
||||
if (unlikely(rsr & UART01x_RSR_ANY)) {
|
||||
- writel(0, uap->port.membase + UART01x_ECR);
|
||||
+ __raw_writel(0, uap->port.membase + UART01x_ECR);
|
||||
|
||||
if (rsr & UART01x_RSR_BE) {
|
||||
rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
|
||||
@@ -160,7 +159,7 @@ static void pl010_rx_chars(struct uart_a
|
||||
uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag);
|
||||
|
||||
ignore_char:
|
||||
- status = readb(uap->port.membase + UART01x_FR);
|
||||
+ status = __raw_readl(uap->port.membase + UART01x_FR);
|
||||
}
|
||||
spin_unlock(&uap->port.lock);
|
||||
tty_flip_buffer_push(&uap->port.state->port);
|
||||
@@ -173,7 +172,7 @@ static void pl010_tx_chars(struct uart_a
|
||||
int count;
|
||||
|
||||
if (uap->port.x_char) {
|
||||
- writel(uap->port.x_char, uap->port.membase + UART01x_DR);
|
||||
+ __raw_writel(uap->port.x_char, uap->port.membase + UART01x_DR);
|
||||
uap->port.icount.tx++;
|
||||
uap->port.x_char = 0;
|
||||
return;
|
||||
@@ -185,7 +184,7 @@ static void pl010_tx_chars(struct uart_a
|
||||
|
||||
count = uap->port.fifosize >> 1;
|
||||
do {
|
||||
- writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
|
||||
+ __raw_writel(xmit->buf[xmit->tail], uap->port.membase + UART01x_DR);
|
||||
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
|
||||
uap->port.icount.tx++;
|
||||
if (uart_circ_empty(xmit))
|
||||
@@ -203,9 +202,9 @@ static void pl010_modem_status(struct ua
|
||||
{
|
||||
unsigned int status, delta;
|
||||
|
||||
- writel(0, uap->port.membase + UART010_ICR);
|
||||
+ __raw_writel(0, uap->port.membase + UART010_ICR);
|
||||
|
||||
- status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
|
||||
+ status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
|
||||
|
||||
delta = status ^ uap->old_status;
|
||||
uap->old_status = status;
|
||||
@@ -233,7 +232,7 @@ static irqreturn_t pl010_int(int irq, vo
|
||||
|
||||
spin_lock(&uap->port.lock);
|
||||
|
||||
- status = readb(uap->port.membase + UART010_IIR);
|
||||
+ status = __raw_readl(uap->port.membase + UART010_IIR);
|
||||
if (status) {
|
||||
do {
|
||||
if (status & (UART010_IIR_RTIS | UART010_IIR_RIS))
|
||||
@@ -246,7 +245,7 @@ static irqreturn_t pl010_int(int irq, vo
|
||||
if (pass_counter-- == 0)
|
||||
break;
|
||||
|
||||
- status = readb(uap->port.membase + UART010_IIR);
|
||||
+ status = __raw_readl(uap->port.membase + UART010_IIR);
|
||||
} while (status & (UART010_IIR_RTIS | UART010_IIR_RIS |
|
||||
UART010_IIR_TIS));
|
||||
handled = 1;
|
||||
@@ -260,7 +259,7 @@ static irqreturn_t pl010_int(int irq, vo
|
||||
static unsigned int pl010_tx_empty(struct uart_port *port)
|
||||
{
|
||||
struct uart_amba_port *uap = (struct uart_amba_port *)port;
|
||||
- unsigned int status = readb(uap->port.membase + UART01x_FR);
|
||||
+ unsigned int status = __raw_readl(uap->port.membase + UART01x_FR);
|
||||
return status & UART01x_FR_BUSY ? 0 : TIOCSER_TEMT;
|
||||
}
|
||||
|
||||
@@ -270,7 +269,7 @@ static unsigned int pl010_get_mctrl(stru
|
||||
unsigned int result = 0;
|
||||
unsigned int status;
|
||||
|
||||
- status = readb(uap->port.membase + UART01x_FR);
|
||||
+ status = __raw_readl(uap->port.membase + UART01x_FR);
|
||||
if (status & UART01x_FR_DCD)
|
||||
result |= TIOCM_CAR;
|
||||
if (status & UART01x_FR_DSR)
|
||||
@@ -296,12 +295,12 @@ static void pl010_break_ctl(struct uart_
|
||||
unsigned int lcr_h;
|
||||
|
||||
spin_lock_irqsave(&uap->port.lock, flags);
|
||||
- lcr_h = readb(uap->port.membase + UART010_LCRH);
|
||||
+ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
|
||||
if (break_state == -1)
|
||||
lcr_h |= UART01x_LCRH_BRK;
|
||||
else
|
||||
lcr_h &= ~UART01x_LCRH_BRK;
|
||||
- writel(lcr_h, uap->port.membase + UART010_LCRH);
|
||||
+ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
|
||||
spin_unlock_irqrestore(&uap->port.lock, flags);
|
||||
}
|
||||
|
||||
@@ -329,12 +328,12 @@ static int pl010_startup(struct uart_por
|
||||
/*
|
||||
* initialise the old status of the modem signals
|
||||
*/
|
||||
- uap->old_status = readb(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
|
||||
+ uap->old_status = __raw_readl(uap->port.membase + UART01x_FR) & UART01x_FR_MODEM_ANY;
|
||||
|
||||
/*
|
||||
* Finally, enable interrupts
|
||||
*/
|
||||
- writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
|
||||
+ __raw_writel(UART01x_CR_UARTEN | UART010_CR_RIE | UART010_CR_RTIE,
|
||||
uap->port.membase + UART010_CR);
|
||||
|
||||
return 0;
|
||||
@@ -357,10 +356,10 @@ static void pl010_shutdown(struct uart_p
|
||||
/*
|
||||
* disable all interrupts, disable the port
|
||||
*/
|
||||
- writel(0, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(0, uap->port.membase + UART010_CR);
|
||||
|
||||
/* disable break condition and fifos */
|
||||
- writel(readb(uap->port.membase + UART010_LCRH) &
|
||||
+ __raw_writel(__raw_readl(uap->port.membase + UART010_LCRH) &
|
||||
~(UART01x_LCRH_BRK | UART01x_LCRH_FEN),
|
||||
uap->port.membase + UART010_LCRH);
|
||||
|
||||
@@ -382,7 +381,7 @@ pl010_set_termios(struct uart_port *port
|
||||
/*
|
||||
* Ask the core to calculate the divisor for us.
|
||||
*/
|
||||
- baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
|
||||
+ baud = uart_get_baud_rate(port, termios, old, 0, uap->port.uartclk/16);
|
||||
quot = uart_get_divisor(port, baud);
|
||||
|
||||
switch (termios->c_cflag & CSIZE) {
|
||||
@@ -445,25 +444,25 @@ pl010_set_termios(struct uart_port *port
|
||||
uap->port.ignore_status_mask |= UART_DUMMY_RSR_RX;
|
||||
|
||||
/* first, disable everything */
|
||||
- old_cr = readb(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
|
||||
+ old_cr = __raw_readl(uap->port.membase + UART010_CR) & ~UART010_CR_MSIE;
|
||||
|
||||
if (UART_ENABLE_MS(port, termios->c_cflag))
|
||||
old_cr |= UART010_CR_MSIE;
|
||||
|
||||
- writel(0, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(0, uap->port.membase + UART010_CR);
|
||||
|
||||
/* Set baud rate */
|
||||
quot -= 1;
|
||||
- writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
|
||||
- writel(quot & 0xff, uap->port.membase + UART010_LCRL);
|
||||
+ __raw_writel((quot & 0xf00) >> 8, uap->port.membase + UART010_LCRM);
|
||||
+ __raw_writel(quot & 0xff, uap->port.membase + UART010_LCRL);
|
||||
|
||||
/*
|
||||
* ----------v----------v----------v----------v-----
|
||||
* NOTE: MUST BE WRITTEN AFTER UARTLCR_M & UARTLCR_L
|
||||
* ----------^----------^----------^----------^-----
|
||||
*/
|
||||
- writel(lcr_h, uap->port.membase + UART010_LCRH);
|
||||
- writel(old_cr, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(lcr_h, uap->port.membase + UART010_LCRH);
|
||||
+ __raw_writel(old_cr, uap->port.membase + UART010_CR);
|
||||
|
||||
spin_unlock_irqrestore(&uap->port.lock, flags);
|
||||
}
|
||||
@@ -545,7 +544,7 @@ static struct uart_ops amba_pl010_pops =
|
||||
.verify_port = pl010_verify_port,
|
||||
};
|
||||
|
||||
-static struct uart_amba_port *amba_ports[UART_NR];
|
||||
+static struct uart_amba_port *amba_ports[SERIAL_AMBA_NR];
|
||||
|
||||
#ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
|
||||
|
||||
@@ -555,10 +554,10 @@ static void pl010_console_putchar(struct
|
||||
unsigned int status;
|
||||
|
||||
do {
|
||||
- status = readb(uap->port.membase + UART01x_FR);
|
||||
+ status = __raw_readl(uap->port.membase + UART01x_FR);
|
||||
barrier();
|
||||
} while (!UART_TX_READY(status));
|
||||
- writel(ch, uap->port.membase + UART01x_DR);
|
||||
+ __raw_writel(ch, uap->port.membase + UART01x_DR);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -572,8 +571,8 @@ pl010_console_write(struct console *co,
|
||||
/*
|
||||
* First save the CR then disable the interrupts
|
||||
*/
|
||||
- old_cr = readb(uap->port.membase + UART010_CR);
|
||||
- writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
|
||||
+ old_cr = __raw_readl(uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(UART01x_CR_UARTEN, uap->port.membase + UART010_CR);
|
||||
|
||||
uart_console_write(&uap->port, s, count, pl010_console_putchar);
|
||||
|
||||
@@ -582,10 +581,10 @@ pl010_console_write(struct console *co,
|
||||
* and restore the TCR
|
||||
*/
|
||||
do {
|
||||
- status = readb(uap->port.membase + UART01x_FR);
|
||||
+ status = __raw_readl(uap->port.membase + UART01x_FR);
|
||||
barrier();
|
||||
} while (status & UART01x_FR_BUSY);
|
||||
- writel(old_cr, uap->port.membase + UART010_CR);
|
||||
+ __raw_writel(old_cr, uap->port.membase + UART010_CR);
|
||||
|
||||
clk_disable(uap->clk);
|
||||
}
|
||||
@@ -594,9 +593,9 @@ static void __init
|
||||
pl010_console_get_options(struct uart_amba_port *uap, int *baud,
|
||||
int *parity, int *bits)
|
||||
{
|
||||
- if (readb(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
|
||||
+ if (__raw_readl(uap->port.membase + UART010_CR) & UART01x_CR_UARTEN) {
|
||||
unsigned int lcr_h, quot;
|
||||
- lcr_h = readb(uap->port.membase + UART010_LCRH);
|
||||
+ lcr_h = __raw_readl(uap->port.membase + UART010_LCRH);
|
||||
|
||||
*parity = 'n';
|
||||
if (lcr_h & UART01x_LCRH_PEN) {
|
||||
@@ -611,8 +610,8 @@ pl010_console_get_options(struct uart_am
|
||||
else
|
||||
*bits = 8;
|
||||
|
||||
- quot = readb(uap->port.membase + UART010_LCRL) |
|
||||
- readb(uap->port.membase + UART010_LCRM) << 8;
|
||||
+ quot = __raw_readl(uap->port.membase + UART010_LCRL) |
|
||||
+ __raw_readl(uap->port.membase + UART010_LCRM) << 8;
|
||||
*baud = uap->port.uartclk / (16 * (quot + 1));
|
||||
}
|
||||
}
|
||||
@@ -631,7 +630,7 @@ static int __init pl010_console_setup(st
|
||||
* if so, search for the first available port that does have
|
||||
* console support.
|
||||
*/
|
||||
- if (co->index >= UART_NR)
|
||||
+ if (co->index >= SERIAL_AMBA_NR)
|
||||
co->index = 0;
|
||||
uap = amba_ports[co->index];
|
||||
if (!uap)
|
||||
@@ -653,7 +652,7 @@ static int __init pl010_console_setup(st
|
||||
|
||||
static struct uart_driver amba_reg;
|
||||
static struct console amba_console = {
|
||||
- .name = "ttyAM",
|
||||
+ .name = SERIAL_AMBA_NAME,
|
||||
.write = pl010_console_write,
|
||||
.device = uart_console_device,
|
||||
.setup = pl010_console_setup,
|
||||
@@ -669,11 +668,11 @@ static struct console amba_console = {
|
||||
|
||||
static struct uart_driver amba_reg = {
|
||||
.owner = THIS_MODULE,
|
||||
- .driver_name = "ttyAM",
|
||||
- .dev_name = "ttyAM",
|
||||
+ .driver_name = SERIAL_AMBA_NAME,
|
||||
+ .dev_name = SERIAL_AMBA_NAME,
|
||||
.major = SERIAL_AMBA_MAJOR,
|
||||
.minor = SERIAL_AMBA_MINOR,
|
||||
- .nr = UART_NR,
|
||||
+ .nr = SERIAL_AMBA_NR,
|
||||
.cons = AMBA_CONSOLE,
|
||||
};
|
||||
|
||||
--- a/drivers/tty/serial/Kconfig
|
||||
+++ b/drivers/tty/serial/Kconfig
|
||||
@@ -25,10 +25,25 @@ config SERIAL_AMBA_PL010
|
||||
help
|
||||
This selects the ARM(R) AMBA(R) PrimeCell PL010 UART. If you have
|
||||
an Integrator/AP or Integrator/PP2 platform, or if you have a
|
||||
- Cirrus Logic EP93xx CPU, say Y or M here.
|
||||
+ Cirrus Logic EP93xx CPU or an Infineon ADM5120 SOC, say Y or M here.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
+config SERIAL_AMBA_PL010_NUMPORTS
|
||||
+ int "Maximum number of AMBA PL010 serial ports"
|
||||
+ depends on SERIAL_AMBA_PL010
|
||||
+ default "8"
|
||||
+ ---help---
|
||||
+ Set this to the number of serial ports you want the AMBA PL010 driver
|
||||
+ to support.
|
||||
+
|
||||
+config SERIAL_AMBA_PL010_PORTNAME
|
||||
+ string "Name of the AMBA PL010 serial ports"
|
||||
+ depends on SERIAL_AMBA_PL010
|
||||
+ default "ttyAM"
|
||||
+ ---help---
|
||||
+ ::: To be written :::
|
||||
+
|
||||
config SERIAL_AMBA_PL010_CONSOLE
|
||||
bool "Support for console on AMBA serial port"
|
||||
depends on SERIAL_AMBA_PL010=y
|
@ -1,13 +0,0 @@
|
||||
--- a/drivers/amba/bus.c
|
||||
+++ b/drivers/amba/bus.c
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
#include <asm/irq.h>
|
||||
|
||||
+#ifndef NO_IRQ
|
||||
+#define NO_IRQ (-1)
|
||||
+#endif
|
||||
+
|
||||
#define to_amba_driver(d) container_of(d, struct amba_driver, drv)
|
||||
|
||||
static const struct amba_id *
|
@ -1,17 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define Profile/WRTU54G-TM
|
||||
NAME:=Linksys WRTU54G T-Mobile (Default)
|
||||
PACKAGES:=kmod-rt61-pci kmod-usb2 wpad-basic
|
||||
endef
|
||||
|
||||
define Profile/WRTU54G-TM/Description
|
||||
Package set compatible with the Linksys WRTU54G T-Mobile
|
||||
endef
|
||||
$(eval $(call Profile,WRTU54G-TM))
|
||||
|
Loading…
Reference in New Issue
Block a user