+++ /dev/null
-#
-# Copyright (C) 2007-2011 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-BOARD:=adm5120
-BOARDNAME:=Infineon/ADMtek ADM5120
-FEATURES:=low_mem
-SUBTARGETS:=router_le router_be rb1xx
-INITRAMFS_EXTRA_FILES:=
-
-KERNEL_PATCHVER:=3.18
-
-include $(INCLUDE_DIR)/target.mk
-
-DEFAULT_PACKAGES += admswconfig wpad-mini kmod-input-core \
- kmod-input-polldev kmod-input-gpio-keys-polled kmod-button-hotplug \
- kmod-leds-gpio kmod-ledtrig-adm5120-switch
-
-$(eval $(call BuildTarget))
+++ /dev/null
-#!/bin/sh
-
-. /lib/functions/uci-defaults.sh
-
-board_config_update
-
-ucidef_set_led_portstate "lan1" "LAN1" "lan1" "link_act"
-ucidef_set_led_portstate "lan2" "LAN2" "lan2" "link_act"
-ucidef_set_led_portstate "lan3" "LAN3" "lan3" "link_act"
-ucidef_set_led_portstate "lan4" "LAN4" "lan4" "link_act"
-ucidef_set_led_portstate "wan" "WAN" "wan" "link_act"
-
-ucidef_set_led_netdev "wlan" "WLAN" "wlan" "wlan0"
-
-board_config_flush
-
-exit 0
+++ /dev/null
-#### VLAN configuration
-config switch
- option eth0 "0 1 2 3"
- option eth1 "4"
-
-
-#### Loopback configuration
-config interface loopback
- option ifname "lo"
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-
-#### LAN configuration
-config interface lan
- option type bridge
- option ifname "eth0"
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
- option ip6assign 60
-
-
-#### WAN configuration
-config interface wan
- option ifname "eth1"
- option proto dhcp
-
-
-#### WAN6 configuration
-config interface wan6
- option ifname "eth1"
- option proto dhcpv6
-
-
-#### Network global configuration
-config globals globals
- option ula_prefix auto
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2007-2013 OpenWrt.org
-
-. /lib/functions/leds.sh
-. /lib/adm5120.sh
-
-set_state() {
- case "$1" in
- preinit)
- status_led_blink_preinit
- ;;
- failsafe)
- status_led_blink_failsafe
- ;;
- preinit_regular)
- status_led_blink_preinit_regular
- ;;
- done)
- status_led_on
- ;;
- esac
-}
+++ /dev/null
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K shutdown
-tts/0::askfirst:/usr/libexec/login.sh
-ttyAM0::askfirst:/usr/libexec/login.sh
-tty1::askfirst:/usr/libexec/login.sh
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-#
-
-board_name=""
-status_led=""
-sys_mtd_part=""
-
-adm5120_detect() {
- board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
-
- case "$board_name" in
- "Cellvision"*)
- status_led="status"
- sys_mtd_part="firmware"
- ;;
- "Compex"*)
- status_led="diag"
- case "$board_name" in
- *-WRT)
- sys_mtd_part="trx"
- ;;
- *)
- sys_mtd_part="partition1"
- ;;
- esac
- ;;
- "Edimax"*)
- status_led="power"
- sys_mtd_part="firmware"
- ;;
- "Infineon"*)
- sys_mtd_part="firmware"
- ;;
- "Mikrotik"*)
- status_led="power"
- ;;
- "ZyXEL"*)
- status_led="power"
- sys_mtd_part="trx"
- ;;
- "EB-214A"*)
- status_led="power"
- sys_mtd_part="firmware"
- ;;
- *)
- ;;
- esac
-}
-
-adm5120_detect
+++ /dev/null
-#!/bin/sh
-
-do_adm5120() {
- . /lib/adm5120.sh
-}
-
-boot_hook_add preinit_main do_adm5120
+++ /dev/null
-#!/bin/sh
-
-set_preinit_ifname() {
- ifname=eth0
-}
-
-boot_hook_add preinit_main set_preinit_ifname
-
-
+++ /dev/null
-#
-# Copyright (C) 2009-2010 OpenWrt.org
-#
-
-. /lib/adm5120.sh
-
-PART_NAME="firmware"
-RAMFS_COPY_DATA=/lib/adm5120.sh
-
-platform_check_image() {
- local magic="$(get_magic_word "$1")"
-
- [ "$#" -gt 1 ] && return 1
-
- case "$board_name" in
- "ZyXEL"*|"Compex WP54 family")
- # .trx files
- [ "$magic" != "4844" ] && {
- echo "Invalid image type."
- return 1
- }
- return 0
- ;;
- *)
- ;;
- esac
-
- echo "Sysupgrade is not yet supported on $board_name."
- return 1
-}
-
-platform_do_upgrade() {
- PART_NAME="$sys_mtd_part"
- default_do_upgrade "$ARGV"
-}
+++ /dev/null
-CONFIG_ADM5120=y
-CONFIG_ADM5120_ENET=y
-CONFIG_ADM5120_MACH_5GXI=y
-CONFIG_ADM5120_MACH_BR_6104K=y
-CONFIG_ADM5120_MACH_BR_6104KP=y
-CONFIG_ADM5120_MACH_BR_61X4WG=y
-CONFIG_ADM5120_MACH_CAS_771=y
-CONFIG_ADM5120_MACH_EASY5120P_ATA=y
-CONFIG_ADM5120_MACH_EASY5120_RT=y
-CONFIG_ADM5120_MACH_EASY5120_WVOIP=y
-CONFIG_ADM5120_MACH_EASY83000=y
-CONFIG_ADM5120_MACH_EB_214A=y
-CONFIG_ADM5120_MACH_NFS_101=y
-CONFIG_ADM5120_MACH_NP27G=y
-CONFIG_ADM5120_MACH_NP28G=y
-CONFIG_ADM5120_MACH_PMUGW=y
-# CONFIG_ADM5120_MACH_RB_11X is not set
-# CONFIG_ADM5120_MACH_RB_133 is not set
-# CONFIG_ADM5120_MACH_RB_133C is not set
-# CONFIG_ADM5120_MACH_RB_150 is not set
-# CONFIG_ADM5120_MACH_RB_153 is not set
-# CONFIG_ADM5120_MACH_RB_192 is not set
-CONFIG_ADM5120_MACH_WP54=y
-CONFIG_ADM5120_OEM_CELLVISION=y
-CONFIG_ADM5120_OEM_COMPEX=y
-CONFIG_ADM5120_OEM_EDIMAX=y
-CONFIG_ADM5120_OEM_GENERIC=y
-CONFIG_ADM5120_OEM_INFINEON=y
-# CONFIG_ADM5120_OEM_MIKROTIK is not set
-CONFIG_ADM5120_OEM_MOTOROLA=y
-CONFIG_ADM5120_OEM_OSBRIDGE=y
-# CONFIG_ADM5120_OEM_ZYXEL is not set
-CONFIG_ADM5120_SOC_BGA=y
-CONFIG_ADM5120_WDT=y
-CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
-CONFIG_ARCH_DISCARD_MEMBLOCK=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-# CONFIG_ARCH_HAS_SG_CHAIN is not set
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARM_AMBA=y
-CONFIG_BUILD_BIN2C=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CEVT_R4K=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyAM0,115200 rootfstype=squashfs,jffs2"
-CONFIG_CMDLINE_BOOL=y
-# CONFIG_CMDLINE_OVERRIDE is not set
-# CONFIG_CPU_BIG_ENDIAN is not set
-CONFIG_CPU_GENERIC_DUMP_TLB=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_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y
-CONFIG_CPU_R4K_CACHE_TLB=y
-CONFIG_CPU_R4K_FPU=y
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-CONFIG_CSRC_R4K=y
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_FIRMWARE_IN_KERNEL=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_HARDWARE_WATCHPOINTS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=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_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HW_HAS_PCI=y
-CONFIG_HW_RANDOM=y
-CONFIG_HZ=250
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set
-CONFIG_IRQ_CPU=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-# CONFIG_LEDS_TRIGGER_ADM5120_SWITCH is not set
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-CONFIG_MIPS=y
-# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-CONFIG_MIPS_MACHINE=y
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MTD_ADM5120=y
-CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC=y
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_JEDECPROBE=y
-CONFIG_MTD_MYLOADER_PARTS=y
-CONFIG_MTD_TRXSPLIT=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NO_EXCEPT_FILL=y
-CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
-CONFIG_NO_HZ=y
-CONFIG_NO_HZ_COMMON=y
-CONFIG_NO_HZ_IDLE=y
-# CONFIG_NO_IOPORT_MAP is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_PCI=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PERF_USE_VMALLOC=y
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_RCU_STALL_COMMON 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_PL011 is not set
-CONFIG_SERIO=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SWAP is not set
-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_BIG_ENDIAN=y
-CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_USB_SUPPORT=y
-CONFIG_WATCHDOG_CORE=y
-CONFIG_ZONE_DMA_FLAG=0
+++ /dev/null
-if ADM5120
-
-menu "ADM5120 Board selection"
-
-config ADM5120_MACH_CAS_771
- bool "Cellvision CAS-771/771W support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_CELLVISION
- default y
-
-config ADM5120_MACH_NFS_101
- bool "Cellvision NFS-101U/101WU support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_CELLVISION
- default y
-
-config ADM5120_MACH_NP27G
- bool "Compex NP27G support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_COMPEX
- default y
-
-config ADM5120_MACH_NP28G
- bool "Compex NP28G support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_COMPEX
- default y
-
-config ADM5120_MACH_WP54
- bool "Compex WP54 family support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_COMPEX
- default y
-
-config ADM5120_MACH_EB_214A
- bool "EB-214A support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_GENERIC
- default y
-
-config ADM5120_MACH_BR_6104K
- bool "Edimax BR-6104K support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_OEM_EDIMAX
- default y
-
-config ADM5120_MACH_BR_6104KP
- bool "Edimax BR-6104KP support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_OEM_EDIMAX
- default y
-
-config ADM5120_MACH_BR_61X4WG
- bool "Edimax BR-6104WG/6114WG support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_EDIMAX
- default y
-
-config ADM5120_MACH_EASY5120_RT
- bool "Infineon EASY 5120-RT Reference Board support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_INFINEON
- default y
-
-config ADM5120_MACH_EASY5120_WVOIP
- bool "Infineon EASY 5120-WVoIP Reference Board support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_INFINEON
- default y
-
-config ADM5120_MACH_EASY5120P_ATA
- bool "Infineon EASY 5120P-ATA Reference Board support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_OEM_INFINEON
- default y
-
-config ADM5120_MACH_EASY83000
- bool "Infineon EASY 83000 Reference Board support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_OEM_INFINEON
- default y
-
-config ADM5120_MACH_RB_11X
- bool "MikroTik RouterBOARD 111/112 support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_MIKROTIK
- default y
-
-config ADM5120_MACH_RB_133
- bool "MikroTik RouterBOARD 133 support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_MIKROTIK
- default y
-
-config ADM5120_MACH_RB_133C
- bool "MikroTik RouterBOARD 133C support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_MIKROTIK
- default y
-
-config ADM5120_MACH_RB_150
- bool "MikroTik RouterBOARD 150 support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_OEM_MIKROTIK
- default y
-
-config ADM5120_MACH_RB_153
- bool "MikroTik RouterBOARD 153 support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_MIKROTIK
- default y
-
-config ADM5120_MACH_RB_192
- bool "MikroTik RouterBOARD 192 support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_MIKROTIK
- default y
-
-config ADM5120_MACH_PMUGW
- bool "Motorola Powerline MU Gateway"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_MOTOROLA
- default y
-
-config ADM5120_MACH_5GXI
- bool "OSBRiDGE 5GXi/5XLi support"
- depends on CPU_LITTLE_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_OSBRIDGE
- default y
-
-config ADM5120_MACH_P_334WT
- bool "ZyXEL Prestige 334WT"
- depends on CPU_BIG_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_ZYXEL
- default y
-
-config ADM5120_MACH_P_335
- bool "ZyXEL Prestige 335/335WT"
- depends on CPU_BIG_ENDIAN
- select ADM5120_SOC_BGA
- select ADM5120_OEM_ZYXEL
- default y
-
-endmenu
-
-config ADM5120_SOC_BGA
- select HW_HAS_PCI
- def_bool n
-
-config ADM5120_OEM_CELLVISION
- def_bool n
-
-config ADM5120_OEM_COMPEX
- def_bool n
-
-config ADM5120_OEM_EDIMAX
- def_bool n
-
-config ADM5120_OEM_GENERIC
- def_bool n
-
-config ADM5120_OEM_INFINEON
- def_bool n
-
-config ADM5120_OEM_MIKROTIK
- def_bool n
-
-config ADM5120_OEM_MOTOROLA
- def_bool n
-
-config ADM5120_OEM_OSBRIDGE
- def_bool n
-
-config ADM5120_OEM_ZYXEL
- def_bool n
-
-config ARM_AMBA
- def_bool y
-
-endif
+++ /dev/null
-#
-# Infineon/ADMtek ADM5120
-#
-
-platform-$(CONFIG_ADM5120) += adm5120/common/
-
-platform-$(CONFIG_ADM5120_OEM_CELLVISION) += adm5120/cellvision/
-platform-$(CONFIG_ADM5120_OEM_COMPEX) += adm5120/compex/
-platform-$(CONFIG_ADM5120_OEM_EDIMAX) += adm5120/edimax/
-platform-$(CONFIG_ADM5120_OEM_GENERIC) += adm5120/generic/
-platform-$(CONFIG_ADM5120_OEM_INFINEON) += adm5120/infineon/
-platform-$(CONFIG_ADM5120_OEM_MIKROTIK) += adm5120/mikrotik/
-platform-$(CONFIG_ADM5120_OEM_MOTOROLA) += adm5120/motorola/
-platform-$(CONFIG_ADM5120_OEM_OSBRIDGE) += adm5120/osbridge/
-platform-$(CONFIG_ADM5120_OEM_ZYXEL) += adm5120/zyxel/
-
-cflags-$(CONFIG_ADM5120) += -I$(srctree)/arch/mips/include/asm/mach-adm5120
-libs-$(CONFIG_ADM5120) += arch/mips/adm5120/prom/
-load-$(CONFIG_ADM5120) += 0xffffffff80001000
+++ /dev/null
-obj-y += cellvision.o
-
-obj-$(CONFIG_ADM5120_MACH_CAS_771) += cas-771.o
-obj-$(CONFIG_ADM5120_MACH_NFS_101) += nfs-101.o
+++ /dev/null
-/*
- * Cellvision/SparkLAN CAS-771/771W support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "cellvision.h"
-
-static struct adm5120_pci_irq cas771_pci_irqs[] __initdata = {
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
- PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1),
- PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2)
-};
-
-static struct gpio_led cas771_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN0, "cam_flash", NULL),
- /* GPIO PIN3 is the reset */
- GPIO_LED_STD(ADM5120_GPIO_PIN6, "access", NULL),
- GPIO_LED_STD(ADM5120_GPIO_P0L1, "status", NULL),
- GPIO_LED_STD(ADM5120_GPIO_P0L2, "diag", NULL),
-};
-
-static void __init cas771_setup(void)
-{
- cas7xx_setup();
- adm5120_add_device_gpio_leds(ARRAY_SIZE(cas771_gpio_leds),
- cas771_gpio_leds);
- adm5120_pci_set_irq_map(ARRAY_SIZE(cas771_pci_irqs), cas771_pci_irqs);
-}
-
-MIPS_MACHINE(MACH_ADM5120_CAS771, "CAS-771", "Cellvision CAS-771/771W",
- cas771_setup);
+++ /dev/null
-/*
- * Cellvision/SparkLAN boards
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "cellvision.h"
-
-#include <prom/admboot.h>
-
-#define CELLVISION_GPIO_FLASH_A20 ADM5120_GPIO_PIN5
-#define CELLVISION_GPIO_DEV_MASK (1 << CELLVISION_GPIO_FLASH_A20)
-
-#define CELLVISION_CONFIG_OFFSET 0x8000
-#define CELLVISION_CONFIG_SIZE 0x1000
-
-static struct mtd_partition cas6xx_partitions[] = {
- {
- .name = "admboot",
- .offset = 0,
- .size = 32*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "config",
- .offset = MTDPART_OFS_APPEND,
- .size = 32*1024,
- } , {
- .name = "nvfs1",
- .offset = MTDPART_OFS_APPEND,
- .size = 64*1024,
- } , {
- .name = "nvfs2",
- .offset = MTDPART_OFS_APPEND,
- .size = 64*1024,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static struct mtd_partition cas7xx_partitions[] = {
- {
- .name = "admboot",
- .offset = 0,
- .size = 32*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "config",
- .offset = MTDPART_OFS_APPEND,
- .size = 32*1024,
- } , {
- .name = "nvfs",
- .offset = MTDPART_OFS_APPEND,
- .size = 128*1024,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static void switch_bank_gpio5(unsigned bank)
-{
- switch (bank) {
- case 0:
- gpio_set_value(CELLVISION_GPIO_FLASH_A20, 0);
- break;
- case 1:
- gpio_set_value(CELLVISION_GPIO_FLASH_A20, 1);
- break;
- }
-}
-
-static void __init cellvision_flash_setup(void)
-{
- /* setup flash A20 line */
- gpio_request(CELLVISION_GPIO_FLASH_A20, NULL);
- gpio_direction_output(CELLVISION_GPIO_FLASH_A20, 0);
-
- adm5120_flash0_data.switch_bank = switch_bank_gpio5;
- adm5120_add_device_flash(0);
-}
-
-void __init cellvision_mac_setup(void)
-{
- u8 mac_base[6];
- int err;
-
- err = admboot_get_mac_base(CELLVISION_CONFIG_OFFSET,
- CELLVISION_CONFIG_SIZE, mac_base);
-
- if ((err) || !is_valid_ether_addr(mac_base))
- random_ether_addr(mac_base);
-
- adm5120_setup_eth_macs(mac_base);
-}
-
-void __init cas6xx_flash_setup(void)
-{
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions);
- adm5120_flash0_data.parts = cas6xx_partitions;
-
- cellvision_flash_setup();
-}
-
-void __init cas7xx_flash_setup(void)
-{
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions);
- adm5120_flash0_data.parts = cas7xx_partitions;
-
- cellvision_flash_setup();
-}
-
-void __init cas6xx_setup(void)
-{
- cas6xx_flash_setup();
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
- adm5120_add_device_switch(1, NULL);
-}
-
-MIPS_MACHINE(MACH_ADM5120_CAS630, "CAS-630", "Cellvision CAS-630/630W",
- cas6xx_setup);
-MIPS_MACHINE(MACH_ADM5120_CAS670, "CAS-670", "Cellvision CAS-670/670W",
- cas6xx_setup);
-
-void __init cas7xx_setup(void)
-{
- cas7xx_flash_setup();
- cellvision_mac_setup();
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
- adm5120_add_device_switch(1, NULL);
-}
-
-MIPS_MACHINE(MACH_ADM5120_CAS700, "CAS-700", "Cellvision CAS-700/700W",
- cas7xx_setup);
-MIPS_MACHINE(MACH_ADM5120_CAS790, "CAS-790", "Cellvision CAS-790",
- cas7xx_setup);
-MIPS_MACHINE(MACH_ADM5120_CAS861, "CAS-861", "Cellvision CAS-861/861W",
- cas7xx_setup);
+++ /dev/null
-/*
- * Cellvision/SparkLAN boards
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-extern void cellvision_mac_setup(void) __init;
-
-extern void cas6xx_flash_setup(void) __init;
-extern void cas7xx_flash_setup(void) __init;
-extern void cas6xx_setup(void) __init;
-extern void cas7xx_setup(void) __init;
+++ /dev/null
-/*
- * Cellvision/SparkLAN NFS-101U/WU support
- *
- * Copyright (C) 2007-2009 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "cellvision.h"
-
-static struct adm5120_pci_irq nfs101_pci_irqs[] __initdata = {
- /* miniPCI slot */
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
-
- /* ALi USB controller */
- PCIIRQ(3, 0, 2, ADM5120_IRQ_PCI2),
- PCIIRQ(3, 3, 1, ADM5120_IRQ_PCI1),
-
- /* NEC USB controller */
- PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI1),
- PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI2),
- PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2),
-};
-
-static u8 nfs101_vlans[6] __initdata = {
- /* FIXME: not tested */
- 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static void __init nfs101_setup(void)
-{
- cas6xx_flash_setup();
- cellvision_mac_setup();
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
- adm5120_add_device_switch(1, nfs101_vlans);
-
- adm5120_pci_set_irq_map(ARRAY_SIZE(nfs101_pci_irqs),
- nfs101_pci_irqs);
-}
-
-MIPS_MACHINE(MACH_ADM5120_NFS101U, "NFS-101U", "Cellvision NFS-101U/101WU",
- nfs101_setup);
+++ /dev/null
-#
-# Makefile for the Infineon/ADMtek ADM5120 SoC specific parts of the kernel
-#
-
-obj-y := adm5120.o setup.o prom.o irq.o memory.o clock.o \
- gpio.o platform.o
-
-obj-$(CONFIG_EARLY_PRINTK) += early-printk.o
+++ /dev/null
-/*
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/io.h>
-
-#include <asm/addrspace.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-
-unsigned int adm5120_product_code;
-unsigned int adm5120_revision;
-unsigned int adm5120_package;
-unsigned int adm5120_nand_boot;
-unsigned long adm5120_speed;
-
-/*
- * CPU settings detection
- */
-#define CODE_GET_PC(c) ((c) & CODE_PC_MASK)
-#define CODE_GET_REV(c) (((c) >> CODE_REV_SHIFT) & CODE_REV_MASK)
-#define CODE_GET_PK(c) (((c) >> CODE_PK_SHIFT) & CODE_PK_MASK)
-#define CODE_GET_CLKS(c) (((c) >> CODE_CLKS_SHIFT) & CODE_CLKS_MASK)
-#define CODE_GET_NAB(c) (((c) & CODE_NAB) != 0)
-
-void adm5120_ndelay(u32 ns)
-{
- u32 t;
-
- SW_WRITE_REG(SWITCH_REG_TIMER, TIMER_PERIOD_DEFAULT);
- SW_WRITE_REG(SWITCH_REG_TIMER_INT, (TIMER_INT_TOS | TIMER_INT_TOM));
-
- t = (ns+640) / 640;
- t &= TIMER_PERIOD_MASK;
- SW_WRITE_REG(SWITCH_REG_TIMER, t | TIMER_TE);
-
- /* wait until the timer expires */
- do {
- t = SW_READ_REG(SWITCH_REG_TIMER_INT);
- } while ((t & TIMER_INT_TOS) == 0);
-
- /* leave the timer disabled */
- SW_WRITE_REG(SWITCH_REG_TIMER, TIMER_PERIOD_DEFAULT);
- SW_WRITE_REG(SWITCH_REG_TIMER_INT, (TIMER_INT_TOS | TIMER_INT_TOM));
-}
-
-void __init adm5120_soc_init(void)
-{
- u32 code;
- u32 clks;
-
- code = SW_READ_REG(SWITCH_REG_CODE);
-
- adm5120_product_code = CODE_GET_PC(code);
- adm5120_revision = CODE_GET_REV(code);
- adm5120_package = (CODE_GET_PK(code) == CODE_PK_BGA) ?
- ADM5120_PACKAGE_BGA : ADM5120_PACKAGE_PQFP;
- adm5120_nand_boot = CODE_GET_NAB(code);
-
- clks = CODE_GET_CLKS(code);
- adm5120_speed = ADM5120_SPEED_175;
- if (clks & 1)
- adm5120_speed += 25000000;
- if (clks & 2)
- adm5120_speed += 50000000;
-}
+++ /dev/null
-/*
- * ADM5120 minimal CLK API implementation
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was based on the CLK API implementation in:
- * arch/mips/tx4938/toshiba_rbtx4938/setup.c
- * Copyright (C) 2000-2001 Toshiba Corporation
- * 2003-2005 (c) MontaVista Software, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/device.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-
-struct clk {
- unsigned long rate;
-};
-
-static struct clk uart_clk = {
- .rate = ADM5120_UART_CLOCK
-};
-
-struct clk *clk_get(struct device *dev, const char *id)
-{
- const char *name = dev_name(dev);
-
- if (!strcmp(name, "apb:uart0") || !strcmp(name, "apb:uart1"))
- return &uart_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);
+++ /dev/null
-/*
- * ADM5120 specific early printk support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/init.h>
-#include <linux/io.h>
-
-#include <asm/addrspace.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_uart.h>
-
-#define UART_READ(r) \
- __raw_readl((void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r)))
-#define UART_WRITE(r, v) \
- __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r)))
-
-void __init prom_putchar(char ch)
-{
- while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0)
- ;
- UART_WRITE(UART_REG_DATA, ch);
- while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0)
- ;
-}
+++ /dev/null
-/*
- * ADM5120 generic GPIO API support via GPIOLIB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/module.h>
-#include <linux/irq.h>
-#include <linux/delay.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-
-#include <asm/addrspace.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-
-#define GPIO_REG(r) (void __iomem *)(KSEG1ADDR(ADM5120_SWITCH_BASE) + r)
-
-struct gpio1_desc {
- void __iomem *reg; /* register address */
- u8 iv_shift; /* shift amount for input bit */
- u8 mode_shift; /* shift amount for mode bits */
-};
-
-#define GPIO1_DESC(p, l) { \
- .reg = GPIO_REG(SWITCH_REG_PORT0_LED + ((p) * 4)), \
- .iv_shift = LED0_IV_SHIFT + (l), \
- .mode_shift = (l) * 4 \
- }
-
-static struct gpio1_desc gpio1_table[15] = {
- GPIO1_DESC(0, 0), GPIO1_DESC(0, 1), GPIO1_DESC(0, 2),
- GPIO1_DESC(1, 0), GPIO1_DESC(1, 1), GPIO1_DESC(1, 2),
- GPIO1_DESC(2, 0), GPIO1_DESC(2, 1), GPIO1_DESC(2, 2),
- GPIO1_DESC(3, 0), GPIO1_DESC(3, 1), GPIO1_DESC(3, 2),
- GPIO1_DESC(4, 0), GPIO1_DESC(4, 1), GPIO1_DESC(4, 2)
-};
-
-static u32 gpio_conf2;
-
-int adm5120_gpio_to_irq(unsigned gpio)
-{
- int ret;
-
- switch (gpio) {
- case ADM5120_GPIO_PIN2:
- ret = ADM5120_IRQ_GPIO2;
- break;
- case ADM5120_GPIO_PIN4:
- ret = ADM5120_IRQ_GPIO4;
- break;
- default:
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-EXPORT_SYMBOL(adm5120_gpio_to_irq);
-
-int adm5120_irq_to_gpio(unsigned irq)
-{
- int ret;
-
- switch (irq) {
- case ADM5120_IRQ_GPIO2:
- ret = ADM5120_GPIO_PIN2;
- break;
- case ADM5120_IRQ_GPIO4:
- ret = ADM5120_GPIO_PIN4;
- break;
- default:
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-EXPORT_SYMBOL(adm5120_irq_to_gpio);
-
-/*
- * Helpers for GPIO lines in GPIO_CONF0 register
- */
-#define PIN_IM(p) ((1 << GPIO_CONF0_IM_SHIFT) << p)
-#define PIN_IV(p) ((1 << GPIO_CONF0_IV_SHIFT) << p)
-#define PIN_OE(p) ((1 << GPIO_CONF0_OE_SHIFT) << p)
-#define PIN_OV(p) ((1 << GPIO_CONF0_OV_SHIFT) << p)
-
-int __adm5120_gpio0_get_value(unsigned offset)
-{
- void __iomem **reg;
- u32 t;
-
- reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
-
- t = __raw_readl(reg);
- if ((t & PIN_IM(offset)) != 0)
- t &= PIN_IV(offset);
- else
- t &= PIN_OV(offset);
-
- return (t) ? 1 : 0;
-}
-EXPORT_SYMBOL(__adm5120_gpio0_get_value);
-
-void __adm5120_gpio0_set_value(unsigned offset, int value)
-{
- void __iomem **reg;
- u32 t;
-
- reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
-
- t = __raw_readl(reg);
- if (value == 0)
- t &= ~(PIN_OV(offset));
- else
- t |= PIN_OV(offset);
-
- __raw_writel(t, reg);
-}
-EXPORT_SYMBOL(__adm5120_gpio0_set_value);
-
-static int adm5120_gpio0_get_value(struct gpio_chip *chip, unsigned offset)
-{
- return __adm5120_gpio0_get_value(offset);
-}
-
-static void adm5120_gpio0_set_value(struct gpio_chip *chip,
- unsigned offset, int value)
-{
- __adm5120_gpio0_set_value(offset, value);
-}
-
-static int adm5120_gpio0_direction_input(struct gpio_chip *chip,
- unsigned offset)
-{
- void __iomem **reg;
- u32 t;
-
- reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
-
- t = __raw_readl(reg);
- t &= ~(PIN_OE(offset));
- t |= PIN_IM(offset);
- __raw_writel(t, reg);
-
- return 0;
-}
-
-static int adm5120_gpio0_direction_output(struct gpio_chip *chip,
- unsigned offset, int value)
-{
- void __iomem **reg;
- u32 t;
-
- reg = GPIO_REG(SWITCH_REG_GPIO_CONF0);
-
- t = __raw_readl(reg);
- t &= ~(PIN_IM(offset) | PIN_OV(offset));
- t |= PIN_OE(offset);
-
- if (value)
- t |= PIN_OV(offset);
-
- __raw_writel(t, reg);
-
- return 0;
-}
-
-static struct gpio_chip adm5120_gpio0_chip = {
- .label = "adm5120 gpio0",
- .get = adm5120_gpio0_get_value,
- .set = adm5120_gpio0_set_value,
- .direction_input = adm5120_gpio0_direction_input,
- .direction_output = adm5120_gpio0_direction_output,
- .base = ADM5120_GPIO_PIN0,
- .ngpio = ADM5120_GPIO_PIN7 - ADM5120_GPIO_PIN0 + 1,
-};
-
-int __adm5120_gpio1_get_value(unsigned offset)
-{
- void __iomem **reg;
- u32 t, m;
-
- reg = gpio1_table[offset].reg;
-
- t = __raw_readl(reg);
- m = (t >> gpio1_table[offset].mode_shift) & LED_MODE_MASK;
- if (m == LED_MODE_INPUT)
- return (t >> gpio1_table[offset].iv_shift) & 1;
-
- if (m == LED_MODE_OUT_LOW)
- return 0;
-
- return 1;
-}
-EXPORT_SYMBOL(__adm5120_gpio1_get_value);
-
-void __adm5120_gpio1_set_value(unsigned offset, int value)
-{
- void __iomem **reg;
- u32 t, s;
-
- reg = gpio1_table[offset].reg;
- s = gpio1_table[offset].mode_shift;
-
- t = __raw_readl(reg);
- t &= ~(LED_MODE_MASK << s);
-
- switch (value) {
- case ADM5120_GPIO_LOW:
- t |= (LED_MODE_OUT_LOW << s);
- break;
- case ADM5120_GPIO_FLASH:
- case ADM5120_GPIO_LINK:
- case ADM5120_GPIO_SPEED:
- case ADM5120_GPIO_DUPLEX:
- case ADM5120_GPIO_ACT:
- case ADM5120_GPIO_COLL:
- case ADM5120_GPIO_LINK_ACT:
- case ADM5120_GPIO_DUPLEX_COLL:
- case ADM5120_GPIO_10M_ACT:
- case ADM5120_GPIO_100M_ACT:
- t |= ((value & LED_MODE_MASK) << s);
- break;
- default:
- t |= (LED_MODE_OUT_HIGH << s);
- break;
- }
-
- __raw_writel(t, reg);
-}
-EXPORT_SYMBOL(__adm5120_gpio1_set_value);
-
-static int adm5120_gpio1_get_value(struct gpio_chip *chip, unsigned offset)
-{
- return __adm5120_gpio1_get_value(offset);
-}
-
-static void adm5120_gpio1_set_value(struct gpio_chip *chip,
- unsigned offset, int value)
-{
- __adm5120_gpio1_set_value(offset, value);
-}
-
-static int adm5120_gpio1_direction_input(struct gpio_chip *chip,
- unsigned offset)
-{
- void __iomem **reg;
- u32 t;
-
- reg = gpio1_table[offset].reg;
- t = __raw_readl(reg);
- t &= ~(LED_MODE_MASK << gpio1_table[offset].mode_shift);
- __raw_writel(t, reg);
-
- return 0;
-}
-
-static int adm5120_gpio1_direction_output(struct gpio_chip *chip,
- unsigned offset, int value)
-{
- __adm5120_gpio1_set_value(offset, value);
- return 0;
-}
-
-static struct gpio_chip adm5120_gpio1_chip = {
- .label = "adm5120 gpio1",
- .get = adm5120_gpio1_get_value,
- .set = adm5120_gpio1_set_value,
- .direction_input = adm5120_gpio1_direction_input,
- .direction_output = adm5120_gpio1_direction_output,
- .base = ADM5120_GPIO_P0L0,
- .ngpio = ADM5120_GPIO_P4L2 - ADM5120_GPIO_P0L0 + 1,
-};
-
-void __init adm5120_gpio_csx0_enable(void)
-{
- gpio_conf2 |= GPIO_CONF2_CSX0;
- SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2);
-
- gpio_request(ADM5120_GPIO_PIN1, "CSX0");
-}
-
-void __init adm5120_gpio_csx1_enable(void)
-{
- gpio_conf2 |= GPIO_CONF2_CSX1;
- SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2);
-
- gpio_request(ADM5120_GPIO_PIN3, "CSX1");
-}
-
-void __init adm5120_gpio_ew_enable(void)
-{
- gpio_conf2 |= GPIO_CONF2_EW;
- SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2);
-
- gpio_request(ADM5120_GPIO_PIN0, "EW");
-}
-
-void __init adm5120_gpio_init(void)
-{
- int err;
-
- SW_WRITE_REG(SWITCH_REG_GPIO_CONF2, gpio_conf2);
-
- if (adm5120_package_pqfp())
- adm5120_gpio0_chip.ngpio = 4;
-
- err = gpiochip_add(&adm5120_gpio0_chip);
- if (err)
- panic("cannot add ADM5120 GPIO0 chip, error=%d", err);
-
- err = gpiochip_add(&adm5120_gpio1_chip);
- if (err)
- panic("cannot add ADM5120 GPIO1 chip, error=%d", err);
-
-}
+++ /dev/null
-/*
- * ADM5120 specific interrupt handlers
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/irq.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/io.h>
-#include <linux/bitops.h>
-
-#include <asm/irq_cpu.h>
-#include <asm/mipsregs.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-
-static void adm5120_intc_irq_unmask(struct irq_data *d);
-static void adm5120_intc_irq_mask(struct irq_data *d);
-static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type);
-
-static inline void intc_write_reg(unsigned int reg, u32 val)
-{
- void __iomem *base = (void __iomem *)KSEG1ADDR(ADM5120_INTC_BASE);
-
- __raw_writel(val, base + reg);
-}
-
-static inline u32 intc_read_reg(unsigned int reg)
-{
- void __iomem *base = (void __iomem *)KSEG1ADDR(ADM5120_INTC_BASE);
-
- return __raw_readl(base + reg);
-}
-
-static struct irq_chip adm5120_intc_irq_chip = {
- .name = "INTC",
- .irq_unmask = adm5120_intc_irq_unmask,
- .irq_mask = adm5120_intc_irq_mask,
- .irq_mask_ack = adm5120_intc_irq_mask,
- .irq_set_type = adm5120_intc_irq_set_type
-};
-
-static struct irqaction adm5120_intc_irq_action = {
- .handler = no_action,
- .name = "cascade [INTC]"
-};
-
-static void adm5120_intc_irq_unmask(struct irq_data *d)
-{
- intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
-}
-
-static void adm5120_intc_irq_mask(struct irq_data *d)
-{
- intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
-}
-
-static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type)
-{
- unsigned int irq = d->irq;
- unsigned int sense;
- unsigned long mode;
- int err = 0;
-
- sense = flow_type & (IRQ_TYPE_SENSE_MASK);
- switch (sense) {
- case IRQ_TYPE_NONE:
- case IRQ_TYPE_LEVEL_HIGH:
- break;
- case IRQ_TYPE_LEVEL_LOW:
- switch (irq) {
- case ADM5120_IRQ_GPIO2:
- case ADM5120_IRQ_GPIO4:
- break;
- default:
- err = -EINVAL;
- break;
- }
- break;
- default:
- err = -EINVAL;
- break;
- }
-
- if (err)
- return err;
-
- switch (irq) {
- case ADM5120_IRQ_GPIO2:
- case ADM5120_IRQ_GPIO4:
- mode = intc_read_reg(INTC_REG_INT_MODE);
- if (sense == IRQ_TYPE_LEVEL_LOW)
- mode |= (1 << (irq - ADM5120_INTC_IRQ_BASE));
- else
- mode &= ~(1 << (irq - ADM5120_INTC_IRQ_BASE));
-
- intc_write_reg(INTC_REG_INT_MODE, mode);
- break;
- }
-
- return 0;
-}
-
-static void adm5120_intc_irq_dispatch(void)
-{
- unsigned long status;
- int irq;
-
- status = intc_read_reg(INTC_REG_IRQ_STATUS) & INTC_INT_ALL;
- if (status) {
- irq = ADM5120_INTC_IRQ_BASE + fls(status) - 1;
- do_IRQ(irq);
- } else
- spurious_interrupt();
-}
-
-asmlinkage void plat_irq_dispatch(void)
-{
- unsigned long pending;
-
- pending = read_c0_status() & read_c0_cause() & ST0_IM;
-
- if (pending & STATUSF_IP7)
- do_IRQ(ADM5120_IRQ_COUNTER);
- else if (pending & STATUSF_IP2)
- adm5120_intc_irq_dispatch();
- else
- spurious_interrupt();
-}
-
-#define INTC_IRQ_STATUS (IRQ_LEVEL | IRQ_TYPE_LEVEL_HIGH | IRQ_DISABLED)
-static void __init adm5120_intc_irq_init(void)
-{
- int i;
-
- /* disable all interrupts */
- intc_write_reg(INTC_REG_IRQ_DISABLE, INTC_INT_ALL);
-
- /* setup all interrupts to generate IRQ instead of FIQ */
- intc_write_reg(INTC_REG_INT_MODE, 0);
-
- /* set active level for all external interrupts to HIGH */
- intc_write_reg(INTC_REG_INT_LEVEL, 0);
-
- /* disable usage of the TEST_SOURCE register */
- intc_write_reg(INTC_REG_IRQ_SOURCE_SELECT, 0);
-
- for (i = ADM5120_INTC_IRQ_BASE;
- i <= ADM5120_INTC_IRQ_BASE + INTC_IRQ_LAST;
- i++) {
- irq_set_chip_and_handler(i, &adm5120_intc_irq_chip,
- handle_level_irq);
- }
-
- setup_irq(ADM5120_IRQ_INTC, &adm5120_intc_irq_action);
-}
-
-void __init arch_init_irq(void)
-{
- mips_cpu_irq_init();
- adm5120_intc_irq_init();
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-
-#include <asm/bootinfo.h>
-#include <asm/addrspace.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-#include <asm/mach-adm5120/adm5120_mpmc.h>
-
-#ifdef DEBUG
-# define mem_dbg(f, a...) printk(KERN_INFO "mem_detect: " f, ## a)
-#else
-# define mem_dbg(f, a...)
-#endif
-
-unsigned long adm5120_memsize;
-
-#define MEM_READL(a) __raw_readl((void __iomem *)(a))
-#define MEM_WRITEL(a, v) __raw_writel((v), (void __iomem *)(a))
-
-static int __init mem_check_pattern(u8 *addr, unsigned long offs)
-{
- u32 *p1 = (u32 *)addr;
- u32 *p2 = (u32 *)(addr+offs);
- u32 t, u, v;
-
- /* save original value */
- t = MEM_READL(p1);
-
- u = MEM_READL(p2);
- if (t != u)
- return 0;
-
- v = 0x55555555;
- if (u == v)
- v = 0xAAAAAAAA;
-
- mem_dbg("write 0x%08X to 0x%08lX\n", v, (unsigned long)p1);
-
- MEM_WRITEL(p1, v);
- adm5120_ndelay(1000);
- u = MEM_READL(p2);
-
- mem_dbg("pattern at 0x%08lX is 0x%08X\n", (unsigned long)p2, u);
-
- /* restore original value */
- MEM_WRITEL(p1, t);
-
- return (v == u);
-}
-
-static void __init adm5120_detect_memsize(void)
-{
- u32 memctrl;
- u32 size, maxsize;
- u8 *p;
-
- memctrl = SW_READ_REG(SWITCH_REG_MEMCTRL);
- switch (memctrl & MEMCTRL_SDRS_MASK) {
- case MEMCTRL_SDRS_4M:
- maxsize = 4 << 20;
- break;
- case MEMCTRL_SDRS_8M:
- maxsize = 8 << 20;
- break;
- case MEMCTRL_SDRS_16M:
- maxsize = 16 << 20;
- break;
- default:
- maxsize = 64 << 20;
- break;
- }
-
- mem_dbg("checking for %uMB chip in 1st bank\n", maxsize >> 20);
-
- /* detect size of the 1st SDRAM bank */
- p = (u8 *)KSEG1ADDR(0);
- for (size = 2<<20; size <= (maxsize >> 1); size <<= 1) {
- if (mem_check_pattern(p, size)) {
- /* mirrored address */
- mem_dbg("mirrored data found at offset 0x%08X\n", size);
- break;
- }
- }
-
- mem_dbg("chip size in 1st bank is %uMB\n", size >> 20);
- adm5120_memsize = size;
-
- if (size != maxsize)
- /* 2nd bank is not supported */
- goto out;
-
- if ((memctrl & MEMCTRL_SDR1_ENABLE) == 0)
- /* 2nd bank is disabled */
- goto out;
-
- /*
- * some bootloaders enable 2nd bank, even if the 2nd SDRAM chip
- * are missing.
- */
- mem_dbg("check presence of 2nd bank\n");
-
- p = (u8 *)KSEG1ADDR(maxsize+size-4);
- if (mem_check_pattern(p, 0))
- adm5120_memsize += size;
-
- if (maxsize != size) {
- /* adjusting MECTRL register */
- memctrl &= ~(MEMCTRL_SDRS_MASK);
- switch (size>>20) {
- case 4:
- memctrl |= MEMCTRL_SDRS_4M;
- break;
- case 8:
- memctrl |= MEMCTRL_SDRS_8M;
- break;
- case 16:
- memctrl |= MEMCTRL_SDRS_16M;
- break;
- default:
- memctrl |= MEMCTRL_SDRS_64M;
- break;
- }
- SW_WRITE_REG(SWITCH_REG_MEMCTRL, memctrl);
- }
-
-out:
- mem_dbg("%dx%uMB memory found\n", (adm5120_memsize == size) ? 1 : 2 ,
- size>>20);
-}
-
-void __init adm5120_mem_init(void)
-{
- adm5120_detect_memsize();
- add_memory_region(0, adm5120_memsize, BOOT_MEM_RAM);
-}
+++ /dev/null
-/*
- * ADM5120 generic platform devices
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/list.h>
-#include <linux/device.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/slab.h>
-#include <linux/export.h>
-
-#include <asm/bootinfo.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-#include <asm/mach-adm5120/adm5120_nand.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-#if 1
-/*
- * TODO:remove global adm5120_eth* variables when the switch driver will be
- * converted into a real platform driver
- */
-unsigned int adm5120_eth_num_ports = 6;
-EXPORT_SYMBOL_GPL(adm5120_eth_num_ports);
-
-unsigned char adm5120_eth_macs[6][6] = {
- {'\00', 'A', 'D', 'M', '\x51', '\x20' },
- {'\00', 'A', 'D', 'M', '\x51', '\x21' },
- {'\00', 'A', 'D', 'M', '\x51', '\x22' },
- {'\00', 'A', 'D', 'M', '\x51', '\x23' },
- {'\00', 'A', 'D', 'M', '\x51', '\x24' },
- {'\00', 'A', 'D', 'M', '\x51', '\x25' }
-};
-EXPORT_SYMBOL_GPL(adm5120_eth_macs);
-
-unsigned char adm5120_eth_vlans[6] = {
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x60
-};
-EXPORT_SYMBOL_GPL(adm5120_eth_vlans);
-#endif
-
-void __init adm5120_setup_eth_macs(u8 *mac_base)
-{
- u32 t;
- int i, j;
-
- t = ((u32) mac_base[3] << 16) | ((u32) mac_base[4] << 8)
- | ((u32) mac_base[5]);
-
- for (i = 0; i < ARRAY_SIZE(adm5120_eth_macs); i++) {
- for (j = 0; j < 3; j++)
- adm5120_eth_macs[i][j] = mac_base[j];
-
- adm5120_eth_macs[i][3] = (t >> 16) & 0xff;
- adm5120_eth_macs[i][4] = (t >> 8) & 0xff;
- adm5120_eth_macs[i][5] = t & 0xff;
-
- t++;
- }
-}
-
-/*
- * Built-in ethernet switch
- */
-struct resource adm5120_switch_resources[] = {
- [0] = {
- .start = ADM5120_SWITCH_BASE,
- .end = ADM5120_SWITCH_BASE+ADM5120_SWITCH_SIZE-1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = ADM5120_IRQ_SWITCH,
- .end = ADM5120_IRQ_SWITCH,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-struct adm5120_switch_platform_data adm5120_switch_data;
-struct platform_device adm5120_switch_device = {
- .name = "adm5120-switch",
- .id = -1,
- .num_resources = ARRAY_SIZE(adm5120_switch_resources),
- .resource = adm5120_switch_resources,
- .dev.platform_data = &adm5120_switch_data,
-};
-
-void __init adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map)
-{
- if (num_ports > 0)
- adm5120_eth_num_ports = num_ports;
-
- if (vlan_map)
- memcpy(adm5120_eth_vlans, vlan_map, sizeof(adm5120_eth_vlans));
-
- platform_device_register(&adm5120_switch_device);
-}
-
-/*
- * USB Host Controller
- */
-struct resource adm5120_hcd_resources[] = {
- [0] = {
- .start = ADM5120_USBC_BASE,
- .end = ADM5120_USBC_BASE+ADM5120_USBC_SIZE-1,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = ADM5120_IRQ_USBC,
- .end = ADM5120_IRQ_USBC,
- .flags = IORESOURCE_IRQ,
- },
-};
-
-static u64 adm5120_hcd_dma_mask = DMA_BIT_MASK(24);
-struct platform_device adm5120_hcd_device = {
- .name = "adm5120-hcd",
- .id = -1,
- .num_resources = ARRAY_SIZE(adm5120_hcd_resources),
- .resource = adm5120_hcd_resources,
- .dev = {
- .dma_mask = &adm5120_hcd_dma_mask,
- .coherent_dma_mask = DMA_BIT_MASK(24),
- }
-};
-
-void __init adm5120_add_device_usb(void)
-{
- platform_device_register(&adm5120_hcd_device);
-}
-
-/*
- * NOR flash devices
- */
-struct adm5120_flash_platform_data adm5120_flash0_data;
-struct platform_device adm5120_flash0_device = {
- .name = "adm5120-flash",
- .id = 0,
- .dev.platform_data = &adm5120_flash0_data,
-};
-
-struct adm5120_flash_platform_data adm5120_flash1_data;
-struct platform_device adm5120_flash1_device = {
- .name = "adm5120-flash",
- .id = 1,
- .dev.platform_data = &adm5120_flash1_data,
-};
-
-void __init adm5120_add_device_flash(unsigned id)
-{
- struct platform_device *pdev;
-
- switch (id) {
- case 0:
- pdev = &adm5120_flash0_device;
- break;
- case 1:
- pdev = &adm5120_flash1_device;
- break;
- default:
- pdev = NULL;
- break;
- }
-
- if (pdev)
- platform_device_register(pdev);
-}
-
-/*
- * built-in UARTs
- */
-static void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base,
- unsigned int mctrl)
-{
-}
-
-struct amba_pl010_data adm5120_uart0_data = {
- .set_mctrl = adm5120_uart_set_mctrl
-};
-
-struct amba_device adm5120_uart0_device = {
- .dev = {
- .init_name = "apb:uart0",
- .platform_data = &adm5120_uart0_data,
- },
- .res = {
- .start = ADM5120_UART0_BASE,
- .end = ADM5120_UART0_BASE + ADM5120_UART_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- .irq = { ADM5120_IRQ_UART0, 0 },
- .periphid = 0x0041010,
-};
-
-struct amba_pl010_data adm5120_uart1_data = {
- .set_mctrl = adm5120_uart_set_mctrl
-};
-
-struct amba_device adm5120_uart1_device = {
- .dev = {
- .init_name = "apb:uart1",
- .platform_data = &adm5120_uart1_data,
- },
- .res = {
- .start = ADM5120_UART1_BASE,
- .end = ADM5120_UART1_BASE + ADM5120_UART_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
- .irq = { ADM5120_IRQ_UART1, 0 },
- .periphid = 0x0041010,
-};
-
-void __init adm5120_add_device_uart(unsigned id)
-{
- struct amba_device *dev;
-
- switch (id) {
- case 0:
- dev = &adm5120_uart0_device;
- break;
- case 1:
- dev = &adm5120_uart1_device;
- break;
- default:
- dev = NULL;
- break;
- }
-
- if (dev)
- amba_device_register(dev, &iomem_resource);
-}
-
-/*
- * GPIO buttons
- */
-void __init adm5120_register_gpio_buttons(int id,
- unsigned poll_interval,
- unsigned nbuttons,
- struct gpio_keys_button *buttons)
-{
- struct platform_device *pdev;
- struct gpio_keys_platform_data pdata;
- struct gpio_keys_button *p;
- int err;
-
- p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
- if (!p)
- return;
-
- pdev = platform_device_alloc("gpio-keys-polled", id);
- if (!pdev)
- goto err_free_buttons;
-
- memset(&pdata, 0, sizeof(pdata));
- pdata.poll_interval = poll_interval;
- pdata.nbuttons = nbuttons;
- pdata.buttons = p;
-
- err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
- if (err)
- goto err_put_pdev;
-
- err = platform_device_add(pdev);
- if (err)
- goto err_put_pdev;
-
- return;
-
-err_put_pdev:
- platform_device_put(pdev);
-
-err_free_buttons:
- kfree(p);
-}
-
-/*
- * GPIO LEDS
- */
-struct gpio_led_platform_data adm5120_gpio_leds_data;
-struct platform_device adm5120_gpio_leds_device = {
- .name = "leds-gpio",
- .id = -1,
- .dev.platform_data = &adm5120_gpio_leds_data,
-};
-
-void __init adm5120_add_device_gpio_leds(unsigned num_leds,
- struct gpio_led *leds)
-{
- struct gpio_led *p;
-
- p = kmalloc(num_leds * sizeof(*p), GFP_KERNEL);
- if (!p)
- return;
-
- memcpy(p, leds, num_leds * sizeof(*p));
- adm5120_gpio_leds_data.num_leds = num_leds;
- adm5120_gpio_leds_data.leds = p;
-
- platform_device_register(&adm5120_gpio_leds_device);
-}
-
-/*
- * NAND flash
- */
-struct resource adm5120_nand_resources[] = {
- [0] = {
- .start = ADM5120_NAND_BASE,
- .end = ADM5120_NAND_BASE + ADM5120_NAND_SIZE-1,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static int adm5120_nand_ready(struct mtd_info *mtd)
-{
- return ((adm5120_nand_get_status() & ADM5120_NAND_STATUS_READY) != 0);
-}
-
-static void adm5120_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
- unsigned int ctrl)
-{
- if (ctrl & NAND_CTRL_CHANGE) {
- adm5120_nand_set_cle(ctrl & NAND_CLE);
- adm5120_nand_set_ale(ctrl & NAND_ALE);
- adm5120_nand_set_cen(ctrl & NAND_NCE);
- }
-
- if (cmd != NAND_CMD_NONE)
- NAND_WRITE_REG(NAND_REG_DATA, cmd);
-}
-
-void __init adm5120_add_device_nand(struct platform_nand_data *pdata)
-{
- struct platform_device *pdev;
- int err;
-
- pdev = platform_device_alloc("gen_nand", -1);
- if (!pdev)
- goto err_out;
-
- err = platform_device_add_resources(pdev, adm5120_nand_resources,
- ARRAY_SIZE(adm5120_nand_resources));
- if (err)
- goto err_put;
-
- err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
- if (err)
- goto err_put;
-
- pdata = pdev->dev.platform_data;
- pdata->ctrl.dev_ready = adm5120_nand_ready;
- pdata->ctrl.cmd_ctrl = adm5120_nand_cmd_ctrl;
-
- err = platform_device_add(pdev);
- if (err)
- goto err_put;
-
- return;
-
-err_put:
- platform_device_put(pdev);
-err_out:
- return;
-}
+++ /dev/null
-/*
- * ADM5120 specific prom routines
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-
-#include <asm/bootinfo.h>
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-
-#include <prom/cfe.h>
-#include <prom/generic.h>
-#include <prom/routerboot.h>
-#include <prom/myloader.h>
-#include <prom/zynos.h>
-
-unsigned int adm5120_prom_type = ADM5120_PROM_GENERIC;
-
-struct board_desc {
- unsigned long mach_type;
- char *name;
-};
-
-#define DEFBOARD(n, mt) { .mach_type = (mt), .name = (n)}
-static struct board_desc common_boards[] __initdata = {
- /* Cellvision/SparkLAN boards */
- DEFBOARD("CAS-630", MACH_ADM5120_CAS630),
- DEFBOARD("CAS-670", MACH_ADM5120_CAS670),
- DEFBOARD("CAS-700", MACH_ADM5120_CAS700),
- DEFBOARD("CAS-771", MACH_ADM5120_CAS771),
- DEFBOARD("CAS-790", MACH_ADM5120_CAS790),
- DEFBOARD("CAS-861", MACH_ADM5120_CAS861),
- DEFBOARD("NFS-101U", MACH_ADM5120_NFS101U),
- /* Compex boards */
- DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT),
- /* Edimax boards */
- DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K),
- DEFBOARD("BR-6104KP", MACH_ADM5120_BR6104KP),
- DEFBOARD("BR-6104WG", MACH_ADM5120_BR61X4WG),
- DEFBOARD("BR-6114WG", MACH_ADM5120_BR61X4WG),
- /* Infineon boards */
- DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA),
- DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT),
- DEFBOARD("EASY 5120-WVoIP", MACH_ADM5120_EASY5120WVOIP),
- DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000),
- /* Mikrotik RouterBOARDs */
- DEFBOARD("111", MACH_ADM5120_RB_11X),
- DEFBOARD("112", MACH_ADM5120_RB_11X),
- DEFBOARD("133", MACH_ADM5120_RB_133),
- DEFBOARD("133C", MACH_ADM5120_RB_133C),
- DEFBOARD("133C3", MACH_ADM5120_RB_133C),
- DEFBOARD("150", MACH_ADM5120_RB_153), /* it's intentional */
- DEFBOARD("153", MACH_ADM5120_RB_153),
- DEFBOARD("192", MACH_ADM5120_RB_192),
- DEFBOARD("miniROUTER", MACH_ADM5120_RB_150),
- /* OSBRiDGE boards */
- DEFBOARD("OSBRiDGE 5GXi", MACH_ADM5120_5GXI),
- /* Motorola boards */
- DEFBOARD("Powerline MU Gateway", MACH_ADM5120_PMUGW),
- /* Generic EB-214A */
- DEFBOARD("ADM5120", MACH_ADM5120_EB_214A),
-};
-
-static unsigned long __init find_machtype_byname(char *name)
-{
- unsigned long ret;
- int i;
-
- ret = MACH_ADM5120_GENERIC;
- if (name == NULL)
- goto out;
-
- if (*name == '\0')
- goto out;
-
- for (i = 0; i < ARRAY_SIZE(common_boards); i++) {
- if (strcmp(common_boards[i].name, name) == 0) {
- ret = common_boards[i].mach_type;
- break;
- }
- }
-
-out:
- return ret;
-}
-
-static unsigned long __init detect_machtype_routerboot(void)
-{
- char *name;
-
- name = routerboot_get_boardname();
- return find_machtype_byname(name);
-}
-
-static unsigned long __init detect_machtype_generic(void)
-{
- char *name;
-
- name = generic_prom_getenv("board_name");
- return find_machtype_byname(name);
-}
-
-unsigned long __init detect_machtype_cfe(void)
-{
- char *name;
-
- name = cfe_getenv("BOARD_NAME");
- return find_machtype_byname(name);
-}
-
-static struct {
- unsigned long mach_type;
- u16 vendor_id;
- u16 board_id;
-} zynos_boards[] __initdata = {
-#define ZYNOS_BOARD(vi, bi, mt) \
- {.vendor_id = (vi), .board_id = (bi), .mach_type = (mt)}
-
-#define ZYXEL_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_ZYXEL, bi, mt)
-#define DLINK_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_DLINK, bi, mt)
-#define LUCENT_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_LUCENT, bi, mt)
- ZYXEL_BOARD(ZYNOS_BOARD_HS100, MACH_ADM5120_HS100),
- ZYXEL_BOARD(ZYNOS_BOARD_P334U, MACH_ADM5120_P334U),
- ZYXEL_BOARD(ZYNOS_BOARD_P334W, MACH_ADM5120_P334W),
- ZYXEL_BOARD(ZYNOS_BOARD_P334WH, MACH_ADM5120_P334WH),
- ZYXEL_BOARD(ZYNOS_BOARD_P334WHD, MACH_ADM5120_P334WHD),
- ZYXEL_BOARD(ZYNOS_BOARD_P334WT, MACH_ADM5120_P334WT),
- ZYXEL_BOARD(ZYNOS_BOARD_P334WT_ALT, MACH_ADM5120_P334WT),
- ZYXEL_BOARD(ZYNOS_BOARD_P335, MACH_ADM5120_P335),
- ZYXEL_BOARD(ZYNOS_BOARD_P335PLUS, MACH_ADM5120_P335PLUS),
- ZYXEL_BOARD(ZYNOS_BOARD_P335U, MACH_ADM5120_P335U)
-};
-
-static unsigned long __init detect_machtype_bootbase(void)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(zynos_boards); i++) {
- if (zynos_boards[i].vendor_id == bootbase_info.vendor_id &&
- zynos_boards[i].board_id == bootbase_info.board_id) {
- return zynos_boards[i].mach_type;
- break;
- }
- }
-
- printk(KERN_WARNING "Unknown ZyXEL model (%u)\n",
- bootbase_info.board_id);
- return MACH_ADM5120_GENERIC;
-}
-
-static struct {
- unsigned long mach_type;
- u16 vid;
- u16 did;
- u16 svid;
- u16 sdid;
-} mylo_boards[] __initdata = {
-#define MYLO_BOARD(v, d, sv, sd, mt) \
- {.vid = (v), .did = (d), .svid = (sv), .sdid = (sd), .mach_type = (mt)}
-#define COMPEX_BOARD(d, mt) \
- MYLO_BOARD(VENID_COMPEX, (d), VENID_COMPEX, (d), (mt))
-
- COMPEX_BOARD(DEVID_COMPEX_NP27G, MACH_ADM5120_NP27G),
- COMPEX_BOARD(DEVID_COMPEX_NP28G, MACH_ADM5120_NP28G),
- COMPEX_BOARD(DEVID_COMPEX_NP28GHS, MACH_ADM5120_NP28GHS),
- COMPEX_BOARD(DEVID_COMPEX_WP54G, MACH_ADM5120_WP54),
- COMPEX_BOARD(DEVID_COMPEX_WP54Gv1C, MACH_ADM5120_WP54Gv1C),
- COMPEX_BOARD(DEVID_COMPEX_WP54AG, MACH_ADM5120_WP54),
- COMPEX_BOARD(DEVID_COMPEX_WPP54G, MACH_ADM5120_WP54),
- COMPEX_BOARD(DEVID_COMPEX_WPP54AG, MACH_ADM5120_WP54),
-};
-
-static unsigned long __init detect_machtype_myloader(void)
-{
- unsigned long ret;
- int i;
-
- ret = MACH_ADM5120_GENERIC;
- for (i = 0; i < ARRAY_SIZE(mylo_boards); i++) {
- if (mylo_boards[i].vid == myloader_info.vid &&
- mylo_boards[i].did == myloader_info.did &&
- mylo_boards[i].svid == myloader_info.svid &&
- mylo_boards[i].sdid == myloader_info.sdid) {
- ret = mylo_boards[i].mach_type;
- break;
- }
- }
-
- return ret;
-}
-
-static void __init prom_detect_machtype(void)
-{
- if (bootbase_present()) {
- adm5120_prom_type = ADM5120_PROM_BOOTBASE;
- mips_machtype = detect_machtype_bootbase();
- return;
- }
-
- if (cfe_present()) {
- adm5120_prom_type = ADM5120_PROM_CFE;
- mips_machtype = detect_machtype_cfe();
- return;
- }
-
- if (myloader_present()) {
- adm5120_prom_type = ADM5120_PROM_MYLOADER;
- mips_machtype = detect_machtype_myloader();
- return;
- }
-
- if (routerboot_present()) {
- adm5120_prom_type = ADM5120_PROM_ROUTERBOOT;
- mips_machtype = detect_machtype_routerboot();
- return;
- }
-
- if (generic_prom_present()) {
- adm5120_prom_type = ADM5120_PROM_GENERIC;
- mips_machtype = detect_machtype_generic();
- return;
- }
-
- mips_machtype = MACH_ADM5120_GENERIC;
-}
-
-#ifdef CONFIG_IMAGE_CMDLINE_HACK
-extern char __image_cmdline[];
-
-static void __init prom_init_cmdline(void)
-{
- char *cmd;
-
- /* init command line, register a default kernel command line */
- cmd = __image_cmdline;
- if (strlen(cmd) > 0)
- strlcpy(arcs_cmdline, cmd, sizeof(arcs_cmdline));
-
-}
-#else
-static inline void prom_init_cmdline(void) {}
-#endif /* CONFIG_IMAGE_CMDLINE_HACK */
-
-void __init prom_init(void)
-{
- prom_detect_machtype();
- prom_init_cmdline();
-}
-
-void __init prom_free_prom_memory(void)
-{
- /* We do not have to prom memory to free */
-}
+++ /dev/null
-/*
- * ADM5120 specific setup
- *
- * Copyright (C) 2007-2009 Gabor Juhos <juhosg@openwrt.org>
- *
- * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel
- * done by Jeroen Vreeken
- * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
- *
- * Jeroen's code was based on the Linux 2.4.xx source codes found in various
- * tarballs released by Edimax for it's ADM5120 based devices
- * Copyright (C) ADMtek Incorporated
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/io.h>
-#include <linux/reboot.h>
-#include <linux/time.h>
-
-#include <asm/reboot.h>
-#include <asm/time.h>
-#include <asm/bootinfo.h>
-#include <asm/mips_machine.h>
-#include <asm/idle.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-#define ADM5120_SYS_TYPE_LEN 64
-
-unsigned char adm5120_sys_type[ADM5120_SYS_TYPE_LEN];
-void (*adm5120_board_reset)(void);
-
-static char *prom_names[ADM5120_PROM_LAST+1] __initdata = {
- [ADM5120_PROM_GENERIC] = "Generic",
- [ADM5120_PROM_CFE] = "CFE",
- [ADM5120_PROM_UBOOT] = "U-Boot",
- [ADM5120_PROM_MYLOADER] = "MyLoader",
- [ADM5120_PROM_ROUTERBOOT] = "RouterBOOT",
- [ADM5120_PROM_BOOTBASE] = "Bootbase"
-};
-
-static void __init adm5120_report(void)
-{
- printk(KERN_INFO "SoC : %s\n", adm5120_sys_type);
- printk(KERN_INFO "Bootdev : %s flash\n",
- adm5120_nand_boot ? "NAND" : "NOR");
- printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]);
-}
-
-const char *get_system_type(void)
-{
- return adm5120_sys_type;
-}
-
-static void adm5120_restart(char *command)
-{
- /* TODO: stop switch before reset */
-
- if (adm5120_board_reset)
- adm5120_board_reset();
-
- SW_WRITE_REG(SWITCH_REG_SOFT_RESET, 1);
-}
-
-static void adm5120_halt(void)
-{
- local_irq_disable();
-
- while (1) {
- if (cpu_wait)
- cpu_wait();
- }
-}
-
-void __init plat_time_init(void)
-{
- mips_hpt_frequency = adm5120_speed / 2;
-}
-
-void __init plat_mem_setup(void)
-{
- adm5120_soc_init();
- adm5120_mem_init();
-
- sprintf(adm5120_sys_type, "ADM%04X%s rev %u, running at %lu.%03lu MHz",
- adm5120_product_code,
- adm5120_package_bga() ? "" : "P",
- adm5120_revision,
- (adm5120_speed / 1000000), (adm5120_speed / 1000) % 1000);
-
- adm5120_report();
-
- _machine_restart = adm5120_restart;
- _machine_halt = adm5120_halt;
- pm_power_off = adm5120_halt;
-
- set_io_port_base(KSEG1);
-}
-
-static int __init adm5120_board_setup(void)
-{
- adm5120_gpio_init();
-
- mips_machine_setup();
-
- return 0;
-}
-arch_initcall(adm5120_board_setup);
-
-static void __init adm5120_generic_board_setup(void)
-{
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- adm5120_add_device_flash(0);
- adm5120_add_device_switch(6, NULL);
-}
-
-MIPS_MACHINE(MACH_ADM5120_GENERIC, "Generic", "Generic ADM5120 board",
- adm5120_generic_board_setup);
+++ /dev/null
-obj-y += compex.o
-
-obj-$(CONFIG_ADM5120_MACH_NP27G) += np27g.o
-obj-$(CONFIG_ADM5120_MACH_NP28G) += np28g.o
-obj-$(CONFIG_ADM5120_MACH_WP54) += wp54.o
+++ /dev/null
-/*
- * Compex boards
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "compex.h"
-
-#include <asm/mach-adm5120/prom/myloader.h>
-
-static void switch_bank_gpio5(unsigned bank)
-{
- switch (bank) {
- case 0:
- gpio_set_value(ADM5120_GPIO_PIN5, 0);
- break;
- case 1:
- gpio_set_value(ADM5120_GPIO_PIN5, 1);
- break;
- }
-}
-
-void __init compex_mac_setup(void)
-{
- if (myloader_present()) {
- int i;
-
- for (i = 0; i < 6; i++) {
- if (is_valid_ether_addr(myloader_info.macs[i]))
- memcpy(adm5120_eth_macs[i],
- myloader_info.macs[i], ETH_ALEN);
- else
- random_ether_addr(adm5120_eth_macs[i]);
- }
- } else {
- u8 mac[ETH_ALEN];
-
- random_ether_addr(mac);
- adm5120_setup_eth_macs(mac);
- }
-}
-
-void __init compex_generic_setup(void)
-{
- gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
- gpio_direction_output(ADM5120_GPIO_PIN5, 0);
-
- adm5120_flash0_data.switch_bank = switch_bank_gpio5;
- adm5120_add_device_flash(0);
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- compex_mac_setup();
-}
+++ /dev/null
-/*
- * Compex boards
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-extern void compex_generic_setup(void) __init;
+++ /dev/null
-/*
- * Compex NP27G board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "compex.h"
-
-static u8 np27g_vlans[6] __initdata = {
- /* FIXME: untested */
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
-};
-
-static void __init np27g_setup(void)
-{
- compex_generic_setup();
- adm5120_add_device_switch(5, np27g_vlans);
- adm5120_add_device_usb();
-
- /* TODO: add PCI IRQ map */
-}
-
-MIPS_MACHINE(MACH_ADM5120_NP27G, "NP27G", "Compex NetPassage 27G", np27g_setup);
+++ /dev/null
-/*
- * Compex NP28G board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "compex.h"
-
-static struct adm5120_pci_irq np28g_pci_irqs[] __initdata = {
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
- PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI0),
- PCIIRQ(3, 1, 2, ADM5120_IRQ_PCI1),
- PCIIRQ(3, 2, 3, ADM5120_IRQ_PCI2)
-};
-
-static struct gpio_led np28g_gpio_leds[] __initdata = {
- GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL),
- GPIO_LED_INV(ADM5120_GPIO_PIN3, "power", NULL),
- GPIO_LED_INV(ADM5120_GPIO_PIN6, "wan_cond", NULL),
- GPIO_LED_INV(ADM5120_GPIO_PIN7, "wifi", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L2, "usb1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L2, "usb2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L2, "usb3", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L2, "usb4", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL),
-};
-
-static u8 np28g_vlans[6] __initdata = {
- 0x50, 0x42, 0x44, 0x48, 0x00, 0x00
-};
-
-static void np28g_reset(void)
-{
- gpio_set_value(ADM5120_GPIO_PIN4, 0);
-}
-
-static void __init np28g_setup(void)
-{
- compex_generic_setup();
-
- /* setup reset line */
- gpio_request(ADM5120_GPIO_PIN4, NULL);
- gpio_direction_output(ADM5120_GPIO_PIN4, 1);
- adm5120_board_reset = np28g_reset;
-
- adm5120_add_device_switch(4, np28g_vlans);
- adm5120_add_device_usb();
-
- adm5120_add_device_gpio_leds(ARRAY_SIZE(np28g_gpio_leds),
- np28g_gpio_leds);
-
- adm5120_pci_set_irq_map(ARRAY_SIZE(np28g_pci_irqs), np28g_pci_irqs);
-}
-
-MIPS_MACHINE(MACH_ADM5120_NP28G, "NP28G", "Compex NetPassage 28G", np28g_setup);
+++ /dev/null
-/*
- * Compex WP54 board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "compex.h"
-
-#define WP54_KEYS_POLL_INTERVAL 20
-#define WP54_KEYS_DEBOUNCE_INTERVAL (3 * WP54_KEYS_POLL_INTERVAL)
-
-static struct mtd_partition wp54g_wrt_partitions[] = {
- {
- .name = "cfe",
- .offset = 0,
- .size = 0x050000,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "trx",
- .offset = MTDPART_OFS_APPEND,
- .size = 0x3A0000,
- } , {
- .name = "nvram",
- .offset = MTDPART_OFS_APPEND,
- .size = 0x010000,
- }
-};
-
-static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
-};
-
-static struct gpio_keys_button wp54_gpio_buttons[] __initdata = {
- {
- .desc = "reset_button",
- .type = EV_KEY,
- .code = KEY_RESTART,
- .debounce_interval = WP54_KEYS_DEBOUNCE_INTERVAL,
- .gpio = ADM5120_GPIO_PIN4,
- }
-};
-
-static struct gpio_led wp54_gpio_leds[] __initdata = {
- GPIO_LED_INV(ADM5120_GPIO_PIN2, "diag", NULL),
- GPIO_LED_INV(ADM5120_GPIO_PIN6, "wlan", NULL),
- GPIO_LED_INV(ADM5120_GPIO_PIN7, "wan", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2", NULL),
-};
-
-static u8 wp54_vlans[6] __initdata = {
- 0x41, 0x42, 0x00, 0x00, 0x00, 0x00
-};
-
-static void wp54_reset(void)
-{
- gpio_set_value(ADM5120_GPIO_PIN3, 0);
-}
-
-static void __init wp54_setup(void)
-{
- compex_generic_setup();
-
- /* setup reset line */
- gpio_request(ADM5120_GPIO_PIN3, NULL);
- gpio_direction_output(ADM5120_GPIO_PIN3, 1);
- adm5120_board_reset = wp54_reset;
-
- adm5120_add_device_switch(2, wp54_vlans);
- adm5120_register_gpio_buttons(-1, WP54_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(wp54_gpio_buttons),
- wp54_gpio_buttons);
- adm5120_add_device_gpio_leds(ARRAY_SIZE(wp54_gpio_leds),
- wp54_gpio_leds);
-
- adm5120_pci_set_irq_map(ARRAY_SIZE(wp54_pci_irqs), wp54_pci_irqs);
-}
-
-MIPS_MACHINE(MACH_ADM5120_WP54, "WP54", "Compex WP54 family", wp54_setup);
-
-static void __init wp54_wrt_setup(void)
-{
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions);
- adm5120_flash0_data.parts = wp54g_wrt_partitions;
-
- wp54_setup();
-}
-
-MIPS_MACHINE(MACH_ADM5120_WP54G_WRT, "WP54G-WRT", "Compex WP54G-WRT",
- wp54_wrt_setup);
+++ /dev/null
-obj-y := br-61xx.o
-
-obj-$(CONFIG_ADM5120_MACH_BR_6104K) += br-6104k.o
-obj-$(CONFIG_ADM5120_MACH_BR_6104KP) += br-6104kp.o
-obj-$(CONFIG_ADM5120_MACH_BR_61X4WG) += br-61x4wg.o
+++ /dev/null
-/*
- * Edimax BR-6104K board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "br-61xx.h"
-
-static struct gpio_led br6104k_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL),
-};
-
-static void __init br6104k_setup(void)
-{
- br61xx_generic_setup();
- adm5120_add_device_gpio_leds(ARRAY_SIZE(br6104k_gpio_leds),
- br6104k_gpio_leds);
-}
-
-MIPS_MACHINE(MACH_ADM5120_BR6104K, "BR-6104K", "Edimax BR-6104K",
- br6104k_setup);
+++ /dev/null
-/*
- * Edimax BR-6104KP board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "br-61xx.h"
-
-static struct gpio_led br6104kp_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL),
- GPIO_LED_INV(ADM5120_GPIO_PIN3, "usb1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_PIN1, "usb2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL),
-};
-
-static void __init br6104kp_setup(void)
-{
- br61xx_generic_setup();
- adm5120_add_device_gpio_leds(ARRAY_SIZE(br6104kp_gpio_leds),
- br6104kp_gpio_leds);
- adm5120_add_device_usb();
-}
-
-MIPS_MACHINE(MACH_ADM5120_BR6104KP, "BR-6104KP", "Edimax BR-6104KP",
- br6104kp_setup);
+++ /dev/null
-/*
- * Edimax BR-6104Wg/6114WG board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "br-61xx.h"
-
-static struct adm5120_pci_irq br61x4wg_pci_irqs[] __initdata = {
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
-};
-
-static struct gpio_led br61x4wg_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN0, "power", NULL),
- GPIO_LED_STD(ADM5120_GPIO_PIN5, "wlan", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "wan_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "wan_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan4_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan4_lnkact", NULL),
-};
-
-static void __init br61x4wg_setup(void)
-{
- br61xx_generic_setup();
- adm5120_add_device_gpio_leds(ARRAY_SIZE(br61x4wg_gpio_leds),
- br61x4wg_gpio_leds);
- adm5120_pci_set_irq_map(ARRAY_SIZE(br61x4wg_pci_irqs),
- br61x4wg_pci_irqs);
-}
-
-MIPS_MACHINE(MACH_ADM5120_BR61X4WG, "BR-6104WG", "Edimax BR-6104WG/6114WG",
- br61x4wg_setup);
+++ /dev/null
-/*
- * Edimax BR-61xx support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "br-61xx.h"
-
-#include <prom/admboot.h>
-
-#define BR61XX_CONFIG_OFFSET 0x8000
-#define BR61XX_CONFIG_SIZE 0x1000
-
-#define BR61XX_KEYS_POLL_INTERVAL 20
-#define BR61XX_KEYS_DEBOUNCE_INTERVAL (3 * BR61XX_KEYS_POLL_INTERVAL)
-
-static struct mtd_partition br61xx_partitions[] = {
- {
- .name = "admboot",
- .offset = 0,
- .size = 32*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "config",
- .offset = MTDPART_OFS_APPEND,
- .size = 32*1024,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static struct gpio_keys_button br61xx_gpio_buttons[] __initdata = {
- {
- .desc = "reset_button",
- .type = EV_KEY,
- .code = KEY_RESTART,
- .debounce_interval = BR61XX_KEYS_DEBOUNCE_INTERVAL,
- .gpio = ADM5120_GPIO_PIN2,
- }
-};
-
-static u8 br61xx_vlans[6] __initdata = {
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
-};
-
-static void __init br61xx_mac_setup(void)
-{
- u8 mac_base[6];
- int err;
-
- err = admboot_get_mac_base(BR61XX_CONFIG_OFFSET,
- BR61XX_CONFIG_SIZE, mac_base);
-
- if ((err) || !is_valid_ether_addr(mac_base))
- random_ether_addr(mac_base);
-
- adm5120_setup_eth_macs(mac_base);
-}
-
-void __init br61xx_generic_setup(void)
-{
-
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions);
- adm5120_flash0_data.parts = br61xx_partitions;
- adm5120_add_device_flash(0);
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- adm5120_add_device_switch(5, br61xx_vlans);
-
- adm5120_register_gpio_buttons(-1, BR61XX_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(br61xx_gpio_buttons),
- br61xx_gpio_buttons);
-
- br61xx_mac_setup();
-}
+++ /dev/null
-/*
- * Edimax BR-61xx board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-extern void __init br61xx_generic_setup(void) __init;
+++ /dev/null
-obj-$(CONFIG_ADM5120_MACH_EB_214A) += eb-214a.o
+++ /dev/null
-/*
- * EB-214A board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- * Copyright (C) 2010 Cezary Jackiewicz <cezary@eko.one.pl>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <asm/addrspace.h>
-#include <asm/byteorder.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-
-
-#define EB214A_CONFIG_OFFSET 0x4000
-
-#define EB214A_KEYS_POLL_INTERVAL 20
-#define EB214A_KEYS_DEBOUNCE_INTERVAL (3 * EB214A_KEYS_POLL_INTERVAL)
-
-static struct mtd_partition eb214a_partitions[] = {
- {
- .name = "bootloader",
- .offset = 0,
- .size = 32*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "config",
- .offset = MTDPART_OFS_APPEND,
- .size = 32*1024,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static struct adm5120_pci_irq eb214a_pci_irqs[] __initdata = {
- PCIIRQ(4, 0, 1, ADM5120_IRQ_PCI0),
- PCIIRQ(4, 1, 2, ADM5120_IRQ_PCI0),
- PCIIRQ(4, 2, 3, ADM5120_IRQ_PCI0),
-};
-
-static struct gpio_led eb214a_gpio_leds[] __initdata = {
- GPIO_LED_INV(ADM5120_GPIO_PIN7, "power", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "usb1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L1, "usb2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L2, "usb3", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "usb4", NULL),
-};
-
-static struct gpio_keys_button eb214a_gpio_buttons[] __initdata = {
- {
- .desc = "reset",
- .type = EV_KEY,
- .code = KEY_RESTART,
- .debounce_interval = EB214A_KEYS_DEBOUNCE_INTERVAL,
- .gpio = ADM5120_GPIO_PIN1,
- }
-};
-
-static u8 eb214a_vlans[6] __initdata = {
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
-};
-
-static void __init eb214a_mac_setup(void)
-{
- u8 mac_base[6];
- u8 *cfg;
- int i;
-
- cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + EB214A_CONFIG_OFFSET);
- for (i = 0; i < 6; i++)
- mac_base[i] = cfg[i];
-
- if (!is_valid_ether_addr(mac_base))
- random_ether_addr(mac_base);
-
- adm5120_setup_eth_macs(mac_base);
-}
-
-static void __init eb214a_setup(void)
-{
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(eb214a_partitions);
- adm5120_flash0_data.parts = eb214a_partitions;
- adm5120_add_device_flash(0);
-
- adm5120_add_device_uart(0);
- /* adm5120_add_device_uart(1); */
-
- adm5120_add_device_switch(5, eb214a_vlans);
-
- eb214a_mac_setup();
-
- adm5120_register_gpio_buttons(-1, EB214A_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(eb214a_gpio_buttons),
- eb214a_gpio_buttons);
-
- adm5120_add_device_gpio_leds(ARRAY_SIZE(eb214a_gpio_leds),
- eb214a_gpio_leds);
-
- adm5120_pci_set_irq_map(ARRAY_SIZE(eb214a_pci_irqs),
- eb214a_pci_irqs);
- /* adm5120_add_device_usb(); */
-}
-
-MIPS_MACHINE(MACH_ADM5120_EB_214A, "EB-214A", "Generic EB-214A", eb214a_setup);
+++ /dev/null
-obj-y += infineon.o
-
-obj-$(CONFIG_ADM5120_MACH_EASY5120_RT) += easy5120-rt.o
-obj-$(CONFIG_ADM5120_MACH_EASY5120_WVOIP) += easy5120-wvoip.o
-obj-$(CONFIG_ADM5120_MACH_EASY5120P_ATA) += easy5120p-ata.o
-obj-$(CONFIG_ADM5120_MACH_EASY83000) += easy83000.o
+++ /dev/null
-/*
- * Infineon EASY 5120-RT Reference Board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "infineon.h"
-
-static struct gpio_led easy5120_rt_gpio_leds[] __initdata = {
- GPIO_LED_INV(ADM5120_GPIO_PIN6, "user", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan0_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan0_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan1_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan1_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan2_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL),
-};
-
-static struct adm5120_pci_irq easy5120_rt_pci_irqs[] __initdata = {
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
-};
-
-static u8 easy5120_rt_vlans[6] __initdata = {
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
-};
-
-static void __init easy5120_rt_setup(void)
-{
- easy_setup_bga();
-
- adm5120_add_device_switch(5, easy5120_rt_vlans);
- adm5120_add_device_usb();
- adm5120_add_device_gpio_leds(ARRAY_SIZE(easy5120_rt_gpio_leds),
- easy5120_rt_gpio_leds);
- adm5120_pci_set_irq_map(ARRAY_SIZE(easy5120_rt_pci_irqs),
- easy5120_rt_pci_irqs);
-}
-
-MIPS_MACHINE(MACH_ADM5120_EASY5120RT, "EASY5120-RT",
- "Infineon EASY 5120-RT Reference Board", easy5120_rt_setup);
+++ /dev/null
-/*
- * Infineon EASY 5120-WVoIP Reference Board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "infineon.h"
-
-static void __init easy5120wvoip_setup(void)
-{
- easy_setup_bga();
- adm5120_add_device_switch(6, NULL);
-
- /* TODO: add VINETIC2 device */
- /* TODO: setup PCI IRQ map */
-}
-
-MIPS_MACHINE(MACH_ADM5120_EASY5120WVOIP, "EASY5120WVoIP",
- "Infineon EASY 5120-WVoIP Reference Board", easy5120wvoip_setup);
+++ /dev/null
-/*
- * Infineon EASY 5120P-ATA Reference Board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "infineon.h"
-
-static void __init easy5120pata_setup(void)
-{
- easy_setup_pqfp();
-
- adm5120_add_device_switch(6, NULL);
-}
-
-MIPS_MACHINE(MACH_ADM5120_EASY5120PATA, "EASY5120P-ATA",
- "Infineon EASY 5120P-ATA Reference Board", easy5120pata_setup);
+++ /dev/null
-/*
- * Infineon EASY 83000 Reference Board support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "infineon.h"
-
-static void __init easy83000_setup(void)
-{
- easy_setup_pqfp();
- adm5120_add_device_switch(6, NULL);
-
- /* TODO: add VINAX device */
-}
-
-MIPS_MACHINE(MACH_ADM5120_EASY83000, "EASY8300",
- "Infineon EASY 83000 Reference Board", easy83000_setup);
+++ /dev/null
-/*
- * Infineon Reference Boards
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "infineon.h"
-
-#include <prom/admboot.h>
-
-#define EASY_CONFIG_OFFSET 0x10000
-#define EASY_CONFIG_SIZE 0x1000
-
-static struct mtd_partition easy_partitions[] = {
- {
- .name = "admboot",
- .offset = 0,
- .size = 64*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "boardcfg",
- .offset = MTDPART_OFS_APPEND,
- .size = 64*1024,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static __init void easy_setup_mac(void)
-{
- u8 mac_base[6];
- int err;
-
- err = admboot_get_mac_base(EASY_CONFIG_OFFSET,
- EASY_CONFIG_SIZE, mac_base);
-
- if ((err) || !is_valid_ether_addr(mac_base))
- random_ether_addr(mac_base);
-
- adm5120_setup_eth_macs(mac_base);
-}
-
-static void switch_bank_gpio3(unsigned bank)
-{
- switch (bank) {
- case 0:
- gpio_set_value(ADM5120_GPIO_PIN3, 0);
- break;
- case 1:
- gpio_set_value(ADM5120_GPIO_PIN3, 1);
- break;
- }
-}
-
-void __init easy_setup_pqfp(void)
-{
- /* setup flash A20 line */
- gpio_request(ADM5120_GPIO_PIN3, NULL);
- gpio_direction_output(ADM5120_GPIO_PIN3, 0);
- adm5120_flash0_data.switch_bank = switch_bank_gpio3;
-
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
- adm5120_flash0_data.parts = easy_partitions;
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- adm5120_add_device_flash(0);
-
- easy_setup_mac();
-}
-
-static void switch_bank_gpio5(unsigned bank)
-{
- switch (bank) {
- case 0:
- gpio_set_value(ADM5120_GPIO_PIN5, 0);
- break;
- case 1:
- gpio_set_value(ADM5120_GPIO_PIN5, 1);
- break;
- }
-}
-
-void __init easy_setup_bga(void)
-{
- /* setup flash A20 line */
- gpio_request(ADM5120_GPIO_PIN5, NULL);
- gpio_direction_output(ADM5120_GPIO_PIN5, 0);
- adm5120_flash0_data.switch_bank = switch_bank_gpio5;
-
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
- adm5120_flash0_data.parts = easy_partitions;
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- adm5120_add_device_flash(0);
-
- easy_setup_mac();
-}
+++ /dev/null
-/*
- * Infineon Reference Boards
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-
-extern void easy_setup_pqfp(void) __init;
-extern void easy_setup_bga(void) __init;
+++ /dev/null
-obj-y += rb-1xx.o
-
-obj-${CONFIG_ADM5120_MACH_RB_11X} += rb-11x.o
-obj-${CONFIG_ADM5120_MACH_RB_133} += rb-133.o
-obj-${CONFIG_ADM5120_MACH_RB_133C} += rb-133c.o
-obj-${CONFIG_ADM5120_MACH_RB_150} += rb-150.o
-obj-${CONFIG_ADM5120_MACH_RB_153} += rb-153.o
-obj-${CONFIG_ADM5120_MACH_RB_192} += rb-192.o
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 111/112 support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "rb-1xx.h"
-
-static struct gpio_led rb11x_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN3, "user", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan_lnkact", NULL),
-};
-
-static u8 rb11x_vlans[6] __initdata = {
- 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static void __init rb11x_setup(void)
-{
- rb1xx_generic_setup();
- rb1xx_add_device_nand();
-
- adm5120_add_device_switch(1, rb11x_vlans);
- adm5120_add_device_gpio_leds(ARRAY_SIZE(rb11x_gpio_leds),
- rb11x_gpio_leds);
-}
-
-MIPS_MACHINE(MACH_ADM5120_RB_11X, "11x", "Mikrotik RouterBOARD 111/112",
- rb11x_setup);
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 133 support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "rb-1xx.h"
-
-static struct gpio_led rb133_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN6, "power", NULL),
- GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan1_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan1_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan2_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan2_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan3_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan3_lnkact", NULL),
-};
-
-static u8 rb133_vlans[6] __initdata = {
- 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static void __init rb133_setup(void)
-{
- rb1xx_generic_setup();
- rb1xx_add_device_nand();
-
- adm5120_add_device_switch(3, rb133_vlans);
- adm5120_add_device_gpio_leds(ARRAY_SIZE(rb133_gpio_leds),
- rb133_gpio_leds);
-}
-
-MIPS_MACHINE(MACH_ADM5120_RB_133, "133", "Mikrotik RouterBOARD 133",
- rb133_setup);
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 133C support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "rb-1xx.h"
-
-static struct gpio_led rb133c_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN6, "power", NULL),
- GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan1_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan1_lnkact", NULL),
-};
-
-static u8 rb133c_vlans[6] __initdata = {
- 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static void __init rb133c_setup(void)
-{
- rb1xx_generic_setup();
- rb1xx_add_device_nand();
-
- adm5120_add_device_switch(1, rb133c_vlans);
- adm5120_add_device_gpio_leds(ARRAY_SIZE(rb133c_gpio_leds),
- rb133c_gpio_leds);
-}
-
-MIPS_MACHINE(MACH_ADM5120_RB_133C, "133C", "Mikrotik RouterBOARD 133C",
- rb133c_setup);
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 150 support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "rb-1xx.h"
-
-#define RB150_NAND_BASE 0x1FC80000
-#define RB150_NAND_SIZE 1
-
-#define RB150_GPIO_NAND_READY ADM5120_GPIO_PIN0
-#define RB150_GPIO_NAND_NCE ADM5120_GPIO_PIN1
-#define RB150_GPIO_NAND_CLE ADM5120_GPIO_P2L2
-#define RB150_GPIO_NAND_ALE ADM5120_GPIO_P3L2
-#define RB150_GPIO_RESET_BUTTON ADM5120_GPIO_PIN1 /* FIXME */
-
-#define RB150_NAND_DELAY 100
-
-#define RB150_NAND_WRITE(v) \
- writeb((v), (void __iomem *)KSEG1ADDR(RB150_NAND_BASE))
-
-static struct resource rb150_nand_resources[] __initdata = {
- [0] = {
- .start = RB150_NAND_BASE,
- .end = RB150_NAND_BASE + RB150_NAND_SIZE-1,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct gpio_led rb150_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_P0L2, "user", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan1_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan5_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan5_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan4_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan4_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_led2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan2_led1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan2_led2", NULL),
-};
-
-static u8 rb150_vlans[6] __initdata = {
- 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static int rb150_nand_dev_ready(struct mtd_info *mtd)
-{
- return gpio_get_value(RB150_GPIO_NAND_READY);
-}
-
-static void rb150_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
- unsigned int ctrl)
-{
- if (ctrl & NAND_CTRL_CHANGE) {
- gpio_set_value(RB150_GPIO_NAND_CLE, (ctrl & NAND_CLE) ? 1 : 0);
- gpio_set_value(RB150_GPIO_NAND_ALE, (ctrl & NAND_ALE) ? 1 : 0);
- gpio_set_value(RB150_GPIO_NAND_NCE, (ctrl & NAND_NCE) ? 0 : 1);
- }
-
- udelay(RB150_NAND_DELAY);
-
- if (cmd != NAND_CMD_NONE)
- RB150_NAND_WRITE(cmd);
-}
-
-static void __init rb150_add_device_nand(void)
-{
- struct platform_device *pdev;
- int err;
-
- /* setup GPIO pins for NAND flash chip */
- gpio_request(RB150_GPIO_NAND_READY, "nand-ready");
- gpio_direction_input(RB150_GPIO_NAND_READY);
- gpio_request(RB150_GPIO_NAND_NCE, "nand-nce");
- gpio_direction_output(RB150_GPIO_NAND_NCE, 1);
- gpio_request(RB150_GPIO_NAND_CLE, "nand-cle");
- gpio_direction_output(RB150_GPIO_NAND_CLE, 0);
- gpio_request(RB150_GPIO_NAND_ALE, "nand-ale");
- gpio_direction_output(RB150_GPIO_NAND_ALE, 0);
-
- pdev = platform_device_alloc("gen_nand", -1);
- if (!pdev)
- goto err_out;
-
- err = platform_device_add_resources(pdev, rb150_nand_resources,
- ARRAY_SIZE(rb150_nand_resources));
- if (err)
- goto err_put;
-
-
- rb1xx_nand_data.ctrl.cmd_ctrl = rb150_nand_cmd_ctrl;
- rb1xx_nand_data.ctrl.dev_ready = rb150_nand_dev_ready;
-
- err = platform_device_add_data(pdev, &rb1xx_nand_data,
- sizeof(rb1xx_nand_data));
- if (err)
- goto err_put;
-
- err = platform_device_add(pdev);
- if (err)
- goto err_put;
-
- return;
-
-err_put:
- platform_device_put(pdev);
-err_out:
- return;
-}
-
-static void __init rb150_setup(void)
-{
- rb1xx_gpio_buttons[0].gpio = RB150_GPIO_RESET_BUTTON;
- rb1xx_generic_setup();
- rb150_add_device_nand();
-
- adm5120_add_device_gpio_leds(ARRAY_SIZE(rb150_gpio_leds),
- rb150_gpio_leds);
- adm5120_add_device_switch(5, rb150_vlans);
-}
-
-MIPS_MACHINE(MACH_ADM5120_RB_150, "miniROUTER", "Mikrotik RouterBOARD 150",
- rb150_setup);
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 153 support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "rb-1xx.h"
-
-static struct resource rb153_cf_resources[] __initdata = {
- {
- .name = "cf_membase",
- .start = ADM5120_EXTIO1_BASE,
- .end = ADM5120_EXTIO1_BASE + ADM5120_EXTIO1_SIZE-1 ,
- .flags = IORESOURCE_MEM
- }, {
- .name = "cf_irq",
- .start = ADM5120_IRQ_GPIO4,
- .end = ADM5120_IRQ_GPIO4,
- .flags = IORESOURCE_IRQ
- }
-};
-
-static struct gpio_led rb153_gpio_leds[] __initdata = {
- GPIO_LED_STD(ADM5120_GPIO_PIN5, "user", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L1, "lan1_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan1_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L1, "lan5_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan5_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L1, "lan4_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan4_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L1, "lan3_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan3_lnkact", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L1, "lan2_speed", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "lan2_lnkact", NULL),
-};
-
-static u8 rb153_vlans[6] __initdata = {
- 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static void __init rb153_add_device_cf(void)
-{
- /* enable CSX1:INTX1 on GPIO[3:4] for the CF slot */
- adm5120_gpio_csx1_enable();
-
- /* enable the wait state pin GPIO[0] for external I/O control */
- adm5120_gpio_ew_enable();
-
- platform_device_register_simple("pata-rb153-cf", -1,
- rb153_cf_resources, ARRAY_SIZE(rb153_cf_resources));
-}
-
-static void __init rb153_setup(void)
-{
- rb1xx_generic_setup();
- rb1xx_add_device_nand();
- rb153_add_device_cf();
-
- adm5120_add_device_gpio_leds(ARRAY_SIZE(rb153_gpio_leds),
- rb153_gpio_leds);
- adm5120_add_device_switch(5, rb153_vlans);
-}
-
-MIPS_MACHINE(MACH_ADM5120_RB_153, "150", "Mikrotik RouterBOARD 153",
- rb153_setup);
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 192 support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "rb-1xx.h"
-
-static u8 rb192_vlans[6] __initdata = {
- 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static void __init rb192_setup(void)
-{
- rb1xx_generic_setup();
- rb1xx_add_device_nand();
-
- adm5120_add_device_switch(6, rb192_vlans);
-}
-
-MIPS_MACHINE(MACH_ADM5120_RB_192, "192", "Mikrotik RouterBOARD 192",
- rb192_setup);
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 1xx series support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * NAND initialization code was based on a driver for Linux 2.6.19+ which
- * was derived from the driver for Linux 2.4.xx published by Mikrotik for
- * their RouterBoard 1xx and 5xx series boards.
- * Copyright (C) 2007 David Goodenough <david.goodenough@linkchoose.co.uk>
- * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "rb-1xx.h"
-
-#define RB1XX_NAND_CHIP_DELAY 25
-
-#define RB1XX_KEYS_POLL_INTERVAL 20
-#define RB1XX_KEYS_DEBOUNCE_INTERVAL (3 * RB1XX_KEYS_POLL_INTERVAL)
-
-static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
- PCIIRQ(1, 0, 1, ADM5120_IRQ_PCI0),
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI1),
- PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2)
-};
-
-static struct mtd_partition rb1xx_nor_parts[] = {
- {
- .name = "booter",
- .offset = 0,
- .size = 64*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static struct mtd_partition rb1xx_nand_parts[] = {
- {
- .name = "kernel",
- .offset = 0,
- .size = 4 * 1024 * 1024,
- } , {
- .name = "rootfs",
- .offset = MTDPART_OFS_NXTBLK,
- .size = MTDPART_SIZ_FULL
- }
-};
-
-/*
- * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader
- * will not be able to find the kernel that we load. So set the oobinfo
- * when creating the partitions
- */
-static struct nand_ecclayout rb1xx_nand_ecclayout = {
- .eccbytes = 6,
- .eccpos = { 8, 9, 10, 13, 14, 15 },
- .oobavail = 9,
- .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }
-};
-
-/*--------------------------------------------------------------------------*/
-
-static int rb1xx_nand_fixup(struct mtd_info *mtd)
-{
- struct nand_chip *chip = mtd->priv;
-
- if (mtd->writesize == 512)
- chip->ecc.layout = &rb1xx_nand_ecclayout;
-
- return 0;
-}
-
-struct platform_nand_data rb1xx_nand_data __initdata = {
- .chip = {
- .nr_chips = 1,
- .nr_partitions = ARRAY_SIZE(rb1xx_nand_parts),
- .partitions = rb1xx_nand_parts,
- .chip_delay = RB1XX_NAND_CHIP_DELAY,
- .chip_fixup = rb1xx_nand_fixup,
- },
-};
-
-struct gpio_keys_button rb1xx_gpio_buttons[] __initdata = {
- {
- .desc = "reset_button",
- .type = EV_KEY,
- .code = KEY_RESTART,
- .debounce_interval = RB1XX_KEYS_DEBOUNCE_INTERVAL,
- .gpio = ADM5120_GPIO_PIN7,
- }
-};
-
-static void __init rb1xx_mac_setup(void)
-{
- if (rb_hs.mac_base != NULL && is_valid_ether_addr(rb_hs.mac_base)) {
- adm5120_setup_eth_macs(rb_hs.mac_base);
- } else {
- u8 mac[ETH_ALEN];
-
- random_ether_addr(mac);
- adm5120_setup_eth_macs(mac);
- }
-}
-
-void __init rb1xx_add_device_flash(void)
-{
- /* setup data for flash0 device */
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_nor_parts);
- adm5120_flash0_data.parts = rb1xx_nor_parts;
- adm5120_flash0_data.window_size = 128*1024;
-
- adm5120_add_device_flash(0);
-}
-
-void __init rb1xx_add_device_nand(void)
-{
- /* enable NAND flash interface */
- adm5120_nand_enable();
-
- /* initialize NAND chip */
- adm5120_nand_set_spn(1);
- adm5120_nand_set_wpn(0);
-
- adm5120_add_device_nand(&rb1xx_nand_data);
-}
-
-void __init rb1xx_generic_setup(void)
-{
- if (adm5120_package_bga())
- adm5120_pci_set_irq_map(ARRAY_SIZE(rb1xx_pci_irqs),
- rb1xx_pci_irqs);
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- adm5120_register_gpio_buttons(-1, RB1XX_KEYS_POLL_INTERVAL,
- ARRAY_SIZE(rb1xx_gpio_buttons),
- rb1xx_gpio_buttons);
-
- rb1xx_add_device_flash();
- rb1xx_mac_setup();
-}
+++ /dev/null
-/*
- * Mikrotik RouterBOARD 1xx series support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_nand.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-
-#include <prom/routerboot.h>
-
-extern struct platform_nand_data rb1xx_nand_data __initdata;
-extern struct gpio_keys_button rb1xx_gpio_buttons[] __initdata;
-
-extern void rb1xx_add_device_flash(void) __init;
-extern void rb1xx_add_device_nand(void) __init;
-extern void rb1xx_generic_setup(void) __init;
+++ /dev/null
-obj-$(CONFIG_ADM5120_MACH_PMUGW) += pmugw.o
+++ /dev/null
-/*
- * Motorola Powerline MU Gateway board
- *
- * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-
-#include <prom/admboot.h>
-
-#define PMUGW_CONFIG_OFFSET 0x10000
-#define PMUGW_CONFIG_SIZE 0x1000
-
-static struct mtd_partition pmugw_partitions[] = {
- {
- .name = "admboot",
- .offset = 0,
- .size = 64*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "boardcfg",
- .offset = MTDPART_OFS_APPEND,
- .size = 64*1024,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static u8 pmugw_vlans[6] __initdata = {
- 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
-};
-
-static __init void pmugw_setup_mac(void)
-{
- u8 mac_base[6];
- int err;
-
- err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET,
- PMUGW_CONFIG_SIZE, mac_base);
-
- if ((err) || !is_valid_ether_addr(mac_base))
- random_ether_addr(mac_base);
-
- adm5120_setup_eth_macs(mac_base);
-}
-
-static void switch_bank_gpio5(unsigned bank)
-{
- switch (bank) {
- case 0:
- gpio_set_value(ADM5120_GPIO_PIN5, 0);
- break;
- case 1:
- gpio_set_value(ADM5120_GPIO_PIN5, 1);
- break;
- }
-}
-
-void __init pmugw_setup(void)
-{
- /* setup flash A20 line */
- gpio_request(ADM5120_GPIO_PIN5, NULL);
- gpio_direction_output(ADM5120_GPIO_PIN5, 0);
- adm5120_flash0_data.switch_bank = switch_bank_gpio5;
-
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions);
- adm5120_flash0_data.parts = pmugw_partitions;
-
- adm5120_add_device_uart(1); /* ttyAM0 */
- adm5120_add_device_uart(0); /* ttyAM1 */
-
- adm5120_add_device_flash(0);
-
- pmugw_setup_mac();
- adm5120_add_device_switch(5, pmugw_vlans);
-}
-
-MIPS_MACHINE(MACH_ADM5120_PMUGW, "PMUGW", "Motorola Powerline MU Gateway",
- pmugw_setup);
+++ /dev/null
-/*
- * OSBRiDGE 5GXi/5XLi board support
- *
- * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-#include <linux/etherdevice.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-
-static struct mtd_partition osbridge_5gxi_partitions[] = {
- {
- .name = "bootloader",
- .offset = 0,
- .size = 64*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "boardcfg",
- .offset = 64*1024,
- .size = 64*1024,
- } , {
- .name = "firmware",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static struct gpio_led osbridge_5gxi_gpio_leds[] __initdata = {
- GPIO_LED_INV(ADM5120_GPIO_PIN6, "5gxi:green:user", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "5gxi:yellow:lan", NULL),
-};
-
-static struct adm5120_pci_irq osbridge_5gxi_pci_irqs[] __initdata = {
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
-};
-
-static u8 osbridge_5gxi_vlans[6] __initdata = {
- 0x41, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static void __init osbridge_5gxi_setup(void)
-{
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(osbridge_5gxi_partitions);
- adm5120_flash0_data.parts = osbridge_5gxi_partitions;
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- adm5120_add_device_flash(0);
-
- adm5120_add_device_switch(1, osbridge_5gxi_vlans);
- adm5120_add_device_gpio_leds(ARRAY_SIZE(osbridge_5gxi_gpio_leds),
- osbridge_5gxi_gpio_leds);
- adm5120_pci_set_irq_map(ARRAY_SIZE(osbridge_5gxi_pci_irqs),
- osbridge_5gxi_pci_irqs);
-}
-
-MIPS_MACHINE(MACH_ADM5120_5GXI, "5GXi", "OSBRiDGE 5GXi/5XLi board",
- osbridge_5gxi_setup);
+++ /dev/null
-obj-$(CONFIG_ADM5120_MACH_5GXI) += 5gxi.o
+++ /dev/null
-#
-# Makefile for the ADMtek ADM5120 SoC specific parts of the kernel
-#
-
-lib-y += admboot.o
-lib-y += bootbase.o
-lib-y += cfe.o
-lib-y += generic.o
-lib-y += myloader.o
-lib-y += routerboot.o
+++ /dev/null
-/*
- * ADMBoot specific prom routines
- *
- * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-
-#include <asm/addrspace.h>
-#include <asm/byteorder.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <prom/admboot.h>
-#include "prom_read.h"
-
-#define ADMBOOT_MAGIC_MAC_BASE 0x636D676D /* 'mgmc' */
-#define ADMBOOT_MAGIC_MAC_BASE_BR6104XX 0x31305348 /* 'HS01' */
-
-int __init admboot_get_mac_base(u32 offset, u32 len, u8 *mac)
-{
- u8 *cfg;
- int i;
-
- cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + offset);
- for (i = 0; i < len; i += 4) {
- u32 magic;
-
- magic = prom_read_le32(cfg + i);
- if (magic == ADMBOOT_MAGIC_MAC_BASE) {
- int j;
-
- for (j = 0; j < 6; j++)
- mac[j] = cfg[i + 4 + j];
-
- return 0;
- }
- if (magic == ADMBOOT_MAGIC_MAC_BASE_BR6104XX) {
- int j;
-
- for (j = 0; j < 6; j++)
- mac[j] = cfg[i + 7 + j];
-
- return 0;
- }
- }
-
- return -ENXIO;
-}
+++ /dev/null
-/*
- * ZyXEL's Bootbase specific prom routines
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/string.h>
-
-#include <asm/bootinfo.h>
-#include <asm/addrspace.h>
-#include <asm/byteorder.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <prom/zynos.h>
-#include "prom_read.h"
-
-#define ZYNOS_INFO_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x3F90)
-#define ZYNOS_HDBG_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x4000)
-#define BOOTEXT_ADDR_MIN KSEG1ADDR(ADM5120_SRAM0_BASE)
-#define BOOTEXT_ADDR_MAX (BOOTEXT_ADDR_MIN + (2*1024*1024))
-
-static int bootbase_found;
-static struct zynos_board_info *board_info;
-
-struct bootbase_info bootbase_info;
-
-static inline int bootbase_dbgarea_present(u8 *data)
-{
- u32 t;
-
- t = prom_read_be32(data+5);
- if (t != ZYNOS_MAGIC_DBGAREA1)
- return 0;
-
- t = prom_read_be32(data+9);
- if (t != ZYNOS_MAGIC_DBGAREA2)
- return 0;
-
- return 1;
-}
-
-static inline u32 bootbase_get_bootext_addr(void)
-{
- return prom_read_be32(&board_info->bootext_addr);
-}
-
-static inline void bootbase_get_mac(u8 *mac)
-{
- int i;
-
- for (i = 0; i < 6; i++)
- mac[i] = board_info->mac[i];
-}
-
-static inline u16 bootbase_get_vendor_id(void)
-{
-#define CHECK_VENDOR(n) (strnicmp(board_info->vendor, (n), strlen(n)) == 0)
- unsigned char vendor[ZYNOS_NAME_LEN];
- int i;
-
- for (i = 0; i < ZYNOS_NAME_LEN; i++)
- vendor[i] = board_info->vendor[i];
-
- if CHECK_VENDOR(ZYNOS_VENDOR_ZYXEL)
- return ZYNOS_VENDOR_ID_ZYXEL;
-
- if CHECK_VENDOR(ZYNOS_VENDOR_DLINK)
- return ZYNOS_VENDOR_ID_DLINK;
-
- if CHECK_VENDOR(ZYNOS_VENDOR_LUCENT)
- return ZYNOS_VENDOR_ID_LUCENT;
-
- if CHECK_VENDOR(ZYNOS_VENDOR_NETGEAR)
- return ZYNOS_VENDOR_ID_NETGEAR;
-
- return ZYNOS_VENDOR_ID_OTHER;
-}
-
-static inline u16 bootbase_get_board_id(void)
-{
- return prom_read_be16(&board_info->board_id);
-}
-
-int __init bootbase_present(void)
-{
- u32 t;
-
- if (bootbase_found)
- goto out;
-
- /* check presence of the dbgarea */
- if (bootbase_dbgarea_present((u8 *)ZYNOS_HDBG_ADDR) == 0)
- goto out;
-
- board_info = (struct zynos_board_info *)(ZYNOS_INFO_ADDR);
-
- /* check for a valid BootExt address */
- t = bootbase_get_bootext_addr();
- if ((t < BOOTEXT_ADDR_MIN) || (t > BOOTEXT_ADDR_MAX))
- goto out;
-
- bootbase_info.vendor_id = bootbase_get_vendor_id();
- bootbase_info.board_id = bootbase_get_board_id();
- bootbase_get_mac(bootbase_info.mac);
-
- bootbase_found = 1;
-
-out:
- return bootbase_found;
-}
-
+++ /dev/null
-/*
- * Broadcom's CFE specific prom routines
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/types.h>
-#include <linux/init.h>
-
-#include <asm/bootinfo.h>
-#include <asm/addrspace.h>
-
-#include <prom/cfe.h>
-#include "prom_read.h"
-
-/*
- * CFE based boards
- */
-#define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE
-from other bootloaders */
-
-static int cfe_found;
-
-static u32 cfe_handle;
-static u32 cfe_entry;
-static u32 cfe_seal;
-
-int __init cfe_present(void)
-{
- /*
- * This method only works, when we are booted directly from the CFE.
- */
- u32 a1 = (u32) fw_arg1;
-
- if (cfe_found)
- return 1;
-
- cfe_handle = (u32) fw_arg0;
- cfe_entry = (u32) fw_arg2;
- cfe_seal = (u32) fw_arg3;
-
- /* Check for CFE by finding the CFE magic number */
- if (cfe_seal != CFE_EPTSEAL)
- return 0;
-
- /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 */
- if (a1 != 0)
- return 0;
-
- /* The cfe_handle, and the cfe_entry must be kernel mode addresses */
- if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0))
- return 0;
-
- cfe_found = 1;
- return 1;
-}
-
-char *cfe_getenv(char *envname)
-{
- if (cfe_found == 0)
- return NULL;
-
- return NULL;
-}
+++ /dev/null
-/*
- * Generic PROM routines
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/string.h>
-
-#include <asm/bootinfo.h>
-
-#include <prom/generic.h>
-
-static int *_prom_argc;
-static char **_prom_argv;
-static char **_prom_envp;
-
-char *generic_prom_getenv(char *envname)
-{
- char **env;
- char *ret;
-
- ret = NULL;
- for (env = _prom_envp; *env != NULL; env++) {
- if (strcmp(envname, *env++) == 0) {
- ret = *env;
- break;
- }
- }
-
- return ret;
-}
-
-int generic_prom_present(void)
-{
- _prom_argc = (int *)fw_arg0;
- _prom_argv = (char **)fw_arg1;
- _prom_envp = (char **)fw_arg2;
-
- return 1;
-}
+++ /dev/null
-/*
- * Compex's MyLoader specific prom routines
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/string.h>
-
-#include <asm/bootinfo.h>
-#include <asm/addrspace.h>
-#include <asm/byteorder.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <prom/myloader.h>
-#include "prom_read.h"
-
-#define SYS_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F000)
-#define BOARD_PARAMS_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x0F800)
-#define PART_TABLE_ADDR KSEG1ADDR(ADM5120_SRAM0_BASE+0x10000)
-
-static int myloader_found;
-
-struct myloader_info myloader_info;
-
-int __init myloader_present(void)
-{
- struct mylo_system_params *sysp;
- struct mylo_board_params *boardp;
- struct mylo_partition_table *parts;
- int i;
-
- if (myloader_found)
- goto out;
-
- sysp = (struct mylo_system_params *)(SYS_PARAMS_ADDR);
- boardp = (struct mylo_board_params *)(BOARD_PARAMS_ADDR);
- parts = (struct mylo_partition_table *)(PART_TABLE_ADDR);
-
- /* Check for some magic numbers */
- if ((le32_to_cpu(sysp->magic) != MYLO_MAGIC_SYS_PARAMS) ||
- (le32_to_cpu(boardp->magic) != MYLO_MAGIC_BOARD_PARAMS) ||
- (le32_to_cpu(parts->magic) != MYLO_MAGIC_PARTITIONS))
- goto out;
-
- myloader_info.vid = le32_to_cpu(sysp->vid);
- myloader_info.did = le32_to_cpu(sysp->did);
- myloader_info.svid = le32_to_cpu(sysp->svid);
- myloader_info.sdid = le32_to_cpu(sysp->sdid);
-
- for (i = 0; i < MYLO_ETHADDR_COUNT; i++) {
- int j;
- for (j = 0; j < 6; j++)
- myloader_info.macs[i][j] = boardp->addr[i].mac[j];
- }
-
- myloader_found = 1;
-
-out:
- return myloader_found;
-}
+++ /dev/null
-/*
- * Generic prom definitions
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _ADM5120_PROM_H_
-#define _ADM5120_PROM_H_
-
-/*
- * Helper routines
- */
-static inline u16 prom_read_le16(void *buf)
-{
- u8 *p = buf;
-
- return ((u16)p[0] + ((u16)p[1] << 8));
-}
-
-static inline u32 prom_read_le32(void *buf)
-{
- u8 *p = buf;
-
- return ((u32)p[0] + ((u32)p[1] << 8) + ((u32)p[2] << 16) +
- ((u32)p[3] << 24));
-}
-
-static inline u16 prom_read_be16(void *buf)
-{
- u8 *p = buf;
-
- return (((u16)p[0] << 8) + (u16)p[1]);
-}
-
-static inline u32 prom_read_be32(void *buf)
-{
- u8 *p = buf;
-
- return (((u32)p[0] << 24) + ((u32)p[1] << 16) + ((u32)p[2] << 8) +
- ((u32)p[3]));
-}
-
-#endif /* _ADM5120_PROM_H_ */
-
-
+++ /dev/null
-/*
- * Mikrotik's RouterBOOT specific prom routines
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include <linux/routerboot.h>
-
-#include <asm/bootinfo.h>
-#include <asm/addrspace.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <prom/routerboot.h>
-#include "prom_read.h"
-
-struct rb_hard_settings rb_hs;
-static int rb_found;
-
-static int __init routerboot_load_hs(u8 *buf, u16 buflen)
-{
- u16 id, len;
-
- memset(&rb_hs, 0, sizeof(rb_hs));
-
- if (buflen < 4)
- return -1;
-
- if (prom_read_le32(buf) != RB_MAGIC_HARD)
- return -1;
-
- /* skip magic value */
- buf += 4;
- buflen -= 4;
-
- while (buflen > 2) {
- id = prom_read_le16(buf);
- buf += 2;
- buflen -= 2;
- if (id == RB_ID_TERMINATOR || buflen < 2)
- break;
-
- len = prom_read_le16(buf);
- buf += 2;
- buflen -= 2;
-
- if (buflen < len)
- break;
-
- switch (id) {
- case RB_ID_BIOS_VERSION:
- rb_hs.bios_ver = (char *)buf;
- break;
- case RB_ID_BOARD_NAME:
- rb_hs.name = (char *)buf;
- break;
- case RB_ID_MEMORY_SIZE:
- rb_hs.mem_size = prom_read_le32(buf);
- break;
- case RB_ID_MAC_ADDRESS_COUNT:
- rb_hs.mac_count = prom_read_le32(buf);
- break;
- case RB_ID_MAC_ADDRESS_PACK:
- if ((len / RB_MAC_SIZE) > 0)
- rb_hs.mac_base = buf;
- break;
- }
-
- buf += len;
- buflen -= len;
-
- }
-
- return 0;
-}
-
-#define RB_BS_OFFS 0x14
-#define RB_OFFS_MAX (128*1024)
-
-int __init routerboot_present(void)
-{
- struct rb_bios_settings *bs;
- u8 *base;
- u32 off, len;
-
- if (rb_found)
- goto out;
-
- base = (u8 *)KSEG1ADDR(ADM5120_SRAM0_BASE);
- bs = (struct rb_bios_settings *)(base + RB_BS_OFFS);
-
- off = prom_read_le32(&bs->hs_offs);
- len = prom_read_le32(&bs->hs_size);
- if (off > RB_OFFS_MAX)
- goto out;
-
- if (routerboot_load_hs(base+off, len) != 0)
- goto out;
-
- rb_found = 1;
-
-out:
- return rb_found;
-}
-
-char *routerboot_get_boardname(void)
-{
- if (rb_found == 0)
- return NULL;
-
- return rb_hs.name;
-}
+++ /dev/null
-obj-y += p-33x.o
-
-obj-${CONFIG_ADM5120_MACH_P_334WT} += p-334wt.o
-obj-${CONFIG_ADM5120_MACH_P_335} += p-335.o
\ No newline at end of file
+++ /dev/null
-/*
- * ZyXEL Prestige P-334WT support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "p-33x.h"
-
-static struct gpio_led p334wt_gpio_leds[] __initdata = {
- GPIO_LED_INV(ADM5120_GPIO_PIN2, "power", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P3L0, "lan1", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L0, "lan2", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L0, "lan3", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P0L0, "lan4", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L0, "wan", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P4L2, "wlan", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P2L2, "otist", NULL),
- GPIO_LED_INV(ADM5120_GPIO_P1L2, "hidden", NULL),
-};
-
-static void __init p334wt_setup(void)
-{
- p33x_generic_setup();
- adm5120_add_device_gpio_leds(ARRAY_SIZE(p334wt_gpio_leds),
- p334wt_gpio_leds);
-}
-
-MIPS_MACHINE(MACH_ADM5120_P334WT, "P-334WT", "ZyXEL Prestige 334WT",
- p334wt_setup);
+++ /dev/null
-/*
- * ZyXEL Prestige P-335/335WT support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "p-33x.h"
-
-static void __init p335_setup(void)
-{
- p33x_generic_setup();
- adm5120_add_device_usb();
-}
-
-MIPS_MACHINE(MACH_ADM5120_P335, "P-335", "ZyXEL Prestige 335/335WT",
- p335_setup);
+++ /dev/null
-/*
- * ZyXEL Prestige P-33x boards support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include "p-33x.h"
-
-#include <prom/zynos.h>
-
-#define P33X_GPIO_FLASH_A20 ADM5120_GPIO_PIN5
-static struct mtd_partition p33x_partitions[] = {
- {
- .name = "bootbase",
- .offset = 0,
- .size = 16*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "rom",
- .offset = MTDPART_OFS_APPEND,
- .size = 16*1024,
- .mask_flags = MTD_WRITEABLE,
- } , {
- .name = "bootext1",
- .offset = MTDPART_OFS_APPEND,
- .size = 32*1024,
- } , {
- .name = "bootext2",
- .offset = MTDPART_OFS_APPEND,
- .size = 64*1024,
- } , {
- .name = "trx",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL,
- } , {
- .name = "firmware",
- .offset = 32*1024,
- .size = MTDPART_SIZ_FULL,
- }
-};
-
-static struct adm5120_pci_irq p33x_pci_irqs[] __initdata = {
- PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
-};
-
-static u8 p33x_vlans[6] __initdata = {
- /* FIXME: untested */
- 0x50, 0x48, 0x44, 0x42, 0x41, 0x00
-};
-
-static void switch_bank_gpio5(unsigned bank)
-{
- switch (bank) {
- case 0:
- gpio_set_value(P33X_GPIO_FLASH_A20, 0);
- break;
- case 1:
- gpio_set_value(P33X_GPIO_FLASH_A20, 1);
- break;
- }
-}
-
-void __init p33x_generic_setup(void)
-{
- /* setup data for flash0 device */
- gpio_request(P33X_GPIO_FLASH_A20, NULL); /* for flash A20 line */
- gpio_direction_output(P33X_GPIO_FLASH_A20, 0);
- adm5120_flash0_data.switch_bank = switch_bank_gpio5;
- adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions);
- adm5120_flash0_data.parts = p33x_partitions;
- adm5120_add_device_flash(0);
-
- adm5120_add_device_uart(0);
- adm5120_add_device_uart(1);
-
- adm5120_setup_eth_macs(bootbase_info.mac);
- adm5120_add_device_switch(6, p33x_vlans);
-
- adm5120_pci_set_irq_map(ARRAY_SIZE(p33x_pci_irqs), p33x_pci_irqs);
-}
+++ /dev/null
-/*
- * ZyXEL Prestige P-33x boards support
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/gpio.h>
-#include <linux/irq.h>
-
-#include <asm/mips_machine.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-extern void p33x_generic_setup(void) __init;
+++ /dev/null
-/*
- * ADM5120 SoC definitions
- *
- * This file defines some constants specific to the ADM5120 SoC
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-#ifndef _ASM_MIPS_MACH_ADM5120_DEFS_H
-#define _ASM_MIPS_MACH_ADM5120_DEFS_H
-
-#define ADM5120_SDRAM0_BASE 0x00000000
-#define ADM5120_SDRAM1_BASE 0x01000000
-#define ADM5120_SRAM1_BASE 0x10000000
-#define ADM5120_EXTIO0_BASE 0x10C00000
-#define ADM5120_EXTIO0_SIZE 0x00200000
-#define ADM5120_EXTIO1_BASE 0x10E00000
-#define ADM5120_EXTIO1_SIZE 0x00200000
-#define ADM5120_MPMC_BASE 0x11000000
-#define ADM5120_MPMC_SIZE 0x00200000
-#define ADM5120_USBC_BASE 0x11200000
-#define ADM5120_USBC_SIZE 0x00200000
-#define ADM5120_PCIMEM_BASE 0x11400000
-#define ADM5120_PCIMEM_SIZE 0x00100000
-#define ADM5120_PCIIO_BASE 0x11500000
-#define ADM5120_PCIIO_SIZE 0x000FFFF0
-#define ADM5120_PCICFG_ADDR 0x115FFFF0
-#define ADM5120_PCICFG_DATA 0x115FFFF8
-#define ADM5120_PCICFG_SIZE 0x00000010
-#define ADM5120_SWITCH_BASE 0x12000000
-#define ADM5120_SWITCH_SIZE 0x00200000
-#define ADM5120_INTC_BASE 0x12200000
-#define ADM5120_INTC_SIZE 0x00200000
-#define ADM5120_UART0_BASE 0x12600000
-#define ADM5120_UART1_BASE 0x12800000
-#define ADM5120_UART_SIZE 0x00200000
-#define ADM5120_SRAM0_BASE 0x1FC00000
-
-#define ADM5120_NAND_BASE ADM5120_SRAM1_BASE
-#define ADM5120_NAND_SIZE 0xB
-
-#define ADM5120_CLK_175 175000000
-#define ADM5120_CLK_200 200000000
-#define ADM5120_CLK_225 225000000
-#define ADM5120_CLK_250 250000000
-
-#define ADM5120_UART_CLOCK 62500000
-
-#endif /* _ASM_MIPS_MACH_ADM5120_DEFS_H */
+++ /dev/null
-/*
- * Copyright (C) 2007-2009 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _MACH_ADM5120_INFO_H
-#define _MACH_ADM5120_INFO_H
-
-#include <linux/types.h>
-
-extern unsigned int adm5120_prom_type;
-#define ADM5120_PROM_GENERIC 0
-#define ADM5120_PROM_CFE 1
-#define ADM5120_PROM_MYLOADER 2
-#define ADM5120_PROM_ROUTERBOOT 3
-#define ADM5120_PROM_BOOTBASE 4
-#define ADM5120_PROM_UBOOT 5
-#define ADM5120_PROM_LAST 5
-
-extern unsigned int adm5120_product_code;
-extern unsigned int adm5120_revision;
-extern unsigned int adm5120_nand_boot;
-
-extern unsigned long adm5120_speed;
-#define ADM5120_SPEED_175 175000000
-#define ADM5120_SPEED_200 200000000
-#define ADM5120_SPEED_225 225000000
-#define ADM5120_SPEED_250 250000000
-
-extern unsigned int adm5120_package;
-#define ADM5120_PACKAGE_PQFP 0
-#define ADM5120_PACKAGE_BGA 1
-
-extern unsigned long adm5120_memsize;
-
-enum {
- MACH_ADM5120_GENERIC = 0, /* Generic board */
- MACH_ADM5120_5GXI, /* OSBRiDGE 5GXi/5XLi */
- MACH_ADM5120_BR6104K, /* Edimax BR-6104K */
- MACH_ADM5120_BR6104KP, /* Edimax BR-6104KP */
- MACH_ADM5120_BR61X4WG, /* Edimax BR-6104Wg/BR-6114WG */
- MACH_ADM5120_CAS630, /* Cellvision CAS-630/630W */
- MACH_ADM5120_CAS670, /* Cellvision CAS-670/670W */
- MACH_ADM5120_CAS700, /* Cellvision CAS-700/700W */
- MACH_ADM5120_CAS771, /* Cellvision CAS-771/771W */
- MACH_ADM5120_CAS790, /* Cellvision CAS-790 */
- MACH_ADM5120_CAS861, /* Cellvision CAS-861/861W */
- MACH_ADM5120_EASY5120PATA, /* Infineon EASY 5120P-ATA */
- MACH_ADM5120_EASY5120RT, /* Infineon EASY 5120-RT */
- MACH_ADM5120_EASY5120WVOIP, /* Infineon EASY 5120-WVoIP */
- MACH_ADM5120_EASY83000, /* Infineon EASY-83000 */
- MACH_ADM5120_ES2108, /* ZyXEL Ethernet Switch 2108 */
- MACH_ADM5120_ES2108F, /* ZyXEL Ethernet Switch 2108-F */
- MACH_ADM5120_ES2108G, /* ZyXEL Ethernet Switch 2108-G */
- MACH_ADM5120_ES2108LC, /* ZyXEL Ethernet Switch 2108-LC */
- MACH_ADM5120_ES2108PWR, /* ZyXEL Ethernet Switch 2108-PWR */
- MACH_ADM5120_ES2024A, /* ZyXEL Ethernet Switch 2024A */
- MACH_ADM5120_ES2024PWR, /* ZyXEL Ethernet Switch 2024PWR */
- MACH_ADM5120_HS100, /* ZyXEL HomeSafe 100/100W */
- MACH_ADM5120_NFS101U, /* Cellvision NFS-101U/101WU */
- MACH_ADM5120_NFS202U, /* Cellvision NFS-202U/202WU */
- MACH_ADM5120_NP28G, /* Compex NP28G */
- MACH_ADM5120_NP28GHS, /* Compex NP28G HotSpot */
- MACH_ADM5120_NP27G, /* Compex NP27G */
- MACH_ADM5120_RB_11X, /* Mikrotik RouterBOARD 111/112 */
- MACH_ADM5120_RB_133, /* Mikrotik RouterBOARD 133 */
- MACH_ADM5120_RB_133C, /* Mikrotik RouterBOARD 133c */
- MACH_ADM5120_RB_150, /* Mikrotik RouterBOARD 150 */
- MACH_ADM5120_RB_153, /* Mikrotik RouterBOARD 153 */
- MACH_ADM5120_RB_192, /* Mikrotik RouterBOARD 192 */
- MACH_ADM5120_P334U, /* ZyXEL Prestige 334U */
- MACH_ADM5120_P334W, /* ZyXEL Prestige 334W */
- MACH_ADM5120_P334WH, /* ZyXEL Prestige 334WH */
- MACH_ADM5120_P334WHD, /* ZyXEL Prestige 334WHD */
- MACH_ADM5120_P334WT, /* ZyXEL Prestige 334WT */
- MACH_ADM5120_P335, /* ZyXEL Prestige 335/335WT */
- MACH_ADM5120_P335PLUS, /* ZyXEL Prestige 335Plus */
- MACH_ADM5120_P335U, /* ZyXEL Prestige 335U */
- MACH_ADM5120_PMUGW, /* Motorola Powerline MU Gateway */
- MACH_ADM5120_WP54, /* Compex WP54G/WP54AG/WPP54G/WPP54AG */
- MACH_ADM5120_WP54G_WRT, /* Compex WP54G-WRT */
- MACH_ADM5120_WP54Gv1C, /* Compex WP54G version 1C */
- MACH_ADM5120_EB_214A, /* Generic EB-214A */
-};
-
-/*
- * TODO:remove adm5120_eth* variables when the switch driver will be
- * converted into a real platform driver
- */
-extern unsigned int adm5120_eth_num_ports;
-extern unsigned char adm5120_eth_macs[6][6];
-extern unsigned char adm5120_eth_vlans[6];
-
-extern void adm5120_soc_init(void) __init;
-extern void adm5120_mem_init(void) __init;
-extern void adm5120_ndelay(u32 ns);
-
-extern void (*adm5120_board_reset)(void);
-
-extern void adm5120_gpio_init(void) __init;
-extern void adm5120_gpio_csx0_enable(void) __init;
-extern void adm5120_gpio_csx1_enable(void) __init;
-extern void adm5120_gpio_ew_enable(void) __init;
-
-static inline int adm5120_package_pqfp(void)
-{
- return (adm5120_package == ADM5120_PACKAGE_PQFP);
-}
-
-static inline int adm5120_package_bga(void)
-{
- return (adm5120_package == ADM5120_PACKAGE_BGA);
-}
-
-static inline int adm5120_has_pci(void)
-{
- return (adm5120_package == ADM5120_PACKAGE_BGA);
-}
-
-static inline int adm5120_has_gmii(void)
-{
- return (adm5120_package == ADM5120_PACKAGE_BGA);
-}
-
-#endif /* _MACH_ADM5120_INFO_H */
+++ /dev/null
-/*
- * ADM5120 interrupt controller definitions
- *
- * This header file defines the hardware registers of the ADM5120 SoC
- * built-in interrupt controller.
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _MACH_ADM5120_INTC_H
-#define _MACH_ADM5120_INTC_H
-
-/*
- * INTC register offsets
- */
-#define INTC_REG_IRQ_STATUS 0x00 /* Interrupt status after masking */
-#define INTC_REG_IRQ_RAW_STATUS 0x04 /* Interrupt status before masking */
-#define INTC_REG_IRQ_ENABLE 0x08 /* Used to enable the interrupt sources */
-#define INTC_REG_IRQ_ENABLE_CLEAR 0x0C /* Used to disable the interrupt sources */
-#define INTC_REG_IRQ_DISABLE INTC_REG_IRQ_ENABLE_CLEAR
-#define INTC_REG_INT_MODE 0x14 /* The interrupt mode of the sources */
-#define INTC_REG_FIQ_STATUS 0x18 /* FIQ status */
-#define INTC_REG_IRQ_TEST_SOURCE 0x1C
-#define INTC_REG_IRQ_SOURCE_SELECT 0x20
-#define INTC_REG_INT_LEVEL 0x24
-
-/*
- * INTC IRQ numbers
- */
-#define INTC_IRQ_TIMER 0 /* built in timer */
-#define INTC_IRQ_UART0 1 /* built-in UART0 */
-#define INTC_IRQ_UART1 2 /* built-in UART1 */
-#define INTC_IRQ_USBC 3 /* USB Host Controller */
-#define INTC_IRQ_GPIO2 4 /* GPIO line 2 */
-#define INTC_IRQ_GPIO4 5 /* GPIO line 4 */
-#define INTC_IRQ_PCI0 6 /* PCI slot 2 */
-#define INTC_IRQ_PCI1 7 /* PCI slot 3 */
-#define INTC_IRQ_PCI2 8 /* PCI slot 4 */
-#define INTC_IRQ_SWITCH 9 /* built-in ethernet switch */
-#define INTC_IRQ_LAST INTC_IRQ_SWITCH
-#define INTC_IRQ_COUNT 10
-
-/*
- * INTC register bits
- */
-#define INTC_INT_TIMER (1 << INTC_IRQ_TIMER)
-#define INTC_INT_UART0 (1 << INTC_IRQ_UART0)
-#define INTC_INT_UART1 (1 << INTC_IRQ_UART1)
-#define INTC_INT_USBC (1 << INTC_IRQ_USBC)
-#define INTC_INT_INTX0 (1 << INTC_IRQ_INTX0)
-#define INTC_INT_INTX1 (1 << INTC_IRQ_INTX1)
-#define INTC_INT_PCI0 (1 << INTC_IRQ_PCI0)
-#define INTC_INT_PCI1 (1 << INTC_IRQ_PCI1)
-#define INTC_INT_PCI2 (1 << INTC_IRQ_PCI2)
-#define INTC_INT_SWITCH (1 << INTC_IRQ_SWITCH)
-#define INTC_INT_ALL ((1 << INTC_IRQ_COUNT) - 1)
-
-#endif /* _MACH_ADM5120_INTC_H */
+++ /dev/null
-/*
- * ADM5120 MPMC (Multiport Memory Controller) register definitions
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _MACH_ADM5120_MPMC_H
-#define _MACH_ADM5120_MPMC_H
-
-#define MPMC_READ_REG(r) __raw_readl( \
- (void __iomem *)KSEG1ADDR(ADM5120_MPMC_BASE) + MPMC_REG_ ## r)
-#define MPMC_WRITE_REG(r, v) __raw_writel((v), \
- (void __iomem *)KSEG1ADDR(ADM5120_MPMC_BASE) + MPMC_REG_ ## r)
-
-#define MPMC_REG_CTRL 0x0000
-#define MPMC_REG_STATUS 0x0004
-#define MPMC_REG_CONF 0x0008
-#define MPMC_REG_DC 0x0020
-#define MPMC_REG_DR 0x0024
-#define MPMC_REG_DRP 0x0030
-
-#define MPMC_REG_DC0 0x0100
-#define MPMC_REG_DRC0 0x0104
-#define MPMC_REG_DC1 0x0120
-#define MPMC_REG_DRC1 0x0124
-#define MPMC_REG_DC2 0x0140
-#define MPMC_REG_DRC2 0x0144
-#define MPMC_REG_DC3 0x0160
-#define MPMC_REG_DRC3 0x0164
-#define MPMC_REG_SC0 0x0200 /* for F_CS1_N */
-#define MPMC_REG_SC1 0x0220 /* for F_CS0_N */
-#define MPMC_REG_SC2 0x0240
-#define MPMC_REG_WEN2 0x0244
-#define MPMC_REG_OEN2 0x0248
-#define MPMC_REG_RD2 0x024C
-#define MPMC_REG_PG2 0x0250
-#define MPMC_REG_WR2 0x0254
-#define MPMC_REG_TN2 0x0258
-#define MPMC_REG_SC3 0x0260
-
-/* Control register bits */
-#define MPMC_CTRL_AM (1 << 1) /* Address Mirror */
-#define MPMC_CTRL_LPM (1 << 2) /* Low Power Mode */
-#define MPMC_CTRL_DWB (1 << 3) /* Drain Write Buffers */
-
-/* Status register bits */
-#define MPMC_STATUS_BUSY (1 << 0) /* Busy */
-#define MPMC_STATUS_WBS (1 << 1) /* Write Buffer Status */
-#define MPMC_STATUS_SRA (1 << 2) /* Self-Refresh Acknowledge*/
-
-/* Dynamic Control register bits */
-#define MPMC_DC_CE (1 << 0)
-#define MPMC_DC_DMC (1 << 1)
-#define MPMC_DC_SRR (1 << 2)
-#define MPMC_DC_SI_SHIFT 7
-#define MPMC_DC_SI_MASK (3 << 7)
-#define MPMC_DC_SI_NORMAL (0 << 7)
-#define MPMC_DC_SI_MODE (1 << 7)
-#define MPMC_DC_SI_PALL (2 << 7)
-#define MPMC_DC_SI_NOP (3 << 7)
-
-#define SRAM_REG_CONF 0x00
-#define SRAM_REG_WWE 0x04
-#define SRAM_REG_WOE 0x08
-#define SRAM_REG_WRD 0x0C
-#define SRAM_REG_WPG 0x10
-#define SRAM_REG_WWR 0x14
-#define SRAM_REG_WTR 0x18
-
-/* Dynamic Configuration register bits */
-#define DC_BE (1 << 19) /* buffer enable */
-#define DC_RW_SHIFT 28 /* shift for number of rows */
-#define DC_RW_MASK 0x03
-#define DC_NB_SHIFT 26 /* shift for number of banks */
-#define DC_NB_MASK 0x01
-#define DC_CW_SHIFT 22 /* shift for number of columns */
-#define DC_CW_MASK 0x07
-#define DC_DW_SHIFT 7 /* shift for device width */
-#define DC_DW_MASK 0x03
-
-/* Static Configuration register bits */
-#define SC_MW_MASK 0x03 /* memory width mask */
-#define SC_MW_8 0x00 /* 8 bit memory width */
-#define SC_MW_16 0x01 /* 16 bit memory width */
-#define SC_MW_32 0x02 /* 32 bit memory width */
-
-#endif /* _MACH_ADM5120_MPMC_H */
+++ /dev/null
-/*
- * ADM5120 NAND interface definitions
- *
- * This header file defines the hardware registers of the ADM5120 SoC
- * built-in NAND interface.
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * NAND interface routines was based on a driver for Linux 2.6.19+ which
- * was derived from the driver for Linux 2.4.xx published by Mikrotik for
- * their RouterBoard 1xx and 5xx series boards.
- * Copyright (C) 2007 David Goodenough <david.goodenough@linkchoose.co.uk>
- * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _MACH_ADM5120_NAND_H
-#define _MACH_ADM5120_NAND_H
-
-#include <linux/types.h>
-#include <linux/io.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-
-/* NAND control registers */
-#define NAND_REG_DATA 0x0 /* data register */
-#define NAND_REG_SET_CEn 0x1 /* CE# low */
-#define NAND_REG_CLR_CEn 0x2 /* CE# high */
-#define NAND_REG_CLR_CLE 0x3 /* CLE low */
-#define NAND_REG_SET_CLE 0x4 /* CLE high */
-#define NAND_REG_CLR_ALE 0x5 /* ALE low */
-#define NAND_REG_SET_ALE 0x6 /* ALE high */
-#define NAND_REG_SET_SPn 0x7 /* SP# low (use spare area) */
-#define NAND_REG_CLR_SPn 0x8 /* SP# high (do not use spare area) */
-#define NAND_REG_SET_WPn 0x9 /* WP# low */
-#define NAND_REG_CLR_WPn 0xA /* WP# high */
-#define NAND_REG_STATUS 0xB /* Status register */
-
-#define ADM5120_NAND_STATUS_READY 0x80
-
-#define NAND_READ_REG(r) \
- readb((void __iomem *)KSEG1ADDR(ADM5120_NAND_BASE) + (r))
-#define NAND_WRITE_REG(r, v) \
- writeb((v), (void __iomem *)KSEG1ADDR(ADM5120_NAND_BASE) + (r))
-
-/*-------------------------------------------------------------------------*/
-
-static inline void adm5120_nand_enable(void)
-{
- SW_WRITE_REG(SWITCH_REG_BW_CNTL1, BW_CNTL1_NAND_ENABLE);
- SW_WRITE_REG(SWITCH_REG_BOOT_DONE, 1);
-}
-
-static inline void adm5120_nand_set_wpn(unsigned int set)
-{
- NAND_WRITE_REG((set) ? NAND_REG_SET_WPn : NAND_REG_CLR_WPn, 1);
-}
-
-static inline void adm5120_nand_set_spn(unsigned int set)
-{
- NAND_WRITE_REG((set) ? NAND_REG_SET_SPn : NAND_REG_CLR_SPn, 1);
-}
-
-static inline void adm5120_nand_set_cle(unsigned int set)
-{
- NAND_WRITE_REG((set) ? NAND_REG_SET_CLE : NAND_REG_CLR_CLE, 1);
-}
-
-static inline void adm5120_nand_set_ale(unsigned int set)
-{
- NAND_WRITE_REG((set) ? NAND_REG_SET_ALE : NAND_REG_CLR_ALE, 1);
-}
-
-static inline void adm5120_nand_set_cen(unsigned int set)
-{
- NAND_WRITE_REG((set) ? NAND_REG_SET_CEn : NAND_REG_CLR_CEn, 1);
-}
-
-static inline u8 adm5120_nand_get_status(void)
-{
- return NAND_READ_REG(NAND_REG_STATUS);
-}
-
-#endif /* _MACH_ADM5120_NAND_H */
+++ /dev/null
-/*
- * ADM5120 specific platform definitions
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _ASM_MIPS_MACH_ADM5120_PLATFORM_H
-#define _ASM_MIPS_MACH_ADM5120_PLATFORM_H
-
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/input.h>
-#include <linux/leds.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/nand.h>
-#include <linux/input.h>
-#include <linux/gpio_keys.h>
-#include <linux/amba/bus.h>
-#include <linux/amba/serial.h>
-
-struct adm5120_flash_platform_data {
- void (*set_vpp)(struct map_info *, int);
- void (*switch_bank)(unsigned);
- u32 window_size;
- unsigned int nr_parts;
- struct mtd_partition *parts;
-};
-
-struct adm5120_switch_platform_data {
- /* TODO: not yet implemented */
-};
-
-struct adm5120_pci_irq {
- u8 slot;
- u8 func;
- u8 pin;
- unsigned irq;
-};
-
-#define PCIIRQ(s, f, p, i) {.slot = (s), .func = (f), .pin = (p), .irq = (i)}
-
-#ifdef CONFIG_PCI
-extern void adm5120_pci_set_irq_map(unsigned int nr_irqs,
- struct adm5120_pci_irq *map) __init;
-#else
-static inline void adm5120_pci_set_irq_map(unsigned int nr_irqs,
- struct adm5120_pci_irq *map)
-{
-}
-#endif
-
-extern void adm5120_setup_eth_macs(u8 *mac_base) __init;
-
-extern struct adm5120_flash_platform_data adm5120_flash0_data;
-extern struct adm5120_flash_platform_data adm5120_flash1_data;
-
-extern void adm5120_add_device_flash(unsigned id) __init;
-extern void adm5120_add_device_usb(void) __init;
-extern void adm5120_add_device_uart(unsigned id) __init;
-extern void adm5120_add_device_nand(struct platform_nand_data *pdata) __init;
-extern void adm5120_add_device_switch(unsigned num_ports, u8 *vlan_map) __init;
-extern void adm5120_register_gpio_buttons(int id,
- unsigned poll_interval,
- unsigned nbuttons,
- struct gpio_keys_button *buttons);
-
-#define GPIO_LED_DEF(g, n, t, a) { \
- .name = (n), \
- .default_trigger = (t), \
- .gpio = (g), \
- .active_low = (a) \
-}
-
-#define GPIO_LED_STD(g, n, t) GPIO_LED_DEF((g), (n), (t), 0)
-#define GPIO_LED_INV(g, n, t) GPIO_LED_DEF((g), (n), (t), 1)
-
-extern void adm5120_add_device_gpio_leds(unsigned num_leds,
- struct gpio_led *leds) __init;
-
-#endif /* _ASM_MIPS_MACH_ADM5120_PLATFORM_H */
+++ /dev/null
-/*
- * ADM5120 ethernet switch definitions
- *
- * This header file defines the hardware registers of the ADM5120 SoC
- * built-in Ethernet switch.
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _MACH_ADM5120_SWITCH_H
-#define _MACH_ADM5120_SWITCH_H
-
-#ifndef BIT
-# define BIT(at) (1 << (at))
-#endif
-#define BITMASK(len) (BIT(len)-1)
-
-#define SW_READ_REG(r) __raw_readl( \
- (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE) + r)
-#define SW_WRITE_REG(r, v) __raw_writel((v), \
- (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE) + r)
-
-/* Switch register offsets */
-#define SWITCH_REG_CODE 0x0000
-#define SWITCH_REG_SOFT_RESET 0x0004 /* Soft Reset */
-#define SWITCH_REG_BOOT_DONE 0x0008 /* Boot Done */
-#define SWITCH_REG_SW_RESET 0x000C /* Switch Reset */
-#define SWITCH_REG_PHY_STATUS 0x0014 /* PHY Status */
-#define SWITCH_REG_MEMCTRL 0x001C /* Memory Control */
-#define SWITCH_REG_CPUP_CONF 0x0024 /* CPU Port Configuration */
-#define SWITCH_REG_PORT_CONF0 0x0028 /* Port Configuration 0 */
-#define SWITCH_REG_PORT_CONF1 0x002C /* Port Configuration 1 */
-#define SWITCH_REG_PORT_CONF2 0x0030 /* Port Configuration 2 */
-#define SWITCH_REG_VLAN_G1 0x0040 /* VLAN group 1 */
-#define SWITCH_REG_VLAN_G2 0x0044 /* VLAN group 2 */
-#define SWITCH_REG_SEND_TRIG 0x0048 /* Send Trigger */
-#define SWITCH_REG_MAC_WT0 0x0058 /* MAC Write Address 0 */
-#define SWITCH_REG_MAC_WT1 0x005C /* MAC Write Address 1 */
-#define SWITCH_REG_BW_CNTL0 0x0060 /* Bandwidth Control 0 */
-#define SWITCH_REG_BW_CNTL1 0x0064 /* Bandwidth Control 1 */
-#define SWITCH_REG_PHY_CNTL0 0x0068 /* PHY Control 0 */
-#define SWITCH_REG_PHY_CNTL1 0x006C /* PHY Control 1 */
-#define SWITCH_REG_PORT_TH 0x0078 /* Port Threshold */
-#define SWITCH_REG_PHY_CNTL2 0x007C /* PHY Control 2 */
-#define SWITCH_REG_PHY_CNTL3 0x0080 /* PHY Control 3 */
-#define SWITCH_REG_PRI_CNTL 0x0084 /* Priority Control */
-#define SWITCH_REG_PHY_CNTL4 0x00A0 /* PHY Control 4 */
-#define SWITCH_REG_EMPTY_CNT 0x00A4 /* Empty Count */
-#define SWITCH_REG_PORT_CNTLS 0x00A8 /* Port Control Select */
-#define SWITCH_REG_PORT_CNTL 0x00AC /* Port Control */
-#define SWITCH_REG_INT_STATUS 0x00B0 /* Interrupt Status */
-#define SWITCH_REG_INT_MASK 0x00B4 /* Interrupt Mask */
-#define SWITCH_REG_GPIO_CONF0 0x00B8 /* GPIO Configuration 0 */
-#define SWITCH_REG_GPIO_CONF2 0x00BC /* GPIO Configuration 1 */
-#define SWITCH_REG_WDOG0 0x00C0 /* Watchdog 0 */
-#define SWITCH_REG_WDOG1 0x00C4 /* Watchdog 1 */
-
-#define SWITCH_REG_SHDA 0x00D0 /* Send High Descriptors Address */
-#define SWITCH_REG_SLDA 0x00D4 /* Send Low Descriptors Address */
-#define SWITCH_REG_RHDA 0x00D8 /* Receive High Descriptor Address */
-#define SWITCH_REG_RLDA 0x00DC /* Receive Low Descriptor Address */
-#define SWITCH_REG_SHWA 0x00E0 /* Send High Working Address */
-#define SWITCH_REG_SLWA 0x00E4 /* Send Low Working Address */
-#define SWITCH_REG_RHWA 0x00E8 /* Receive High Working Address */
-#define SWITCH_REG_RLWA 0x00EC /* Receive Low Working Address */
-
-#define SWITCH_REG_TIMER_INT 0x00F0 /* Timer */
-#define SWITCH_REG_TIMER 0x00F4 /* Timer Interrupt */
-
-#define SWITCH_REG_PORT0_LED 0x0100
-#define SWITCH_REG_PORT1_LED 0x0104
-#define SWITCH_REG_PORT2_LED 0x0108
-#define SWITCH_REG_PORT3_LED 0x010C
-#define SWITCH_REG_PORT4_LED 0x0110
-
-/* CODE register bits */
-#define CODE_PC_MASK BITMASK(16) /* Product Code */
-#define CODE_REV_SHIFT 16
-#define CODE_REV_MASK BITMASK(4) /* Product Revision */
-#define CODE_CLKS_SHIFT 20
-#define CODE_CLKS_MASK BITMASK(2) /* Clock Speed */
-#define CODE_CLKS_175 0 /* 175 MHz */
-#define CODE_CLKS_200 1 /* 200 MHz */
-#define CODE_CLKS_225 2 /* 225 MHz */
-#define CODE_CLKS_250 3 /* 250 MHz */
-#define CODE_NAB BIT(24) /* NAND boot */
-#define CODE_PK_MASK BITMASK(1) /* Package type */
-#define CODE_PK_SHIFT 29
-#define CODE_PK_BGA 0 /* BGA package */
-#define CODE_PK_PQFP 1 /* PQFP package */
-
-/* MEMCTRL register bits */
-#define MEMCTRL_SDRS_MASK BITMASK(3) /* SDRAM bank size */
-#define MEMCTRL_SDRS_4M 0x01
-#define MEMCTRL_SDRS_8M 0x02
-#define MEMCTRL_SDRS_16M 0x03
-#define MEMCTRL_SDRS_64M 0x04
-#define MEMCTRL_SDRS_128M 0x05
-#define MEMCTRL_SDR1_ENABLE BIT(5) /* enable SDRAM bank 1 */
-
-#define MEMCTRL_SRS0_SHIFT 8 /* shift for SRAM0 size */
-#define MEMCTRL_SRS1_SHIFT 16 /* shift for SRAM1 size */
-#define MEMCTRL_SRS_MASK BITMASK(3) /* SRAM size mask */
-#define MEMCTRL_SRS_DISABLED 0x00 /* Disabled */
-#define MEMCTRL_SRS_512K 0x01 /* 512KB*/
-#define MEMCTRL_SRS_1M 0x02 /* 1MB */
-#define MEMCTRL_SRS_2M 0x03 /* 2MB */
-#define MEMCTRL_SRS_4M 0x04 /* 4MB */
-
-/* Port bits used in various registers */
-#define SWITCH_PORT_PHY0 BIT(0)
-#define SWITCH_PORT_PHY1 BIT(1)
-#define SWITCH_PORT_PHY2 BIT(2)
-#define SWITCH_PORT_PHY3 BIT(3)
-#define SWITCH_PORT_PHY4 BIT(4)
-#define SWITCH_PORT_MII BIT(5)
-#define SWITCH_PORT_CPU BIT(6)
-
-/* Port bit shorthands */
-#define SWITCH_PORTS_PHY 0x1F /* phy ports */
-#define SWITCH_PORTS_NOCPU 0x3F /* physical ports */
-#define SWITCH_PORTS_ALL 0x7F /* all ports */
-
-/* CPUP_CONF register bits */
-#define CPUP_CONF_DCPUP BIT(0) /* Disable CPU port */
-#define CPUP_CONF_CRCP BIT(1) /* CRC padding from CPU */
-#define CPUP_CONF_BTM BIT(2) /* Bridge Testing Mode */
-#define CPUP_CONF_DUNP_SHIFT 9 /* Disable Unknown Packets for portX */
-#define CPUP_CONF_DMCP_SHIFT 16 /* Disable Mcast Packets form portX */
-#define CPUP_CONF_DBCP_SHIFT 24 /* Disable Bcast Packets form portX */
-
-/* PORT_CONF0 register bits */
-#define PORT_CONF0_DP_SHIFT 0 /* Disable Port */
-#define PORT_CONF0_EMCP_SHIFT 8 /* Enable All MC Packets */
-#define PORT_CONF0_BP_SHIFT 16 /* Enable Back Pressure */
-
-/* PORT_CONF1 register bits */
-#define PORT_CONF1_DISL_SHIFT 0 /* Disable Learning */
-#define PORT_CONF1_BS_SHIFT 6 /* Blocking State */
-#define PORT_CONF1_BM_SHIFT 12 /* Blocking Mode */
-
-/* SEND_TRIG register bits */
-#define SEND_TRIG_STL BIT(0) /* Send Trigger Low */
-#define SEND_TRIG_STH BIT(1) /* Send Trigger High */
-
-/* MAC_WT0 register bits */
-#define MAC_WT0_MAWC BIT(0) /* MAC address write command */
-#define MAC_WT0_MWD_SHIFT 1
-#define MAC_WT0_MWD BIT(1) /* MAC write done */
-#define MAC_WT0_WFB BIT(2) /* Write Filter Bit */
-#define MAC_WT0_WVN_SHIFT 3 /* Write Vlan Number shift */
-#define MAC_WT0_WVE BIT(6) /* Write VLAN enable */
-#define MAC_WT0_WPMN_SHIFT 7
-#define MAC_WT0_WAF_SHIFT 13 /* Write Age Field shift */
-#define MAC_WT0_WAF_EMPTY 0
-#define MAC_WT0_WAF_STATIC 7 /* age: static */
-#define MAC_WT0_MAC0_SHIFT 16
-#define MAC_WT0_MAC1_SHIFT 24
-
-/* MAC_WT1 register bits */
-#define MAC_WT1_MAC2_SHIFT 0
-#define MAC_WT1_MAC3_SHIFT 8
-#define MAC_WT1_MAC4_SHIFT 16
-#define MAC_WT1_MAC5_SHIFT 24
-
-/* BW_CNTL0/BW_CNTL1 register bits */
-#define BW_CNTL_DISABLE 0x00
-#define BW_CNTL_64K 0x01
-#define BW_CNTL_128K 0x02
-#define BW_CNTL_256K 0x03
-#define BW_CNTL_512K 0x04
-#define BW_CNTL_1M 0x05
-#define BW_CNTL_4M 0x06
-#define BW_CNTL_10M 0x07
-
-#define P4TBC_SHIFT 0
-#define P4RBC_SHIFT 4
-#define P5TBC_SHIFT 8
-#define P5RBC_SHIFT 12
-
-#define BW_CNTL1_NAND_ENABLE 0x100
-
-/* PHY_CNTL0 register bits */
-#define PHY_CNTL0_PHYA_MASK BITMASK(5)
-#define PHY_CNTL0_PHYR_MASK BITMASK(5)
-#define PHY_CNTL0_PHYR_SHIFT 8
-#define PHY_CNTL0_WC BIT(13) /* Write Command */
-#define PHY_CNTL0_RC BIT(14) /* Read Command */
-#define PHY_CNTL0_WTD_MASK BIT(16) /* Read Command */
-#define PHY_CNTL0_WTD_SHIFT 16
-
-/* PHY_CNTL1 register bits */
-#define PHY_CNTL1_WOD BIT(0) /* Write Operation Done */
-#define PHY_CNTL1_ROD BIT(1) /* Read Operation Done */
-#define PHY_CNTL1_RD_MASK BITMASK(16)
-#define PHY_CNTL1_RD_SHIFT 16
-
-/* PHY_CNTL2 register bits */
-#define PHY_CNTL2_ANE_SHIFT 0 /* Auto Negotiation Enable */
-#define PHY_CNTL2_SC_SHIFT 5 /* Speed Control */
-#define PHY_CNTL2_DC_SHIFT 10 /* Duplex Control */
-#define PHY_CNTL2_FNCV_SHIFT 15 /* Recommended FC Value */
-#define PHY_CNTL2_PHYR_SHIFT 20 /* PHY reset */
-#define PHY_CNTL2_AMDIX_SHIFT 25 /* Auto MDIX enable */
-/* PHY_CNTL2_RMAE is bad in datasheet */
-#define PHY_CNTL2_RMAE BIT(31) /* Recommended MCC Average enable */
-
-/* PHY_CNTL3 register bits */
-#define PHY_CNTL3_RNT BIT(10) /* Recommend Normal Threshold */
-
-/* PORT_TH register bits */
-#define PORT_TH_PPT_MASK BITMASK(8) /* Per Port Threshold */
-#define PORT_TH_CPUT_SHIFT 8 /* CPU Port Buffer Threshold */
-#define PORT_TH_CPUT_MASK BITMASK(8)
-#define PORT_TH_CPUHT_SHIFT 16 /* CPU Hold Threshold */
-#define PORT_TH_CPUHT_MASK BITMASK(8)
-#define PORT_TH_CPURT_SHIFT 24 /* CPU Release Threshold */
-#define PORT_TH_CPURT_MASK BITMASK(8)
-
-/* EMPTY_CNT register bits */
-#define EMPTY_CNT_EBGB_MASK BITMASK(9) /* Empty Blocks in the Global Buffer */
-
-/* GPIO_CONF0 register bits */
-#define GPIO_CONF0_MASK BITMASK(8)
-#define GPIO_CONF0_IM_SHIFT 0
-#define GPIO_CONF0_IV_SHIFT 8
-#define GPIO_CONF0_OE_SHIFT 16
-#define GPIO_CONF0_OV_SHIFT 24
-#define GPIO_CONF0_IM_MASK (0xFF << GPIO_CONF0_IM_SHIFT)
-#define GPIO_CONF0_IV_MASK (0xFF << GPIO_CONF0_IV_SHIFT)
-#define GPIO_CONF0_OE_MASK (0xFF << GPIO_CONF0_OE_SHIFT)
-#define GPIO_CONF0_OV_MASK (0xFF << GPIO_CONF0_OV_SHIFT)
-
-/* GPIO_CONF2 register bits */
-#define GPIO_CONF2_CSX0 BIT(4) /* enable CSX0:INTX0 on GPIO 1:2 */
-#define GPIO_CONF2_CSX1 BIT(5) /* enable CSX1:INTX1 on GPIO 3:4 */
-#define GPIO_CONF2_EW BIT(6) /* enable wait state pin for CSX0/1 */
-
-/* INT_STATUS/INT_MASK register bits */
-#define SWITCH_INT_SHD BIT(0) /* Send High Done */
-#define SWITCH_INT_SLD BIT(1) /* Send Low Done */
-#define SWITCH_INT_RHD BIT(2) /* Receive High Done */
-#define SWITCH_INT_RLD BIT(3) /* Receive Low Done */
-#define SWITCH_INT_HDF BIT(4) /* High Descriptor Full */
-#define SWITCH_INT_LDF BIT(5) /* Low Descriptor Full */
-#define SWITCH_INT_P0QF BIT(6) /* Port0 Queue Full */
-#define SWITCH_INT_P1QF BIT(7) /* Port1 Queue Full */
-#define SWITCH_INT_P2QF BIT(8) /* Port2 Queue Full */
-#define SWITCH_INT_P3QF BIT(9) /* Port3 Queue Full */
-#define SWITCH_INT_P4QF BIT(10) /* Port4 Queue Full */
-#define SWITCH_INT_P5QF BIT(11) /* Port5 Queue Full */
-#define SWITCH_INT_CPQF BIT(13) /* CPU Queue Full */
-#define SWITCH_INT_GQF BIT(14) /* Global Queue Full */
-#define SWITCH_INT_MD BIT(15) /* Must Drop */
-#define SWITCH_INT_BCS BIT(16) /* BC Storm */
-#define SWITCH_INT_PSC BIT(18) /* Port Status Change */
-#define SWITCH_INT_ID BIT(19) /* Intruder Detected */
-#define SWITCH_INT_W0TE BIT(20) /* Watchdog 0 Timer Expired */
-#define SWITCH_INT_W1TE BIT(21) /* Watchdog 1 Timer Expired */
-#define SWITCH_INT_RDE BIT(22) /* Receive Descriptor Error */
-#define SWITCH_INT_SDE BIT(23) /* Send Descriptor Error */
-#define SWITCH_INT_CPUH BIT(24) /* CPU Hold */
-
-/* TIMER_INT register bits */
-#define TIMER_INT_TOS BIT(0) /* time-out status */
-#define TIMER_INT_TOM BIT(16) /* mask time-out interrupt */
-
-/* TIMER register bits */
-#define TIMER_PERIOD_MASK BITMASK(16) /* mask for timer period */
-#define TIMER_PERIOD_DEFAULT 0xFFFF /* default timer period */
-#define TIMER_TE BIT(16) /* timer enable bit */
-
-/* PORTx_LED register bits */
-#define LED_MODE_MASK BITMASK(4)
-#define LED_MODE_INPUT 0
-#define LED_MODE_FLASH 1
-#define LED_MODE_OUT_HIGH 2
-#define LED_MODE_OUT_LOW 3
-#define LED_MODE_LINK 4
-#define LED_MODE_SPEED 5
-#define LED_MODE_DUPLEX 6
-#define LED_MODE_ACT 7
-#define LED_MODE_COLL 8
-#define LED_MODE_LINK_ACT 9
-#define LED_MODE_DUPLEX_COLL 10
-#define LED_MODE_10M_ACT 11
-#define LED_MODE_100M_ACT 12
-#define LED0_MODE_SHIFT 0 /* LED0 mode shift */
-#define LED1_MODE_SHIFT 4 /* LED1 mode shift */
-#define LED2_MODE_SHIFT 8 /* LED2 mode shift */
-#define LED0_IV_SHIFT 12 /* LED0 input value shift */
-#define LED1_IV_SHIFT 13 /* LED1 input value shift */
-#define LED2_IV_SHIFT 14 /* LED2 input value shift */
-
-#endif /* _MACH_ADM5120_SWITCH_H */
+++ /dev/null
-/*
- * ADM5120 UART definitions
- *
- * This header file defines the hardware registers of the ADM5120 SoC
- * built-in UARTs.
- *
- * Copyright (C) 2007 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _MACH_ADM5120_UART_H
-#define _MACH_ADM5120_UART_H
-
-#define UART_BAUDDIV(clk, baud) ((clk/(16 * (baud)))-1)
-
-#define UART_REG_DATA 0x00
-#define UART_REG_RSR 0x04
-#define UART_REG_ECR UART_REG_RSR
-#define UART_REG_LCRH 0x08
-#define UART_REG_LCRM 0x0C
-#define UART_REG_LCRL 0x10
-#define UART_REG_CTRL 0x14
-#define UART_REG_FLAG 0x18
-
-/* Receive Status Register bits */
-#define UART_RSR_FE (1 << 0)
-#define UART_RSR_PE (1 << 1)
-#define UART_RSR_BE (1 << 2)
-#define UART_RSR_OE (1 << 3)
-#define UART_RSR_ERR (UART_RSR_FE | UART_RSR_PE | UART_RSR_BE)
-
-#define UART_ECR_ALL 0xFF
-
-/* Line Control High register bits */
-#define UART_LCRH_BRK (1 << 0) /* send break */
-#define UART_LCRH_PEN (1 << 1) /* parity enable */
-#define UART_LCRH_EPS (1 << 2) /* even parity select */
-#define UART_LCRH_STP1 (0 << 3) /* one stop bits select */
-#define UART_LCRH_STP2 (1 << 3) /* two stop bits select */
-#define UART_LCRH_FEN (1 << 4) /* FIFO enable */
-
-#define UART_LCRH_WLEN5 (0 << 5)
-#define UART_LCRH_WLEN6 (1 << 5)
-#define UART_LCRH_WLEN7 (2 << 5)
-#define UART_LCRH_WLEN8 (3 << 5)
-
-/* Control register bits */
-#define UART_CTRL_EN (1 << 0)
-
-/* Flag register bits */
-#define UART_FLAG_CTS (1 << 0)
-#define UART_FLAG_DSR (1 << 1)
-#define UART_FLAG_DCD (1 << 2)
-#define UART_FLAG_BUSY (1 << 3)
-#define UART_FLAG_RXFE (1 << 4)
-#define UART_FLAG_TXFF (1 << 5)
-#define UART_FLAG_RXFF (1 << 6)
-#define UART_FLAG_TXFE (1 << 7)
-
-#endif /* _MACH_ADM5120_UART_H */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * ADM5120 specific CPU feature overrides
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: include/asm-mips/cpu-features.h
- * Copyright (C) 2003, 2004 Ralf Baechle
- * Copyright (C) 2004 Maciej W. Rozycki
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-#ifndef __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H
-#define __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H
-
-/*
- * The ADM5120 SOC has a built-in MIPS 4Kc core.
- */
-#define cpu_has_tlb 1
-#define cpu_has_4kex 1
-#define cpu_has_3k_cache 0
-#define cpu_has_4k_cache 1
-#define cpu_has_tx39_cache 0
-#define cpu_has_sb1_cache 0
-#define cpu_has_fpu 0
-#define cpu_has_32fpr 0
-#define cpu_has_counter 1
-#define cpu_has_watch 1
-#define cpu_has_divec 1
-/* #define cpu_has_vce ? */
-/* #define cpu_has_cache_cdex_p ? */
-/* #define cpu_has_cache_cdex_s ? */
-#define cpu_has_prefetch 1
-/* #define cpu_has_mcheck ? */
-#define cpu_has_ejtag 1
-#define cpu_has_llsc 1
-
-#define cpu_has_mips16 0
-#define cpu_has_mdmx 0
-#define cpu_has_mips3d 0
-#define cpu_has_smartmips 0
-
-/* #define cpu_has_vtag_icache ? */
-/* #define cpu_has_dc_aliases ? */
-/* #define cpu_has_ic_fills_f_dc ? */
-/* #define cpu_has_pindexed_dcache ? */
-
-/* #define cpu_icache_snoops_remote_store ? */
-
-#define cpu_has_mips32r1 1
-#define cpu_has_mips32r2 0
-#define cpu_has_mips64r1 0
-#define cpu_has_mips64r2 0
-
-#define cpu_has_dsp 0
-#define cpu_has_mipsmt 0
-
-/* #define cpu_has_nofpuex ? */
-#define cpu_has_64bits 0
-#define cpu_has_64bit_zero_reg 0
-#define cpu_has_64bit_gp_regs 0
-#define cpu_has_64bit_addresses 0
-
-/* #define cpu_has_inclusive_pcaches ? */
-
-#define cpu_dcache_line_size() 16
-#define cpu_icache_line_size() 16
-
-#endif /* __ASM_MACH_ADM5120_CPU_FEATURE_OVERRIDES_H */
+++ /dev/null
-/*
- * ADM5120 GPIO wrappers for arch-neutral GPIO calls
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _ASM_MIPS_MACH_ADM5120_GPIO_H
-#define _ASM_MIPS_MACH_ADM5120_GPIO_H
-
-#define ARCH_NR_GPIOS 64
-
-#include <asm-generic/gpio.h>
-
-#include <asm/mach-adm5120/adm5120_switch.h>
-
-#define ADM5120_GPIO_PIN0 0
-#define ADM5120_GPIO_PIN1 1
-#define ADM5120_GPIO_PIN2 2
-#define ADM5120_GPIO_PIN3 3
-#define ADM5120_GPIO_PIN4 4
-#define ADM5120_GPIO_PIN5 5
-#define ADM5120_GPIO_PIN6 6
-#define ADM5120_GPIO_PIN7 7
-#define ADM5120_GPIO_P0L0 8
-#define ADM5120_GPIO_P0L1 9
-#define ADM5120_GPIO_P0L2 10
-#define ADM5120_GPIO_P1L0 11
-#define ADM5120_GPIO_P1L1 12
-#define ADM5120_GPIO_P1L2 13
-#define ADM5120_GPIO_P2L0 14
-#define ADM5120_GPIO_P2L1 15
-#define ADM5120_GPIO_P2L2 16
-#define ADM5120_GPIO_P3L0 17
-#define ADM5120_GPIO_P3L1 18
-#define ADM5120_GPIO_P3L2 19
-#define ADM5120_GPIO_P4L0 20
-#define ADM5120_GPIO_P4L1 21
-#define ADM5120_GPIO_P4L2 22
-#define ADM5120_GPIO_MAX 22
-#define ADM5120_GPIO_COUNT ADM5120_GPIO_MAX+1
-
-#define ADM5120_GPIO_LOW 0
-#define ADM5120_GPIO_HIGH 1
-
-#define ADM5120_GPIO_SWITCH 0x10
-#define ADM5120_GPIO_FLASH (ADM5120_GPIO_SWITCH | LED_MODE_FLASH)
-#define ADM5120_GPIO_LINK (ADM5120_GPIO_SWITCH | LED_MODE_LINK)
-#define ADM5120_GPIO_SPEED (ADM5120_GPIO_SWITCH | LED_MODE_SPEED)
-#define ADM5120_GPIO_DUPLEX (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX)
-#define ADM5120_GPIO_ACT (ADM5120_GPIO_SWITCH | LED_MODE_ACT)
-#define ADM5120_GPIO_COLL (ADM5120_GPIO_SWITCH | LED_MODE_COLL)
-#define ADM5120_GPIO_LINK_ACT (ADM5120_GPIO_SWITCH | LED_MODE_LINK_ACT)
-#define ADM5120_GPIO_DUPLEX_COLL (ADM5120_GPIO_SWITCH | LED_MODE_DUPLEX_COLL)
-#define ADM5120_GPIO_10M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_10M_ACT)
-#define ADM5120_GPIO_100M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_100M_ACT)
-
-extern int __adm5120_gpio0_get_value(unsigned gpio);
-extern void __adm5120_gpio0_set_value(unsigned gpio, int value);
-extern int __adm5120_gpio1_get_value(unsigned gpio);
-extern void __adm5120_gpio1_set_value(unsigned gpio, int value);
-extern int adm5120_gpio_to_irq(unsigned gpio);
-extern int adm5120_irq_to_gpio(unsigned irq);
-
-static inline int gpio_get_value(unsigned gpio)
-{
- int ret;
-
- switch (gpio) {
- case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7:
- ret = __adm5120_gpio0_get_value(gpio);
- break;
- case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2:
- ret = __adm5120_gpio1_get_value(gpio - ADM5120_GPIO_P0L0);
- break;
- default:
- ret = __gpio_get_value(gpio);
- break;
- }
-
- return ret;
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
- switch (gpio) {
- case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7:
- __adm5120_gpio0_set_value(gpio, value);
- break;
- case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2:
- __adm5120_gpio1_set_value(gpio - ADM5120_GPIO_P0L0, value);
- break;
- default:
- __gpio_set_value(gpio, value);
- break;
- }
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
- return adm5120_gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned irq)
-{
- return adm5120_irq_to_gpio(irq);
-}
-
-#define gpio_cansleep __gpio_cansleep
-
-#endif /* _ASM_MIPS_MACH_ADM5120_GPIO_H */
+++ /dev/null
-/*
- * ADM5120 specific IRQ numbers
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-#ifndef _ASM_MIPS_MACH_ADM5120_IRQ_H
-#define _ASM_MIPS_MACH_ADM5120_IRQ_H
-
-#define MIPS_CPU_IRQ_BASE 0
-#define NR_IRQS 24
-
-#include_next <irq.h>
-
-#include <asm/mach-adm5120/adm5120_intc.h>
-
-#define NO_IRQ (-1)
-
-#define MIPS_CPU_IRQ_COUNT 8
-#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
-
-#define ADM5120_INTC_IRQ_BASE (MIPS_CPU_IRQ_BASE + MIPS_CPU_IRQ_COUNT)
-#define ADM5120_INTC_IRQ(x) (ADM5120_INTC_IRQ_BASE + (x))
-
-#define ADM5120_IRQ_INTC MIPS_CPU_IRQ(2)
-#define ADM5120_IRQ_COUNTER MIPS_CPU_IRQ(7)
-
-#define ADM5120_IRQ_TIMER ADM5120_INTC_IRQ(INTC_IRQ_TIMER)
-#define ADM5120_IRQ_UART0 ADM5120_INTC_IRQ(INTC_IRQ_UART0)
-#define ADM5120_IRQ_UART1 ADM5120_INTC_IRQ(INTC_IRQ_UART1)
-#define ADM5120_IRQ_USBC ADM5120_INTC_IRQ(INTC_IRQ_USBC)
-#define ADM5120_IRQ_GPIO2 ADM5120_INTC_IRQ(INTC_IRQ_GPIO2)
-#define ADM5120_IRQ_GPIO4 ADM5120_INTC_IRQ(INTC_IRQ_GPIO4)
-#define ADM5120_IRQ_PCI0 ADM5120_INTC_IRQ(INTC_IRQ_PCI0)
-#define ADM5120_IRQ_PCI1 ADM5120_INTC_IRQ(INTC_IRQ_PCI1)
-#define ADM5120_IRQ_PCI2 ADM5120_INTC_IRQ(INTC_IRQ_PCI2)
-#define ADM5120_IRQ_SWITCH ADM5120_INTC_IRQ(INTC_IRQ_SWITCH)
-
-#endif /* _ASM_MIPS_MACH_ADM5120_IRQ_H */
+++ /dev/null
-/*
- * ADMBoot specific definitions
- *
- * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _ADMBOOT_H
-#define _ADMBOOT_H
-
-extern int admboot_get_mac_base(u32 offset, u32 len, u8 *mac) __init;
-
-#endif /* _ADMBOOT_H */
+++ /dev/null
-/*
- * Broadcom's CFE definitions
- *
- * Copyright (C) 2006-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _PROM_CFE_H_
-#define _PROM_CFE_H_
-
-extern int cfe_present(void) __init;
-extern char *cfe_getenv(char *);
-
-#endif /*_PROM_CFE_H_*/
+++ /dev/null
-/*
- * Generic prom definitions
- *
- * Copyright (C) 2006-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _PROM_GENERIC_H_
-#define _PROM_GENERIC_H_
-
-extern int generic_prom_present(void) __init;
-extern char *generic_prom_getenv(char *);
-
-#endif /*_PROM_GENERIC_H_*/
+++ /dev/null
-/*
- * Compex's MyLoader specific definitions
- *
- * Copyright (C) 2006-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _MYLOADER_H_
-#define _MYLOADER_H_
-
-/*
- * Firmware file format:
- *
- * <header>
- * [<block descriptor 0>]
- * ...
- * [<block descriptor n>]
- * <null block descriptor>
- * [<block data 0>]
- * ...
- * [<block data n>]
- *
- *
- */
-
-/* Myloader specific magic numbers */
-#define MYLO_MAGIC_FIRMWARE 0x4C594D00
-#define MYLO_MAGIC_20021103 0x20021103
-#define MYLO_MAGIC_20021107 0x20021107
-
-#define MYLO_MAGIC_SYS_PARAMS MYLO_MAGIC_20021107
-#define MYLO_MAGIC_PARTITIONS MYLO_MAGIC_20021103
-#define MYLO_MAGIC_BOARD_PARAMS MYLO_MAGIC_20021103
-
-/*
- * Addresses of the data structures provided by MyLoader
- */
-#define MYLO_MIPS_SYS_PARAMS 0x80000800 /* System Parameters */
-#define MYLO_MIPS_BOARD_PARAMS 0x80000A00 /* Board Parameters */
-#define MYLO_MIPS_PARTITIONS 0x80000C00 /* Partition Table */
-#define MYLO_MIPS_BOOT_PARAMS 0x80000E00 /* Boot Parameters */
-
-/* Vendor ID's (seems to be same as the PCI vendor ID's) */
-#define VENID_COMPEX 0x11F6
-
-/* Devices based on the ADM5120 */
-#define DEVID_COMPEX_NP27G 0x0078
-#define DEVID_COMPEX_NP28G 0x044C
-#define DEVID_COMPEX_NP28GHS 0x044E
-#define DEVID_COMPEX_WP54Gv1C 0x0514
-#define DEVID_COMPEX_WP54G 0x0515
-#define DEVID_COMPEX_WP54AG 0x0546
-#define DEVID_COMPEX_WPP54AG 0x0550
-#define DEVID_COMPEX_WPP54G 0x0555
-
-/* Devices based on the IXP422 */
-#define DEVID_COMPEX_WP18 0x047E
-#define DEVID_COMPEX_NP18A 0x0489
-
-/* Other devices */
-#define DEVID_COMPEX_NP26G8M 0x03E8
-#define DEVID_COMPEX_NP26G16M 0x03E9
-
-struct mylo_fw_header {
- uint32_t magic; /* must be MYLO_MAGIC_FIRMWARE */
- uint32_t crc; /* CRC of the whole firmware */
- uint32_t res0; /* unknown/unused */
- uint32_t res1; /* unknown/unused */
- uint16_t vid; /* vendor ID */
- uint16_t did; /* device ID */
- uint16_t svid; /* sub vendor ID */
- uint16_t sdid; /* sub device ID */
- uint32_t rev; /* device revision */
- uint32_t fwhi; /* FIXME: firmware version high? */
- uint32_t fwlo; /* FIXME: firmware version low? */
- uint32_t flags; /* firmware flags */
-};
-
-#define FW_FLAG_BOARD_PARAMS_WP 0x01 /* board parameters are write protected */
-#define FW_FLAG_BOOT_SECTOR_WE 0x02 /* enable of write boot sectors (below 64K) */
-
-struct mylo_fw_blockdesc {
- uint32_t type; /* block type */
- uint32_t addr; /* relative address to flash start */
- uint32_t dlen; /* size of block data in bytes */
- uint32_t blen; /* total size of block in bytes */
-};
-
-#define FW_DESC_TYPE_UNUSED 0
-#define FW_DESC_TYPE_USED 1
-
-struct mylo_partition {
- uint16_t flags; /* partition flags */
- uint16_t type; /* type of the partition */
- uint32_t addr; /* relative address of the partition from the
- flash start */
- uint32_t size; /* size of the partition in bytes */
- uint32_t param; /* if this is the active partition, the
- MyLoader load code to this address */
-};
-
-#define PARTITION_FLAG_ACTIVE 0x8000 /* this is the active partition,
- * MyLoader loads firmware from here */
-#define PARTITION_FLAG_ISRAM 0x2000 /* FIXME: this is a RAM partition? */
-#define PARTIIION_FLAG_RAMLOAD 0x1000 /* FIXME: load this partition into the RAM? */
-#define PARTITION_FLAG_PRELOAD 0x0800 /* the partition data preloaded to RAM
- * before decompression */
-#define PARTITION_FLAG_HAVEHDR 0x0002 /* the partition data have a header */
-
-#define PARTITION_TYPE_FREE 0
-#define PARTITION_TYPE_USED 1
-
-#define MYLO_MAX_PARTITIONS 8 /* maximum number of partitions in the
- partition table */
-
-struct mylo_partition_table {
- uint32_t magic; /* must be MYLO_MAGIC_PARTITIONS */
- uint32_t res0; /* unknown/unused */
- uint32_t res1; /* unknown/unused */
- uint32_t res2; /* unknown/unused */
- struct mylo_partition partitions[MYLO_MAX_PARTITIONS];
-};
-
-struct mylo_partition_header {
- uint32_t len; /* length of the partition data */
- uint32_t crc; /* CRC value of the partition data */
-};
-
-struct mylo_system_params {
- uint32_t magic; /* must be MYLO_MAGIC_SYS_PARAMS */
- uint32_t res0;
- uint32_t res1;
- uint32_t mylo_ver;
- uint16_t vid; /* Vendor ID */
- uint16_t did; /* Device ID */
- uint16_t svid; /* Sub Vendor ID */
- uint16_t sdid; /* Sub Device ID */
- uint32_t rev; /* device revision */
- uint32_t fwhi;
- uint32_t fwlo;
- uint32_t tftp_addr;
- uint32_t prog_start;
- uint32_t flash_size; /* Size of boot FLASH in bytes */
- uint32_t dram_size; /* Size of onboard RAM in bytes */
-};
-
-
-struct mylo_eth_addr {
- uint8_t mac[6];
- uint8_t csum[2];
-};
-
-#define MYLO_ETHADDR_COUNT 8 /* maximum number of ethernet address
- in the board parameters */
-
-struct mylo_board_params {
- uint32_t magic; /* must be MYLO_MAGIC_BOARD_PARAMS */
- uint32_t res0;
- uint32_t res1;
- uint32_t res2;
- struct mylo_eth_addr addr[MYLO_ETHADDR_COUNT];
-};
-
-struct myloader_info {
- u32 vid;
- u32 did;
- u32 svid;
- u32 sdid;
- uint8_t macs[MYLO_ETHADDR_COUNT][6];
-};
-
-extern struct myloader_info myloader_info;
-extern int myloader_present(void) __init;
-
-#endif /* _MYLOADER_H_*/
+++ /dev/null
-/*
- * Mikrotik's RouterBOOT definitions
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _PROM_ROUTERBOOT_H_
-#define _PROM_ROUTERBOOT_H_
-
-struct rb_bios_settings {
- u32 hs_offs; /* hard settings offset */
- u32 hs_size; /* hard settings size */
- u32 fw_offs; /* firmware offset */
- u32 ss_offs; /* soft settings offset */
- u32 ss_size; /* soft settings size */
-};
-
-struct rb_hard_settings {
- char *name; /* board name */
- char *bios_ver; /* BIOS version */
- u32 mem_size; /* memory size in bytes */
- u32 mac_count; /* number of mac addresses */
- u8 *mac_base; /* mac address base */
-};
-
-extern int routerboot_present(void) __init;
-extern char *routerboot_get_boardname(void);
-
-extern struct rb_hard_settings rb_hs;
-
-#endif /* _PROM_ROUTERBOOT_H_ */
+++ /dev/null
-/*
- * ZyNOS (ZyXEL's Networking OS) definitions
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#ifndef _ZYNOS_H
-#define _ZYNOS_H
-
-#define ZYNOS_NAME_LEN 32
-#define ZYNOS_FEAT_BYTES 22
-#define ZYNOS_MAC_LEN 6
-
-struct zynos_board_info {
- unsigned char vendor[ZYNOS_NAME_LEN];
- unsigned char product[ZYNOS_NAME_LEN];
- u32 bootext_addr;
- u32 res0;
- u16 board_id;
- u8 res1[6];
- u8 feat_other[ZYNOS_FEAT_BYTES];
- u8 feat_main;
- u8 res2;
- u8 mac[ZYNOS_MAC_LEN];
- u8 country;
- u8 dbgflag;
-} __attribute__ ((packed));
-
-/*
- * Vendor IDs
- */
-#define ZYNOS_VENDOR_ID_ZYXEL 0
-#define ZYNOS_VENDOR_ID_NETGEAR 1
-#define ZYNOS_VENDOR_ID_DLINK 2
-#define ZYNOS_VENDOR_ID_OTHER 3
-#define ZYNOS_VENDOR_ID_LUCENT 4
-
-/*
- * Vendor names
- */
-#define ZYNOS_VENDOR_DLINK "D-Link"
-#define ZYNOS_VENDOR_LUCENT "LUCENT"
-#define ZYNOS_VENDOR_NETGEAR "NetGear"
-#define ZYNOS_VENDOR_ZYXEL "ZyXEL"
-
-/*
- * Board IDs (big-endian)
- */
-#define ZYNOS_BOARD_ES2108 0x00F2 /* Ethernet Switch 2108 */
-#define ZYNOS_BOARD_ES2108F 0x01AF /* Ethernet Switch 2108-F */
-#define ZYNOS_BOARD_ES2108G 0x00F3 /* Ethernet Switch 2108-G */
-#define ZYNOS_BOARD_ES2108LC 0x00FC /* Ethernet Switch 2108-LC */
-#define ZYNOS_BOARD_ES2108PWR 0x00F4 /* Ethernet Switch 2108PWR */
-#define ZYNOS_BOARD_HS100 0x9FF1 /* HomeSafe 100/100W */
-#define ZYNOS_BOARD_P334 0x9FF5 /* Prestige 334 */
-#define ZYNOS_BOARD_P334U 0x9FDD /* Prestige 334U */
-#define ZYNOS_BOARD_P334W 0x9FF3 /* Prestige 334W */
-#define ZYNOS_BOARD_P334WH 0x00E0 /* Prestige 334WH */
-#define ZYNOS_BOARD_P334WHD 0x00E1 /* Prestige 334WHD */
-#define ZYNOS_BOARD_P334WT 0x9FEF /* Prestige 334WT */
-#define ZYNOS_BOARD_P334WT_ALT 0x9F02 /* Prestige 334WT alternative*/
-#define ZYNOS_BOARD_P335 0x9FED /* Prestige 335/335WT */
-#define ZYNOS_BOARD_P335PLUS 0x0025 /* Prestige 335Plus */
-#define ZYNOS_BOARD_P335U 0x9FDC /* Prestige 335U */
-
-/*
- * Some magic numbers (big-endian)
- */
-#define ZYNOS_MAGIC_DBGAREA1 0x48646267 /* "Hdbg" */
-#define ZYNOS_MAGIC_DBGAREA2 0x61726561 /* "area" */
-
-struct bootbase_info {
- u16 vendor_id;
- u16 board_id;
- u8 mac[6];
-};
-
-extern struct bootbase_info bootbase_info;
-extern int bootbase_present(void) __init;
-
-#endif /* _ZYNOS_H */
+++ /dev/null
-/*
- * 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_ADM5120_WAR_H
-#define __ASM_MIPS_MACH_ADM5120_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_ADM5120_WAR_H */
+++ /dev/null
-/*
- * ADM5120 PCI Host Controller driver
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel
- * done by Jeroen Vreeken
- * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
- *
- * Jeroen's code was based on the Linux 2.4.xx source codes found in various
- * tarballs released by Edimax for it's ADM5120 based devices
- * Copyright (C) ADMtek Incorporated
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/io.h>
-#include <linux/delay.h>
-
-#include <linux/pci.h>
-#include <linux/pci_ids.h>
-#include <linux/pci_regs.h>
-
-#include <asm/bootinfo.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(f, a...) printk(KERN_DEBUG f, ## a)
-#else
-#define DBG(f, a...) do {} while (0)
-#endif
-
-#define PCI_ENABLE 0x80000000
-
-/* -------------------------------------------------------------------------*/
-
-static unsigned int adm5120_pci_nr_irqs __initdata;
-static struct adm5120_pci_irq *adm5120_pci_irq_map __initdata;
-
-static DEFINE_SPINLOCK(pci_lock);
-
-/* -------------------------------------------------------------------------*/
-
-static inline void write_cfgaddr(u32 addr)
-{
- __raw_writel((addr | PCI_ENABLE),
- (void __iomem *)(KSEG1ADDR(ADM5120_PCICFG_ADDR)));
-}
-
-static inline void write_cfgdata(u32 data)
-{
- __raw_writel(data, (void __iomem *)KSEG1ADDR(ADM5120_PCICFG_DATA));
-}
-
-static inline u32 read_cfgdata(void)
-{
- return __raw_readl((void __iomem *)KSEG1ADDR(ADM5120_PCICFG_DATA));
-}
-
-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_config_read(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();
-
- DBG("PCI: cfg_read %02u.%02u.%01u/%02X:%01d, cfg:0x%08X",
- bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn),
- where, size, data);
-
- 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;
- DBG(", 0x%08X returned\n", data);
-
- spin_unlock_irqrestore(&pci_lock, flags);
-
- return PCIBIOS_SUCCESSFUL;
-}
-
-static int pci_config_write(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();
-
- DBG("PCI: cfg_write %02u.%02u.%01u/%02X:%01d, cfg:0x%08X",
- bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn),
- where, size, data);
-
- 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);
- DBG(", 0x%08X written\n", data);
-
- spin_unlock_irqrestore(&pci_lock, flags);
-
- return PCIBIOS_SUCCESSFUL;
-}
-
-struct pci_ops adm5120_pci_ops = {
- .read = pci_config_read,
- .write = pci_config_write,
-};
-
-/* -------------------------------------------------------------------------*/
-
-static void adm5120_pci_fixup(struct pci_dev *dev)
-{
- if (dev->devfn != 0)
- return;
-
- /* 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(PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_ADM5120,
- adm5120_pci_fixup);
-
-/* -------------------------------------------------------------------------*/
-
-void __init adm5120_pci_set_irq_map(unsigned int nr_irqs,
- struct adm5120_pci_irq *map)
-{
- adm5120_pci_nr_irqs = nr_irqs;
- adm5120_pci_irq_map = map;
-}
-
-int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-{
- int irq = -1;
- int i;
-
- if ((!adm5120_pci_nr_irqs) || (!adm5120_pci_irq_map)) {
- printk(KERN_ALERT "PCI: pci_irq_map is not initialized\n");
- goto out;
- }
-
- if (slot < 1 || slot > 4) {
- printk(KERN_ALERT "PCI: slot number %u is not supported\n",
- slot);
- goto out;
- }
-
- for (i = 0; i < adm5120_pci_nr_irqs; i++) {
- if ((adm5120_pci_irq_map[i].slot == slot)
- && (adm5120_pci_irq_map[i].func == PCI_FUNC(dev->devfn))
- && (adm5120_pci_irq_map[i].pin == pin)) {
- irq = adm5120_pci_irq_map[i].irq;
- break;
- }
- }
-
- if (irq < 0) {
- printk(KERN_ALERT "PCI: no irq found for %s pin:%u\n",
- pci_name((struct pci_dev *)dev), pin);
- } else {
- printk(KERN_INFO "PCI: mapping irq for %s pin:%u, irq:%d\n",
- pci_name((struct pci_dev *)dev), pin, irq);
- }
-
-out:
- return irq;
-}
-
-int pcibios_plat_dev_init(struct pci_dev *dev)
-{
- return 0;
-}
-
-/* -------------------------------------------------------------------------*/
-
-static struct resource pci_io_resource = {
- .name = "ADM5120 PCI I/O",
- .start = ADM5120_PCIIO_BASE,
- .end = ADM5120_PCICFG_ADDR-1,
- .flags = IORESOURCE_IO
-};
-
-static struct resource pci_mem_resource = {
- .name = "ADM5120 PCI MEM",
- .start = ADM5120_PCIMEM_BASE,
- .end = ADM5120_PCIIO_BASE-1,
- .flags = IORESOURCE_MEM
-};
-
-static struct pci_controller adm5120_controller = {
- .pci_ops = &adm5120_pci_ops,
- .io_resource = &pci_io_resource,
- .mem_resource = &pci_mem_resource,
-};
-
-static int __init adm5120_pci_setup(void)
-{
- if (adm5120_package_pqfp()) {
- printk(KERN_INFO "PCI: not available on ADM5120P\n");
- return -1;
- }
-
- /* Avoid ISA compat ranges. */
- PCIBIOS_MIN_IO = 0x00000000;
- PCIBIOS_MIN_MEM = 0x00000000;
-
- /* Set I/O resource limits. */
- ioport_resource.end = 0x1fffffff;
- iomem_resource.end = 0xffffffff;
-
- register_pci_controller(&adm5120_controller);
- return 0;
-}
-
-arch_initcall(adm5120_pci_setup);
+++ /dev/null
-/*
- * A low-level PATA driver to handle a Compact Flash connected on the
- * Mikrotik's RouterBoard 153 board.
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was based on: drivers/ata/pata_ixp4xx_cf.c
- * Copyright (C) 2006-07 Tower Technologies
- * Author: Alessandro Zummo <a.zummo@towertech.it>
- *
- * Also was based on the driver for Linux 2.4.xx published by Mikrotik for
- * their RouterBoard 1xx and 5xx series devices. The original Mikrotik code
- * seems not to have a license.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-
-#include <linux/libata.h>
-#include <scsi/scsi_host.h>
-
-#define DRV_NAME "pata-rb153-cf"
-#define DRV_VERSION "0.5.0"
-#define DRV_DESC "PATA driver for RouterBOARD 153 Compact Flash"
-
-#define RB153_CF_MAXPORTS 1
-#define RB153_CF_IO_DELAY 100
-
-#define RB153_CF_REG_CMD 0x0800
-#define RB153_CF_REG_CTRL 0x080E
-#define RB153_CF_REG_DATA 0x0C00
-
-struct rb153_cf_info {
- void __iomem *iobase;
- unsigned int gpio_line;
- int frozen;
- unsigned int irq;
-};
-
-static inline void rb153_pata_finish_io(struct ata_port *ap)
-{
- struct rb153_cf_info *info = ap->host->private_data;
-
- /* FIXME: Keep previous delay. If this is merely a fence then
- * ata_sff_sync might be sufficient. */
- ata_sff_dma_pause(ap);
- ndelay(RB153_CF_IO_DELAY);
-
- irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
-}
-
-static void rb153_pata_exec_command(struct ata_port *ap,
- const struct ata_taskfile *tf)
-{
- writeb(tf->command, ap->ioaddr.command_addr);
- rb153_pata_finish_io(ap);
-}
-
-static unsigned int rb153_pata_data_xfer(struct ata_device *adev,
- unsigned char *buf,
- unsigned int buflen,
- int write_data)
-{
- void __iomem *ioaddr = adev->link->ap->ioaddr.data_addr;
- unsigned int t;
-
- t = buflen;
- if (write_data) {
- for (; t > 0; t--, buf++)
- writeb(*buf, ioaddr);
- } else {
- for (; t > 0; t--, buf++)
- *buf = readb(ioaddr);
- }
-
- rb153_pata_finish_io(adev->link->ap);
- return buflen;
-}
-
-static void rb153_pata_freeze(struct ata_port *ap)
-{
- struct rb153_cf_info *info = ap->host->private_data;
-
- info->frozen = 1;
-}
-
-static void rb153_pata_thaw(struct ata_port *ap)
-{
- struct rb153_cf_info *info = ap->host->private_data;
-
- info->frozen = 0;
-}
-
-static irqreturn_t rb153_pata_irq_handler(int irq, void *dev_instance)
-{
- struct ata_host *ah = dev_instance;
- struct rb153_cf_info *info = ah->private_data;
-
- if (gpio_get_value(info->gpio_line)) {
- irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW);
- if (!info->frozen)
- ata_sff_interrupt(irq, dev_instance);
- } else {
- irq_set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH);
- }
-
- return IRQ_HANDLED;
-}
-
-static struct ata_port_operations rb153_pata_port_ops = {
- .inherits = &ata_sff_port_ops,
- .sff_exec_command = rb153_pata_exec_command,
- .sff_data_xfer = rb153_pata_data_xfer,
- .freeze = rb153_pata_freeze,
- .thaw = rb153_pata_thaw,
-};
-
-static struct scsi_host_template rb153_pata_sht = {
- ATA_PIO_SHT(DRV_NAME),
-};
-
-static void rb153_pata_setup_port(struct ata_host *ah)
-{
- struct rb153_cf_info *info = ah->private_data;
- struct ata_port *ap;
-
- ap = ah->ports[0];
-
- ap->ops = &rb153_pata_port_ops;
- ap->pio_mask = 0x1f; /* PIO4 */
-
- ap->ioaddr.cmd_addr = info->iobase + RB153_CF_REG_CMD;
- ap->ioaddr.ctl_addr = info->iobase + RB153_CF_REG_CTRL;
- ap->ioaddr.altstatus_addr = info->iobase + RB153_CF_REG_CTRL;
-
- ata_sff_std_ports(&ap->ioaddr);
-
- ap->ioaddr.data_addr = info->iobase + RB153_CF_REG_DATA;
-}
-
-static int rb153_pata_driver_probe(struct platform_device *pdev)
-{
- unsigned int irq;
- int gpio;
- struct resource *res;
- struct ata_host *ah;
- struct rb153_cf_info *info;
- int ret;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev, "no IOMEM resource found\n");
- return -EINVAL;
- }
-
- irq = platform_get_irq(pdev, 0);
- if (irq <= 0) {
- dev_err(&pdev->dev, "no IRQ resource found\n");
- return -ENOENT;
- }
-
- gpio = irq_to_gpio(irq);
- if (gpio < 0) {
- dev_err(&pdev->dev, "no GPIO found for irq%d\n", irq);
- return -ENOENT;
- }
-
- ret = gpio_request(gpio, DRV_NAME);
- if (ret) {
- dev_err(&pdev->dev, "GPIO request failed\n");
- return ret;
- }
-
- ah = ata_host_alloc(&pdev->dev, RB153_CF_MAXPORTS);
- if (!ah)
- return -ENOMEM;
-
- platform_set_drvdata(pdev, ah);
-
- info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
- if (!info)
- return -ENOMEM;
-
- ah->private_data = info;
- info->gpio_line = gpio;
- info->irq = irq;
-
- info->iobase = devm_ioremap_nocache(&pdev->dev, res->start,
- res->end - res->start + 1);
- if (!info->iobase)
- return -ENOMEM;
-
- ret = gpio_direction_input(gpio);
- if (ret) {
- dev_err(&pdev->dev, "unable to set GPIO direction, err=%d\n",
- ret);
- goto err_free_gpio;
- }
-
- rb153_pata_setup_port(ah);
-
- ret = ata_host_activate(ah, irq, rb153_pata_irq_handler,
- IRQF_TRIGGER_LOW, &rb153_pata_sht);
- if (ret)
- goto err_free_gpio;
-
- return 0;
-
-err_free_gpio:
- gpio_free(gpio);
-
- return ret;
-}
-
-static int rb153_pata_driver_remove(struct platform_device *pdev)
-{
- struct ata_host *ah = platform_get_drvdata(pdev);
- struct rb153_cf_info *info = ah->private_data;
-
- ata_host_detach(ah);
- gpio_free(info->gpio_line);
-
- return 0;
-}
-
-static struct platform_driver rb153_pata_platform_driver = {
- .probe = rb153_pata_driver_probe,
- .remove = rb153_pata_driver_remove,
- .driver = {
- .name = DRV_NAME,
- .owner = THIS_MODULE,
- },
-};
-
-/* ------------------------------------------------------------------------ */
-
-#define DRV_INFO DRV_DESC " version " DRV_VERSION
-
-static int __init rb153_pata_module_init(void)
-{
- printk(KERN_INFO DRV_INFO "\n");
-
- return platform_driver_register(&rb153_pata_platform_driver);
-}
-
-static void __exit rb153_pata_module_exit(void)
-{
- platform_driver_unregister(&rb153_pata_platform_driver);
-}
-
-MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
-MODULE_DESCRIPTION(DRV_DESC);
-MODULE_VERSION(DRV_VERSION);
-MODULE_LICENSE("GPL v2");
-
-module_init(rb153_pata_module_init);
-module_exit(rb153_pata_module_exit);
+++ /dev/null
-/*
- * LED ADM5120 Switch Port State Trigger
- *
- * Copyright (C) 2007 Bernhard Held <bernhard at bernhardheld.de>
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was based on: drivers/leds/ledtrig-timer.c
- * Copyright 2005-2006 Openedhand Ltd.
- * Author: Richard Purdie
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/device.h>
-
-#include <linux/gpio.h>
-
-#include "leds.h"
-
-#define DRV_NAME "port_state"
-#define DRV_DESC "LED ADM5120 Switch Port State Trigger"
-
-struct port_state {
- char *name;
- unsigned int value;
-};
-
-#define PORT_STATE(n, v) {.name = (n), .value = (v)}
-
-static struct port_state port_states[] = {
- PORT_STATE("off", LED_OFF),
- PORT_STATE("on", LED_FULL),
- PORT_STATE("flash", ADM5120_GPIO_FLASH),
- PORT_STATE("link", ADM5120_GPIO_LINK),
- PORT_STATE("speed", ADM5120_GPIO_SPEED),
- PORT_STATE("duplex", ADM5120_GPIO_DUPLEX),
- PORT_STATE("act", ADM5120_GPIO_ACT),
- PORT_STATE("coll", ADM5120_GPIO_COLL),
- PORT_STATE("link_act", ADM5120_GPIO_LINK_ACT),
- PORT_STATE("duplex_coll", ADM5120_GPIO_DUPLEX_COLL),
- PORT_STATE("10M_act", ADM5120_GPIO_10M_ACT),
- PORT_STATE("100M_act", ADM5120_GPIO_100M_ACT),
-};
-
-static ssize_t led_port_state_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct led_classdev *led_cdev = dev_get_drvdata(dev);
- struct port_state *state = led_cdev->trigger_data;
- int len = 0;
- int i;
-
- *buf = '\0';
- for (i = 0; i < ARRAY_SIZE(port_states); i++) {
- if (&port_states[i] == state)
- len += sprintf(buf+len, "[%s] ", port_states[i].name);
- else
- len += sprintf(buf+len, "%s ", port_states[i].name);
- }
- len += sprintf(buf+len, "\n");
-
- return len;
-}
-
-static ssize_t led_port_state_store(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t size)
-{
- struct led_classdev *led_cdev = dev_get_drvdata(dev);
- size_t len;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(port_states); i++) {
- len = strlen(port_states[i].name);
- if (strncmp(port_states[i].name, buf, len) != 0)
- continue;
-
- if (buf[len] != '\0' && buf[len] != '\n')
- continue;
-
- led_cdev->trigger_data = &port_states[i];
- led_set_brightness(led_cdev, port_states[i].value);
- return size;
- }
-
- return -EINVAL;
-}
-
-static DEVICE_ATTR(port_state, 0644, led_port_state_show,
- led_port_state_store);
-
-static void adm5120_switch_trig_activate(struct led_classdev *led_cdev)
-{
- struct port_state *state = port_states;
- int rc;
-
- led_cdev->trigger_data = state;
-
- rc = device_create_file(led_cdev->dev, &dev_attr_port_state);
- if (rc)
- goto err;
-
- led_set_brightness(led_cdev, state->value);
-
- return;
-err:
- led_cdev->trigger_data = NULL;
-}
-
-static void adm5120_switch_trig_deactivate(struct led_classdev *led_cdev)
-{
- struct port_state *state = led_cdev->trigger_data;
-
- if (!state)
- return;
-
- device_remove_file(led_cdev->dev, &dev_attr_port_state);
-
-}
-
-static struct led_trigger adm5120_switch_led_trigger = {
- .name = DRV_NAME,
- .activate = adm5120_switch_trig_activate,
- .deactivate = adm5120_switch_trig_deactivate,
-};
-
-static int __init adm5120_switch_trig_init(void)
-{
- led_trigger_register(&adm5120_switch_led_trigger);
- return 0;
-}
-
-static void __exit adm5120_switch_trig_exit(void)
-{
- led_trigger_unregister(&adm5120_switch_led_trigger);
-}
-
-module_init(adm5120_switch_trig_init);
-module_exit(adm5120_switch_trig_exit);
-
-MODULE_AUTHOR("Bernhard Held <bernhard at bernhardheld.de>, "
- "Gabor Juhos <juhosg@openwrt.org>");
-MODULE_DESCRIPTION(DRV_DESC);
-MODULE_LICENSE("GPL v2");
+++ /dev/null
-/*
- * Platform driver for NOR flash devices on ADM5120 based boards
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/mtd/map/physmap.c
- * Copyright (C) 2003 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/io.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/partitions.h>
-
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-#include <asm/mach-adm5120/adm5120_mpmc.h>
-#include <asm/mach-adm5120/adm5120_platform.h>
-
-#define DRV_NAME "adm5120-flash"
-#define DRV_DESC "ADM5120 flash MAP driver"
-#define MAX_PARSED_PARTS 8
-
-#ifdef ADM5120_FLASH_DEBUG
-#define MAP_DBG(m, f, a...) printk(KERN_INFO "%s: " f, (m->name) , ## a)
-#else
-#define MAP_DBG(m, f, a...) do {} while (0)
-#endif
-#define MAP_ERR(m, f, a...) printk(KERN_ERR "%s: " f, (m->name) , ## a)
-#define MAP_INFO(m, f, a...) printk(KERN_INFO "%s: " f, (m->name) , ## a)
-
-struct adm5120_map_info {
- struct map_info map;
- void (*switch_bank)(unsigned);
- unsigned long window_size;
-};
-
-struct adm5120_flash_info {
- struct mtd_info *mtd;
- struct resource *res;
- struct platform_device *dev;
- struct adm5120_map_info amap;
-};
-
-struct flash_desc {
- u32 phys;
- u32 srs_shift;
-};
-
-/*
- * Globals
- */
-static DEFINE_SPINLOCK(adm5120_flash_spin);
-#define FLASH_LOCK() spin_lock(&adm5120_flash_spin)
-#define FLASH_UNLOCK() spin_unlock(&adm5120_flash_spin)
-
-static u32 flash_bankwidths[4] = { 1, 2, 4, 0 };
-
-static u32 flash_sizes[8] = {
- 0, 512*1024, 1024*1024, 2*1024*1024,
- 4*1024*1024, 0, 0, 0
-};
-
-static struct flash_desc flash_descs[2] = {
- {
- .phys = ADM5120_SRAM0_BASE,
- .srs_shift = MEMCTRL_SRS0_SHIFT,
- }, {
- .phys = ADM5120_SRAM1_BASE,
- .srs_shift = MEMCTRL_SRS1_SHIFT,
- }
-};
-
-static const char const *probe_types[] = {
- "cfi_probe",
- "jedec_probe",
- "map_rom",
- NULL
-};
-
-static const char const *parse_types[] = {
- "cmdlinepart",
-#ifdef CONFIG_MTD_REDBOOT_PARTS
- "RedBoot",
-#endif
-#ifdef CONFIG_MTD_MYLOADER_PARTS
- "MyLoader",
-#endif
- NULL,
-};
-
-#define BANK_SIZE (2<<20)
-#define BANK_SIZE_MAX (4<<20)
-#define BANK_OFFS_MASK (BANK_SIZE-1)
-#define BANK_START_MASK (~BANK_OFFS_MASK)
-
-static inline struct adm5120_map_info *map_to_amap(struct map_info *map)
-{
- return (struct adm5120_map_info *)map;
-}
-
-static void adm5120_flash_switchbank(struct map_info *map,
- unsigned long ofs)
-{
- struct adm5120_map_info *amap = map_to_amap(map);
- unsigned bank;
-
- if (amap->switch_bank == NULL)
- return;
-
- bank = (ofs & BANK_START_MASK) >> 21;
- if (bank > 1)
- BUG();
-
- MAP_DBG(map, "switching to bank %u, ofs=%lX\n", bank, ofs);
- amap->switch_bank(bank);
-}
-
-static map_word adm5120_flash_read(struct map_info *map, unsigned long ofs)
-{
- struct adm5120_map_info *amap = map_to_amap(map);
- map_word ret;
-
- MAP_DBG(map, "reading from ofs %lX\n", ofs);
-
- if (ofs >= amap->window_size)
- return map_word_ff(map);
-
- FLASH_LOCK();
- adm5120_flash_switchbank(map, ofs);
- ret = inline_map_read(map, (ofs & (amap->window_size-1)));
- FLASH_UNLOCK();
-
- return ret;
-}
-
-static void adm5120_flash_write(struct map_info *map, const map_word datum,
- unsigned long ofs)
-{
- struct adm5120_map_info *amap = map_to_amap(map);
-
- MAP_DBG(map, "writing to ofs %lX\n", ofs);
-
- if (ofs > amap->window_size)
- return;
-
- FLASH_LOCK();
- adm5120_flash_switchbank(map, ofs);
- inline_map_write(map, datum, (ofs & (amap->window_size-1)));
- FLASH_UNLOCK();
-}
-
-static void adm5120_flash_copy_from(struct map_info *map, void *to,
- unsigned long from, ssize_t len)
-{
- struct adm5120_map_info *amap = map_to_amap(map);
- char *p;
- ssize_t t;
-
- MAP_DBG(map, "copy_from, to=%lX, from=%lX, len=%lX\n",
- (unsigned long)to, from, (unsigned long)len);
-
- if (from > amap->window_size)
- return;
-
- p = (char *)to;
- while (len > 0) {
- t = len;
- if ((from < BANK_SIZE) && ((from+len) > BANK_SIZE))
- t = BANK_SIZE-from;
-
- FLASH_LOCK();
- MAP_DBG(map, "copying %lu byte(s) from %lX to %lX\n",
- (unsigned long)t, (from & (amap->window_size-1)),
- (unsigned long)p);
- adm5120_flash_switchbank(map, from);
- inline_map_copy_from(map, p, (from & (amap->window_size-1)), t);
- FLASH_UNLOCK();
- p += t;
- from += t;
- len -= t;
- }
-}
-
-static int adm5120_flash_initres(struct adm5120_flash_info *info)
-{
- struct map_info *map = &info->amap.map;
- int err = 0;
-
- info->res = request_mem_region(map->phys, info->amap.window_size,
- map->name);
- if (info->res == NULL) {
- MAP_ERR(map, "could not reserve memory region\n");
- err = -ENOMEM;
- goto out;
- }
-
- map->virt = ioremap_nocache(map->phys, info->amap.window_size);
- if (map->virt == NULL) {
- MAP_ERR(map, "failed to ioremap flash region\n");
- err = -ENOMEM;
- goto out;
- }
-
-out:
- return err;
-}
-
-static int adm5120_flash_initinfo(struct adm5120_flash_info *info,
- struct platform_device *dev)
-{
- struct map_info *map = &info->amap.map;
- struct adm5120_flash_platform_data *pdata = dev->dev.platform_data;
- struct flash_desc *fdesc;
- u32 t = 0;
-
- map->name = dev_name(&dev->dev);
-
- if (dev->id > 1) {
- MAP_ERR(map, "invalid flash id\n");
- goto err_out;
- }
-
- fdesc = &flash_descs[dev->id];
-
- if (pdata)
- info->amap.window_size = pdata->window_size;
-
- if (info->amap.window_size == 0) {
- /* get memory window size */
- t = SW_READ_REG(SWITCH_REG_MEMCTRL) >> fdesc->srs_shift;
- t &= MEMCTRL_SRS_MASK;
- info->amap.window_size = flash_sizes[t];
- }
-
- if (info->amap.window_size == 0) {
- MAP_ERR(map, "unable to determine window size\n");
- goto err_out;
- }
-
- /* get flash bus width */
- switch (dev->id) {
- case 0:
- t = MPMC_READ_REG(SC1) & SC_MW_MASK;
- break;
- case 1:
- t = MPMC_READ_REG(SC0) & SC_MW_MASK;
- break;
- }
- map->bankwidth = flash_bankwidths[t];
- if (map->bankwidth == 0) {
- MAP_ERR(map, "invalid bus width detected\n");
- goto err_out;
- }
-
- map->phys = fdesc->phys;
- map->size = BANK_SIZE_MAX;
-
- simple_map_init(map);
- map->read = adm5120_flash_read;
- map->write = adm5120_flash_write;
- map->copy_from = adm5120_flash_copy_from;
-
- if (pdata) {
- map->set_vpp = pdata->set_vpp;
- info->amap.switch_bank = pdata->switch_bank;
- }
-
- info->dev = dev;
-
- MAP_INFO(map, "probing at 0x%lX, size:%ldKiB, width:%d bits\n",
- (unsigned long)map->phys,
- (unsigned long)info->amap.window_size >> 10,
- map->bankwidth*8);
-
- return 0;
-
-err_out:
- return -ENODEV;
-}
-
-static void adm5120_flash_initbanks(struct adm5120_flash_info *info)
-{
- struct map_info *map = &info->amap.map;
-
- if (info->mtd->size <= BANK_SIZE)
- /* no bank switching needed */
- return;
-
- if (info->amap.switch_bank) {
- info->amap.window_size = info->mtd->size;
- return;
- }
-
- MAP_ERR(map, "reduce visibility from %ldKiB to %ldKiB\n",
- (unsigned long)map->size >> 10,
- (unsigned long)info->mtd->size >> 10);
-
- info->mtd->size = info->amap.window_size;
-}
-
-static int adm5120_flash_remove(struct platform_device *dev)
-{
- struct adm5120_flash_info *info;
-
- info = platform_get_drvdata(dev);
- if (info == NULL)
- return 0;
-
- platform_set_drvdata(dev, NULL);
-
- if (info->mtd != NULL) {
- mtd_device_unregister(info->mtd);
- map_destroy(info->mtd);
- }
-
- if (info->amap.map.virt != NULL)
- iounmap(info->amap.map.virt);
-
- if (info->res != NULL) {
- release_resource(info->res);
- kfree(info->res);
- }
-
- return 0;
-}
-
-static int adm5120_flash_probe(struct platform_device *dev)
-{
- struct adm5120_flash_platform_data *pdata;
- struct adm5120_flash_info *info;
- struct map_info *map;
- const char **probe_type;
- int err;
-
- pdata = dev->dev.platform_data;
- if (!pdata) {
- dev_err(&dev->dev, "no platform data\n");
- return -EINVAL;
- }
-
- info = kzalloc(sizeof(*info), GFP_KERNEL);
- if (info == NULL) {
- err = -ENOMEM;
- goto err_out;
- }
-
- platform_set_drvdata(dev, info);
-
- err = adm5120_flash_initinfo(info, dev);
- if (err)
- goto err_out;
-
- err = adm5120_flash_initres(info);
- if (err)
- goto err_out;
-
- map = &info->amap.map;
- for (probe_type = probe_types; info->mtd == NULL && *probe_type != NULL;
- probe_type++)
- info->mtd = do_map_probe(*probe_type, map);
-
- if (info->mtd == NULL) {
- MAP_ERR(map, "map_probe failed\n");
- err = -ENXIO;
- goto err_out;
- }
-
- adm5120_flash_initbanks(info);
-
- if (info->mtd->size < info->amap.window_size) {
- /* readjust resources */
- iounmap(map->virt);
- release_resource(info->res);
- kfree(info->res);
-
- info->amap.window_size = info->mtd->size;
- map->size = info->mtd->size;
- MAP_INFO(map, "reducing map size to %ldKiB\n",
- (unsigned long)map->size >> 10);
- err = adm5120_flash_initres(info);
- if (err)
- goto err_out;
- }
-
- MAP_INFO(map, "found at 0x%lX, size:%ldKiB, width:%d bits\n",
- (unsigned long)map->phys, (unsigned long)info->mtd->size >> 10,
- map->bankwidth*8);
-
- info->mtd->owner = THIS_MODULE;
-
- err = mtd_device_parse_register(info->mtd, parse_types, 0,
- pdata->parts, pdata->nr_parts);
- if (err)
- goto err_out;
-
- return 0;
-
-err_out:
- adm5120_flash_remove(dev);
- return err;
-}
-
-#ifdef CONFIG_PM
-static int adm5120_flash_suspend(struct platform_device *dev,
- pm_message_t state)
-{
- struct adm5120_flash_info *info = platform_get_drvdata(dev);
- int ret = 0;
-
- if (info)
- ret = info->mtd->suspend(info->mtd);
-
- return ret;
-}
-
-static int adm5120_flash_resume(struct platform_device *dev)
-{
- struct adm5120_flash_info *info = platform_get_drvdata(dev);
-
- if (info)
- info->mtd->resume(info->mtd);
-
- return 0;
-}
-
-static void adm5120_flash_shutdown(struct platform_device *dev)
-{
- struct adm5120_flash_info *info = platform_get_drvdata(dev);
-
- if (info && info->mtd->suspend(info->mtd) == 0)
- info->mtd->resume(info->mtd);
-}
-#endif
-
-static struct platform_driver adm5120_flash_driver = {
- .probe = adm5120_flash_probe,
- .remove = adm5120_flash_remove,
-#ifdef CONFIG_PM
- .suspend = adm5120_flash_suspend,
- .resume = adm5120_flash_resume,
- .shutdown = adm5120_flash_shutdown,
-#endif
- .driver = {
- .name = DRV_NAME,
- },
-};
-
-static int __init adm5120_flash_init(void)
-{
- int err;
-
- err = platform_driver_register(&adm5120_flash_driver);
-
- return err;
-}
-
-static void __exit adm5120_flash_exit(void)
-{
- platform_driver_unregister(&adm5120_flash_driver);
-}
-
-module_init(adm5120_flash_init);
-module_exit(adm5120_flash_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
-MODULE_DESCRIPTION(DRV_DESC);
+++ /dev/null
-/*
- * Copyright (C) Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/list.h>
-#include <linux/kmod.h>
-#include <linux/root_dev.h>
-
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/partitions.h>
-
-#include <linux/byteorder/generic.h>
-
-#define PFX "trxsplit: "
-
-#define TRX_MAGIC 0x30524448 /* "HDR0" */
-#define TRX_VERSION 1
-#define TRX_MAX_LEN 0x3A0000
-#define TRX_NO_HEADER 0x1 /* do not write TRX header */
-#define TRX_GZ_FILES 0x2 /* contains individual gzip files */
-#define TRX_MAX_OFFSET 3
-#define TRX_MIN_KERNEL_SIZE (256 * 1024)
-
-struct trx_header {
- u32 magic; /* "HDR0" */
- u32 len; /* Length of file including header */
- u32 crc32; /* 32-bit CRC from flag_version to end of file */
- u32 flag_version; /* 0:15 flags, 16:31 version */
- u32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions */
-};
-
-#define TRX_ALIGN 0x1000
-
-static int trx_nr_parts;
-static unsigned long trx_offset;
-static struct mtd_info *trx_mtd;
-static struct mtd_partition trx_parts[TRX_MAX_OFFSET];
-static struct trx_header trx_hdr;
-
-static int trxsplit_refresh_partitions(struct mtd_info *mtd);
-
-static int trxsplit_checktrx(struct mtd_info *mtd, unsigned long offset)
-{
- size_t retlen;
- int err;
-
- err = mtd_read(mtd, offset, sizeof(trx_hdr), &retlen, (void *)&trx_hdr);
- if (err) {
- printk(KERN_ALERT PFX "unable to read from '%s'\n", mtd->name);
- goto err_out;
- }
-
- if (retlen != sizeof(trx_hdr)) {
- printk(KERN_ALERT PFX "reading failed on '%s'\n", mtd->name);
- goto err_out;
- }
-
- trx_hdr.magic = le32_to_cpu(trx_hdr.magic);
- trx_hdr.len = le32_to_cpu(trx_hdr.len);
- trx_hdr.crc32 = le32_to_cpu(trx_hdr.crc32);
- trx_hdr.flag_version = le32_to_cpu(trx_hdr.flag_version);
- trx_hdr.offsets[0] = le32_to_cpu(trx_hdr.offsets[0]);
- trx_hdr.offsets[1] = le32_to_cpu(trx_hdr.offsets[1]);
- trx_hdr.offsets[2] = le32_to_cpu(trx_hdr.offsets[2]);
-
- /* sanity checks */
- if (trx_hdr.magic != TRX_MAGIC)
- goto err_out;
-
- if (trx_hdr.len > mtd->size - offset)
- goto err_out;
-
- /* TODO: add crc32 checking too? */
-
- return 0;
-
-err_out:
- return -1;
-}
-
-static void trxsplit_findtrx(struct mtd_info *mtd)
-{
- unsigned long offset;
- int err;
-
- printk(KERN_INFO PFX "searching TRX header in '%s'\n", mtd->name);
-
- err = 0;
- for (offset = 0; offset < mtd->size; offset += TRX_ALIGN) {
- err = trxsplit_checktrx(mtd, offset);
- if (err == 0)
- break;
- }
-
- if (err)
- return;
-
- printk(KERN_INFO PFX "TRX header found at 0x%lX\n", offset);
-
- trx_mtd = mtd;
- trx_offset = offset;
-}
-
-static void trxsplit_create_partitions(struct mtd_info *mtd)
-{
- struct mtd_partition *part = trx_parts;
- int err;
- int i;
-
- for (i = 0; i < TRX_MAX_OFFSET; i++) {
- part = &trx_parts[i];
- if (trx_hdr.offsets[i] == 0)
- continue;
- part->offset = trx_offset + trx_hdr.offsets[i];
- trx_nr_parts++;
- }
-
- for (i = 0; i < trx_nr_parts-1; i++)
- trx_parts[i].size = trx_parts[i+1].offset - trx_parts[i].offset;
-
- trx_parts[i].size = mtd->size - trx_parts[i].offset;
-
- i = 0;
- part = &trx_parts[i];
- if (part->size < TRX_MIN_KERNEL_SIZE) {
- part->name = "loader";
- i++;
- }
-
- part = &trx_parts[i];
- part->name = "kernel";
- i++;
-
- part = &trx_parts[i];
- part->name = "rootfs";
-
- err = mtd_device_register(mtd, trx_parts, trx_nr_parts);
- if (err) {
- printk(KERN_ALERT PFX "adding TRX partitions failed\n");
- return;
- }
-
- mtd->refresh_device = trxsplit_refresh_partitions;
-}
-
-static int trxsplit_refresh_partitions(struct mtd_info *mtd)
-{
- printk(KERN_INFO PFX "refreshing TRX partitions in '%s' (%d,%d)\n",
- mtd->name, MTD_BLOCK_MAJOR, mtd->index);
-
- /* remove old partitions */
- mtd_device_unregister(mtd);
-
- trxsplit_findtrx(mtd);
- if (!trx_mtd)
- goto err;
-
- trxsplit_create_partitions(trx_mtd);
- return 1;
-
-err:
- return 0;
-}
-
-static void __init trxsplit_add_mtd(struct mtd_info *mtd)
-{
- if (mtd->type != MTD_NORFLASH) {
- printk(KERN_INFO PFX "'%s' is not a NOR flash, skipped\n",
- mtd->name);
- return;
- }
-
- if (!trx_mtd)
- trxsplit_findtrx(mtd);
-}
-
-static void __init trxsplit_remove_mtd(struct mtd_info *mtd)
-{
- /* nothing to do */
-}
-
-static struct mtd_notifier trxsplit_notifier __initdata = {
- .add = trxsplit_add_mtd,
- .remove = trxsplit_remove_mtd,
-};
-
-static void __init trxsplit_scan(void)
-{
- register_mtd_user(&trxsplit_notifier);
- unregister_mtd_user(&trxsplit_notifier);
-}
-
-static int __init trxsplit_init(void)
-{
- trxsplit_scan();
-
- if (trx_mtd) {
- printk(KERN_INFO PFX "creating TRX partitions in '%s' "
- "(%d,%d)\n", trx_mtd->name, MTD_BLOCK_MAJOR,
- trx_mtd->index);
- trxsplit_create_partitions(trx_mtd);
- }
-
- return 0;
-}
-
-late_initcall(trxsplit_init);
+++ /dev/null
-/*
- * ADM5120 built-in ethernet switch driver
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This code was based on a driver for Linux 2.6.xx by Jeroen Vreeken.
- * Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005
- * NAPI extension for the Jeroen's driver
- * Copyright Thomas Langer (Thomas.Langer@infineon.com), 2007
- * Copyright Friedrich Beckmann (Friedrich.Beckmann@infineon.com), 2007
- * Inspiration for the Jeroen's driver came from the ADMtek 2.4 driver.
- * Copyright ADMtek Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/spinlock.h>
-#include <linux/platform_device.h>
-#include <linux/io.h>
-#include <linux/irq.h>
-
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-
-#include <asm/mipsregs.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-
-#include "adm5120sw.h"
-#include <linux/dma-mapping.h>
-
-#define DRV_NAME "adm5120-switch"
-#define DRV_DESC "ADM5120 built-in ethernet switch driver"
-#define DRV_VERSION "0.1.1"
-
-#define CONFIG_ADM5120_SWITCH_NAPI 1
-#undef CONFIG_ADM5120_SWITCH_DEBUG
-
-/* ------------------------------------------------------------------------ */
-
-#ifdef CONFIG_ADM5120_SWITCH_DEBUG
-#define SW_DBG(f, a...) printk(KERN_DEBUG "%s: " f, DRV_NAME , ## a)
-#else
-#define SW_DBG(f, a...) do {} while (0)
-#endif
-#define SW_ERR(f, a...) printk(KERN_ERR "%s: " f, DRV_NAME , ## a)
-#define SW_INFO(f, a...) printk(KERN_INFO "%s: " f, DRV_NAME , ## a)
-
-#define SWITCH_NUM_PORTS 6
-#define ETH_CSUM_LEN 4
-
-#define RX_MAX_PKTLEN 1550
-#define RX_RING_SIZE 64
-
-#define TX_RING_SIZE 32
-#define TX_QUEUE_LEN 28 /* Limit ring entries actually used. */
-#define TX_TIMEOUT (HZ * 400)
-
-#define RX_DESCS_SIZE (RX_RING_SIZE * sizeof(struct dma_desc *))
-#define RX_SKBS_SIZE (RX_RING_SIZE * sizeof(struct sk_buff *))
-#define TX_DESCS_SIZE (TX_RING_SIZE * sizeof(struct dma_desc *))
-#define TX_SKBS_SIZE (TX_RING_SIZE * sizeof(struct sk_buff *))
-
-#define SKB_ALLOC_LEN (RX_MAX_PKTLEN + 32)
-#define SKB_RESERVE_LEN (NET_IP_ALIGN + NET_SKB_PAD)
-
-#define SWITCH_INTS_HIGH (SWITCH_INT_SHD | SWITCH_INT_RHD | SWITCH_INT_HDF)
-#define SWITCH_INTS_LOW (SWITCH_INT_SLD | SWITCH_INT_RLD | SWITCH_INT_LDF)
-#define SWITCH_INTS_ERR (SWITCH_INT_RDE | SWITCH_INT_SDE | SWITCH_INT_CPUH)
-#define SWITCH_INTS_Q (SWITCH_INT_P0QF | SWITCH_INT_P1QF | SWITCH_INT_P2QF | \
- SWITCH_INT_P3QF | SWITCH_INT_P4QF | SWITCH_INT_P5QF | \
- SWITCH_INT_CPQF | SWITCH_INT_GQF)
-
-#define SWITCH_INTS_ALL (SWITCH_INTS_HIGH | SWITCH_INTS_LOW | \
- SWITCH_INTS_ERR | SWITCH_INTS_Q | \
- SWITCH_INT_MD | SWITCH_INT_PSC)
-
-#define SWITCH_INTS_USED (SWITCH_INTS_LOW | SWITCH_INT_PSC)
-#define SWITCH_INTS_POLL (SWITCH_INT_RLD | SWITCH_INT_LDF | SWITCH_INT_SLD)
-
-/* ------------------------------------------------------------------------ */
-
-struct adm5120_if_priv {
- struct net_device *dev;
-
- unsigned int vlan_no;
- unsigned int port_mask;
-
-#ifdef CONFIG_ADM5120_SWITCH_NAPI
- struct napi_struct napi;
-#endif
-};
-
-struct dma_desc {
- __u32 buf1;
-#define DESC_OWN (1UL << 31) /* Owned by the switch */
-#define DESC_EOR (1UL << 28) /* End of Ring */
-#define DESC_ADDR_MASK 0x1FFFFFF
-#define DESC_ADDR(x) ((__u32)(x) & DESC_ADDR_MASK)
- __u32 buf2;
-#define DESC_BUF2_EN (1UL << 31) /* Buffer 2 enable */
- __u32 buflen;
- __u32 misc;
-/* definitions for tx/rx descriptors */
-#define DESC_PKTLEN_SHIFT 16
-#define DESC_PKTLEN_MASK 0x7FF
-/* tx descriptor specific part */
-#define DESC_CSUM (1UL << 31) /* Append checksum */
-#define DESC_DSTPORT_SHIFT 8
-#define DESC_DSTPORT_MASK 0x3F
-#define DESC_VLAN_MASK 0x3F
-/* rx descriptor specific part */
-#define DESC_SRCPORT_SHIFT 12
-#define DESC_SRCPORT_MASK 0x7
-#define DESC_DA_MASK 0x3
-#define DESC_DA_SHIFT 4
-#define DESC_IPCSUM_FAIL (1UL << 3) /* IP checksum fail */
-#define DESC_VLAN_TAG (1UL << 2) /* VLAN tag present */
-#define DESC_TYPE_MASK 0x3 /* mask for Packet type */
-#define DESC_TYPE_IP 0x0 /* IP packet */
-#define DESC_TYPE_PPPoE 0x1 /* PPPoE packet */
-} __attribute__ ((aligned(16)));
-
-/* ------------------------------------------------------------------------ */
-
-static int adm5120_nrdevs;
-
-static struct net_device *adm5120_devs[SWITCH_NUM_PORTS];
-/* Lookup table port -> device */
-static struct net_device *adm5120_port[SWITCH_NUM_PORTS];
-
-static struct dma_desc *txl_descs;
-static struct dma_desc *rxl_descs;
-
-static dma_addr_t txl_descs_dma;
-static dma_addr_t rxl_descs_dma;
-
-static struct sk_buff **txl_skbuff;
-static struct sk_buff **rxl_skbuff;
-
-static unsigned int cur_rxl, dirty_rxl; /* producer/consumer ring indices */
-static unsigned int cur_txl, dirty_txl;
-
-static unsigned int sw_used;
-
-static DEFINE_SPINLOCK(tx_lock);
-
-/* ------------------------------------------------------------------------ */
-
-static inline u32 sw_read_reg(u32 reg)
-{
- return __raw_readl((void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE)+reg);
-}
-
-static inline void sw_write_reg(u32 reg, u32 val)
-{
- __raw_writel(val, (void __iomem *)KSEG1ADDR(ADM5120_SWITCH_BASE)+reg);
-}
-
-static inline void sw_int_mask(u32 mask)
-{
- u32 t;
-
- t = sw_read_reg(SWITCH_REG_INT_MASK);
- t |= mask;
- sw_write_reg(SWITCH_REG_INT_MASK, t);
-}
-
-static inline void sw_int_unmask(u32 mask)
-{
- u32 t;
-
- t = sw_read_reg(SWITCH_REG_INT_MASK);
- t &= ~mask;
- sw_write_reg(SWITCH_REG_INT_MASK, t);
-}
-
-static inline void sw_int_ack(u32 mask)
-{
- sw_write_reg(SWITCH_REG_INT_STATUS, mask);
-}
-
-static inline u32 sw_int_status(void)
-{
- u32 t;
-
- t = sw_read_reg(SWITCH_REG_INT_STATUS);
- t &= ~sw_read_reg(SWITCH_REG_INT_MASK);
- return t;
-}
-
-static inline u32 desc_get_srcport(struct dma_desc *desc)
-{
- return (desc->misc >> DESC_SRCPORT_SHIFT) & DESC_SRCPORT_MASK;
-}
-
-static inline u32 desc_get_pktlen(struct dma_desc *desc)
-{
- return (desc->misc >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK;
-}
-
-static inline int desc_ipcsum_fail(struct dma_desc *desc)
-{
- return ((desc->misc & DESC_IPCSUM_FAIL) != 0);
-}
-
-/* ------------------------------------------------------------------------ */
-
-#ifdef CONFIG_ADM5120_SWITCH_DEBUG
-static void sw_dump_desc(char *label, struct dma_desc *desc, int tx)
-{
- u32 t;
-
- SW_DBG("%s %s desc/%p\n", label, tx ? "tx" : "rx", desc);
-
- t = desc->buf1;
- SW_DBG(" buf1 %08X addr=%08X; len=%08X %s%s\n", t,
- t & DESC_ADDR_MASK,
- desc->buflen,
- (t & DESC_OWN) ? "SWITCH" : "CPU",
- (t & DESC_EOR) ? " RE" : "");
-
- t = desc->buf2;
- SW_DBG(" buf2 %08X addr=%08X%s\n", desc->buf2,
- t & DESC_ADDR_MASK,
- (t & DESC_BUF2_EN) ? " EN" : "");
-
- t = desc->misc;
- if (tx)
- SW_DBG(" misc %08X%s pktlen=%04X ports=%02X vlan=%02X\n", t,
- (t & DESC_CSUM) ? " CSUM" : "",
- (t >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK,
- (t >> DESC_DSTPORT_SHIFT) & DESC_DSTPORT_MASK,
- t & DESC_VLAN_MASK);
- else
- SW_DBG(" misc %08X pktlen=%04X port=%d DA=%d%s%s type=%d\n",
- t,
- (t >> DESC_PKTLEN_SHIFT) & DESC_PKTLEN_MASK,
- (t >> DESC_SRCPORT_SHIFT) & DESC_SRCPORT_MASK,
- (t >> DESC_DA_SHIFT) & DESC_DA_MASK,
- (t & DESC_IPCSUM_FAIL) ? " IPCF" : "",
- (t & DESC_VLAN_TAG) ? " VLAN" : "",
- (t & DESC_TYPE_MASK));
-}
-
-static void sw_dump_intr_mask(char *label, u32 mask)
-{
- SW_DBG("%s %08X%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
- label, mask,
- (mask & SWITCH_INT_SHD) ? " SHD" : "",
- (mask & SWITCH_INT_SLD) ? " SLD" : "",
- (mask & SWITCH_INT_RHD) ? " RHD" : "",
- (mask & SWITCH_INT_RLD) ? " RLD" : "",
- (mask & SWITCH_INT_HDF) ? " HDF" : "",
- (mask & SWITCH_INT_LDF) ? " LDF" : "",
- (mask & SWITCH_INT_P0QF) ? " P0QF" : "",
- (mask & SWITCH_INT_P1QF) ? " P1QF" : "",
- (mask & SWITCH_INT_P2QF) ? " P2QF" : "",
- (mask & SWITCH_INT_P3QF) ? " P3QF" : "",
- (mask & SWITCH_INT_P4QF) ? " P4QF" : "",
- (mask & SWITCH_INT_CPQF) ? " CPQF" : "",
- (mask & SWITCH_INT_GQF) ? " GQF" : "",
- (mask & SWITCH_INT_MD) ? " MD" : "",
- (mask & SWITCH_INT_BCS) ? " BCS" : "",
- (mask & SWITCH_INT_PSC) ? " PSC" : "",
- (mask & SWITCH_INT_ID) ? " ID" : "",
- (mask & SWITCH_INT_W0TE) ? " W0TE" : "",
- (mask & SWITCH_INT_W1TE) ? " W1TE" : "",
- (mask & SWITCH_INT_RDE) ? " RDE" : "",
- (mask & SWITCH_INT_SDE) ? " SDE" : "",
- (mask & SWITCH_INT_CPUH) ? " CPUH" : "");
-}
-
-static void sw_dump_regs(void)
-{
- u32 t;
-
- t = sw_read_reg(SWITCH_REG_PHY_STATUS);
- SW_DBG("phy_status: %08X\n", t);
-
- t = sw_read_reg(SWITCH_REG_CPUP_CONF);
- SW_DBG("cpup_conf: %08X%s%s%s\n", t,
- (t & CPUP_CONF_DCPUP) ? " DCPUP" : "",
- (t & CPUP_CONF_CRCP) ? " CRCP" : "",
- (t & CPUP_CONF_BTM) ? " BTM" : "");
-
- t = sw_read_reg(SWITCH_REG_PORT_CONF0);
- SW_DBG("port_conf0: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_PORT_CONF1);
- SW_DBG("port_conf1: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_PORT_CONF2);
- SW_DBG("port_conf2: %08X\n", t);
-
- t = sw_read_reg(SWITCH_REG_VLAN_G1);
- SW_DBG("vlan g1: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_VLAN_G2);
- SW_DBG("vlan g2: %08X\n", t);
-
- t = sw_read_reg(SWITCH_REG_BW_CNTL0);
- SW_DBG("bw_cntl0: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_BW_CNTL1);
- SW_DBG("bw_cntl1: %08X\n", t);
-
- t = sw_read_reg(SWITCH_REG_PHY_CNTL0);
- SW_DBG("phy_cntl0: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_PHY_CNTL1);
- SW_DBG("phy_cntl1: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_PHY_CNTL2);
- SW_DBG("phy_cntl2: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_PHY_CNTL3);
- SW_DBG("phy_cntl3: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_PHY_CNTL4);
- SW_DBG("phy_cntl4: %08X\n", t);
-
- t = sw_read_reg(SWITCH_REG_INT_STATUS);
- sw_dump_intr_mask("int_status: ", t);
-
- t = sw_read_reg(SWITCH_REG_INT_MASK);
- sw_dump_intr_mask("int_mask: ", t);
-
- t = sw_read_reg(SWITCH_REG_SHDA);
- SW_DBG("shda: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_SLDA);
- SW_DBG("slda: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_RHDA);
- SW_DBG("rhda: %08X\n", t);
- t = sw_read_reg(SWITCH_REG_RLDA);
- SW_DBG("rlda: %08X\n", t);
-}
-#else
-static inline void sw_dump_desc(char *label, struct dma_desc *desc, int tx) {}
-static void sw_dump_intr_mask(char *label, u32 mask) {}
-static inline void sw_dump_regs(void) {}
-#endif /* CONFIG_ADM5120_SWITCH_DEBUG */
-
-/* ------------------------------------------------------------------------ */
-
-static inline void adm5120_rx_dma_update(struct dma_desc *desc,
- struct sk_buff *skb, int end)
-{
- desc->misc = 0;
- desc->buf2 = 0;
- desc->buflen = RX_MAX_PKTLEN;
- desc->buf1 = DESC_ADDR(skb->data) |
- DESC_OWN | (end ? DESC_EOR : 0);
-}
-
-static void adm5120_switch_rx_refill(void)
-{
- unsigned int entry;
-
- for (; cur_rxl - dirty_rxl > 0; dirty_rxl++) {
- struct dma_desc *desc;
- struct sk_buff *skb;
-
- entry = dirty_rxl % RX_RING_SIZE;
- desc = &rxl_descs[entry];
-
- skb = rxl_skbuff[entry];
- if (skb == NULL) {
- skb = alloc_skb(SKB_ALLOC_LEN, GFP_ATOMIC);
- if (skb) {
- skb_reserve(skb, SKB_RESERVE_LEN);
- rxl_skbuff[entry] = skb;
- } else {
- SW_ERR("no memory for skb\n");
- desc->buflen = 0;
- desc->buf2 = 0;
- desc->misc = 0;
- desc->buf1 = (desc->buf1 & DESC_EOR) | DESC_OWN;
- break;
- }
- }
-
- desc->buf2 = 0;
- desc->buflen = RX_MAX_PKTLEN;
- desc->misc = 0;
- desc->buf1 = (desc->buf1 & DESC_EOR) | DESC_OWN |
- DESC_ADDR(skb->data);
- }
-}
-
-static int adm5120_switch_rx(int limit)
-{
- unsigned int done = 0;
-
- SW_DBG("rx start, limit=%d, cur_rxl=%u, dirty_rxl=%u\n",
- limit, cur_rxl, dirty_rxl);
-
- while (done < limit) {
- int entry = cur_rxl % RX_RING_SIZE;
- struct dma_desc *desc = &rxl_descs[entry];
- struct net_device *rdev;
- unsigned int port;
-
- if (desc->buf1 & DESC_OWN)
- break;
-
- if (dirty_rxl + RX_RING_SIZE == cur_rxl)
- break;
-
- port = desc_get_srcport(desc);
- rdev = adm5120_port[port];
-
- SW_DBG("rx descriptor %u, desc=%p, skb=%p\n", entry, desc,
- rxl_skbuff[entry]);
-
- if ((rdev) && netif_running(rdev)) {
- struct sk_buff *skb = rxl_skbuff[entry];
- int pktlen;
-
- pktlen = desc_get_pktlen(desc);
- pktlen -= ETH_CSUM_LEN;
-
- if ((pktlen == 0) || desc_ipcsum_fail(desc)) {
- rdev->stats.rx_errors++;
- if (pktlen == 0)
- rdev->stats.rx_length_errors++;
- if (desc_ipcsum_fail(desc))
- rdev->stats.rx_crc_errors++;
- SW_DBG("rx error, recycling skb %u\n", entry);
- } else {
- skb_put(skb, pktlen);
-
- skb->dev = rdev;
- skb->protocol = eth_type_trans(skb, rdev);
- skb->ip_summed = CHECKSUM_UNNECESSARY;
-
- dma_cache_wback_inv((unsigned long)skb->data,
- skb->len);
-
-#ifdef CONFIG_ADM5120_SWITCH_NAPI
- netif_receive_skb(skb);
-#else
- netif_rx(skb);
-#endif
-
- rdev->last_rx = jiffies;
- rdev->stats.rx_packets++;
- rdev->stats.rx_bytes += pktlen;
-
- rxl_skbuff[entry] = NULL;
- done++;
- }
- } else {
- SW_DBG("no rx device, recycling skb %u\n", entry);
- }
-
- cur_rxl++;
- if (cur_rxl - dirty_rxl > RX_RING_SIZE / 4)
- adm5120_switch_rx_refill();
- }
-
- adm5120_switch_rx_refill();
-
- SW_DBG("rx finished, cur_rxl=%u, dirty_rxl=%u, processed %d\n",
- cur_rxl, dirty_rxl, done);
-
- return done;
-}
-
-static void adm5120_switch_tx(void)
-{
- unsigned int entry;
-
- spin_lock(&tx_lock);
- entry = dirty_txl % TX_RING_SIZE;
- while (dirty_txl != cur_txl) {
- struct dma_desc *desc = &txl_descs[entry];
- struct sk_buff *skb = txl_skbuff[entry];
-
- if (desc->buf1 & DESC_OWN)
- break;
-
- if (netif_running(skb->dev)) {
- skb->dev->stats.tx_bytes += skb->len;
- skb->dev->stats.tx_packets++;
- }
-
- dev_kfree_skb_irq(skb);
- txl_skbuff[entry] = NULL;
- entry = (++dirty_txl) % TX_RING_SIZE;
- }
-
- if ((cur_txl - dirty_txl) < TX_QUEUE_LEN - 4) {
- int i;
- for (i = 0; i < SWITCH_NUM_PORTS; i++) {
- if (!adm5120_devs[i])
- continue;
- netif_wake_queue(adm5120_devs[i]);
- }
- }
- spin_unlock(&tx_lock);
-}
-
-#ifdef CONFIG_ADM5120_SWITCH_NAPI
-static int adm5120_if_poll(struct napi_struct *napi, int limit)
-{
- struct adm5120_if_priv *priv = container_of(napi,
- struct adm5120_if_priv, napi);
- struct net_device *dev __maybe_unused = priv->dev;
- int done;
- u32 status;
-
- sw_int_ack(SWITCH_INTS_POLL);
-
- SW_DBG("%s: processing TX ring\n", dev->name);
- adm5120_switch_tx();
-
- SW_DBG("%s: processing RX ring\n", dev->name);
- done = adm5120_switch_rx(limit);
-
- status = sw_int_status() & SWITCH_INTS_POLL;
- if ((done < limit) && (!status)) {
- SW_DBG("disable polling mode for %s\n", dev->name);
- napi_complete(napi);
- sw_int_unmask(SWITCH_INTS_POLL);
- return 0;
- }
-
- SW_DBG("%s still in polling mode, done=%d, status=%x\n",
- dev->name, done, status);
- return 1;
-}
-#endif /* CONFIG_ADM5120_SWITCH_NAPI */
-
-
-static irqreturn_t adm5120_switch_irq(int irq, void *dev_id)
-{
- u32 status;
-
- status = sw_int_status();
- status &= SWITCH_INTS_ALL;
- if (!status)
- return IRQ_NONE;
-
-#ifdef CONFIG_ADM5120_SWITCH_NAPI
- sw_int_ack(status & ~SWITCH_INTS_POLL);
-
- if (status & SWITCH_INTS_POLL) {
- struct net_device *dev = dev_id;
- struct adm5120_if_priv *priv = netdev_priv(dev);
-
- sw_dump_intr_mask("poll ints", status);
- SW_DBG("enable polling mode for %s\n", dev->name);
- sw_int_mask(SWITCH_INTS_POLL);
- napi_schedule(&priv->napi);
- }
-#else
- sw_int_ack(status);
-
- if (status & (SWITCH_INT_RLD | SWITCH_INT_LDF))
- adm5120_switch_rx(RX_RING_SIZE);
-
- if (status & SWITCH_INT_SLD)
- adm5120_switch_tx();
-#endif
-
- return IRQ_HANDLED;
-}
-
-static void adm5120_set_bw(char *matrix)
-{
- unsigned long val;
-
- /* Port 0 to 3 are set using the bandwidth control 0 register */
- val = matrix[0] + (matrix[1]<<8) + (matrix[2]<<16) + (matrix[3]<<24);
- sw_write_reg(SWITCH_REG_BW_CNTL0, val);
-
- /* Port 4 and 5 are set using the bandwidth control 1 register */
- val = matrix[4];
- if (matrix[5] == 1)
- sw_write_reg(SWITCH_REG_BW_CNTL1, val | 0x80000000);
- else
- sw_write_reg(SWITCH_REG_BW_CNTL1, val & ~0x8000000);
-
- SW_DBG("D: ctl0 0x%ux, ctl1 0x%ux\n", sw_read_reg(SWITCH_REG_BW_CNTL0),
- sw_read_reg(SWITCH_REG_BW_CNTL1));
-}
-
-static void adm5120_switch_tx_ring_reset(struct dma_desc *desc,
- struct sk_buff **skbl, int num)
-{
- memset(desc, 0, num * sizeof(*desc));
- desc[num-1].buf1 |= DESC_EOR;
- memset(skbl, 0, sizeof(struct skb *) * num);
-
- cur_txl = 0;
- dirty_txl = 0;
-}
-
-static void adm5120_switch_rx_ring_reset(struct dma_desc *desc,
- struct sk_buff **skbl, int num)
-{
- int i;
-
- memset(desc, 0, num * sizeof(*desc));
- for (i = 0; i < num; i++) {
- skbl[i] = dev_alloc_skb(SKB_ALLOC_LEN);
- if (!skbl[i]) {
- i = num;
- break;
- }
- skb_reserve(skbl[i], SKB_RESERVE_LEN);
- adm5120_rx_dma_update(&desc[i], skbl[i], (num - 1 == i));
- }
-
- cur_rxl = 0;
- dirty_rxl = 0;
-}
-
-static int adm5120_switch_tx_ring_alloc(void)
-{
- int err;
-
- txl_descs = dma_alloc_coherent(NULL, TX_DESCS_SIZE, &txl_descs_dma,
- GFP_ATOMIC);
- if (!txl_descs) {
- err = -ENOMEM;
- goto err;
- }
-
- txl_skbuff = kzalloc(TX_SKBS_SIZE, GFP_KERNEL);
- if (!txl_skbuff) {
- err = -ENOMEM;
- goto err;
- }
-
- return 0;
-
-err:
- return err;
-}
-
-static void adm5120_switch_tx_ring_free(void)
-{
- int i;
-
- if (txl_skbuff) {
- for (i = 0; i < TX_RING_SIZE; i++)
- if (txl_skbuff[i])
- kfree_skb(txl_skbuff[i]);
- kfree(txl_skbuff);
- }
-
- if (txl_descs)
- dma_free_coherent(NULL, TX_DESCS_SIZE, txl_descs,
- txl_descs_dma);
-}
-
-static int adm5120_switch_rx_ring_alloc(void)
-{
- int err;
- int i;
-
- /* init RX ring */
- rxl_descs = dma_alloc_coherent(NULL, RX_DESCS_SIZE, &rxl_descs_dma,
- GFP_ATOMIC);
- if (!rxl_descs) {
- err = -ENOMEM;
- goto err;
- }
-
- rxl_skbuff = kzalloc(RX_SKBS_SIZE, GFP_KERNEL);
- if (!rxl_skbuff) {
- err = -ENOMEM;
- goto err;
- }
-
- for (i = 0; i < RX_RING_SIZE; i++) {
- struct sk_buff *skb;
- skb = alloc_skb(SKB_ALLOC_LEN, GFP_ATOMIC);
- if (!skb) {
- err = -ENOMEM;
- goto err;
- }
- rxl_skbuff[i] = skb;
- skb_reserve(skb, SKB_RESERVE_LEN);
- }
-
- return 0;
-
-err:
- return err;
-}
-
-static void adm5120_switch_rx_ring_free(void)
-{
- int i;
-
- if (rxl_skbuff) {
- for (i = 0; i < RX_RING_SIZE; i++)
- if (rxl_skbuff[i])
- kfree_skb(rxl_skbuff[i]);
- kfree(rxl_skbuff);
- }
-
- if (rxl_descs)
- dma_free_coherent(NULL, RX_DESCS_SIZE, rxl_descs,
- rxl_descs_dma);
-}
-
-static void adm5120_write_mac(struct net_device *dev)
-{
- struct adm5120_if_priv *priv = netdev_priv(dev);
- unsigned char *mac = dev->dev_addr;
- u32 t;
-
- t = mac[2] | (mac[3] << MAC_WT1_MAC3_SHIFT) |
- (mac[4] << MAC_WT1_MAC4_SHIFT) | (mac[5] << MAC_WT1_MAC5_SHIFT);
- sw_write_reg(SWITCH_REG_MAC_WT1, t);
-
- t = (mac[0] << MAC_WT0_MAC0_SHIFT) | (mac[1] << MAC_WT0_MAC1_SHIFT) |
- MAC_WT0_MAWC | MAC_WT0_WVE | (priv->vlan_no<<3);
-
- sw_write_reg(SWITCH_REG_MAC_WT0, t);
-
- while (!(sw_read_reg(SWITCH_REG_MAC_WT0) & MAC_WT0_MWD))
- ;
-}
-
-static void adm5120_set_vlan(char *matrix)
-{
- unsigned long val;
- int vlan_port, port;
-
- val = matrix[0] + (matrix[1]<<8) + (matrix[2]<<16) + (matrix[3]<<24);
- sw_write_reg(SWITCH_REG_VLAN_G1, val);
- val = matrix[4] + (matrix[5]<<8);
- sw_write_reg(SWITCH_REG_VLAN_G2, val);
-
- /* Now set/update the port vs. device lookup table */
- for (port = 0; port < SWITCH_NUM_PORTS; port++) {
- for (vlan_port = 0; vlan_port < SWITCH_NUM_PORTS && !(matrix[vlan_port] & (0x00000001 << port)); vlan_port++)
- ;
- if (vlan_port < SWITCH_NUM_PORTS)
- adm5120_port[port] = adm5120_devs[vlan_port];
- else
- adm5120_port[port] = NULL;
- }
-}
-
-static void adm5120_switch_set_vlan_mac(unsigned int vlan, unsigned char *mac)
-{
- u32 t;
-
- t = mac[2] | (mac[3] << MAC_WT1_MAC3_SHIFT)
- | (mac[4] << MAC_WT1_MAC4_SHIFT)
- | (mac[5] << MAC_WT1_MAC5_SHIFT);
- sw_write_reg(SWITCH_REG_MAC_WT1, t);
-
- t = (mac[0] << MAC_WT0_MAC0_SHIFT) | (mac[1] << MAC_WT0_MAC1_SHIFT) |
- MAC_WT0_MAWC | MAC_WT0_WVE | (vlan << MAC_WT0_WVN_SHIFT) |
- (MAC_WT0_WAF_STATIC << MAC_WT0_WAF_SHIFT);
- sw_write_reg(SWITCH_REG_MAC_WT0, t);
-
- do {
- t = sw_read_reg(SWITCH_REG_MAC_WT0);
- } while ((t & MAC_WT0_MWD) == 0);
-}
-
-static void adm5120_switch_set_vlan_ports(unsigned int vlan, u32 ports)
-{
- unsigned int reg;
- u32 t;
-
- if (vlan < 4)
- reg = SWITCH_REG_VLAN_G1;
- else {
- vlan -= 4;
- reg = SWITCH_REG_VLAN_G2;
- }
-
- t = sw_read_reg(reg);
- t &= ~(0xFF << (vlan*8));
- t |= (ports << (vlan*8));
- sw_write_reg(reg, t);
-}
-
-/* ------------------------------------------------------------------------ */
-
-#ifdef CONFIG_ADM5120_SWITCH_NAPI
-static inline void adm5120_if_napi_enable(struct net_device *dev)
-{
- struct adm5120_if_priv *priv = netdev_priv(dev);
- napi_enable(&priv->napi);
-}
-
-static inline void adm5120_if_napi_disable(struct net_device *dev)
-{
- struct adm5120_if_priv *priv = netdev_priv(dev);
- napi_disable(&priv->napi);
-}
-#else
-static inline void adm5120_if_napi_enable(struct net_device *dev) {}
-static inline void adm5120_if_napi_disable(struct net_device *dev) {}
-#endif /* CONFIG_ADM5120_SWITCH_NAPI */
-
-static int adm5120_if_open(struct net_device *dev)
-{
- u32 t;
- int err;
- int i;
-
- adm5120_if_napi_enable(dev);
-
- err = request_irq(dev->irq, adm5120_switch_irq, IRQF_SHARED,
- dev->name, dev);
- if (err) {
- SW_ERR("unable to get irq for %s\n", dev->name);
- goto err;
- }
-
- if (!sw_used++)
- /* enable interrupts on first open */
- sw_int_unmask(SWITCH_INTS_USED);
-
- /* enable (additional) port */
- t = sw_read_reg(SWITCH_REG_PORT_CONF0);
- for (i = 0; i < SWITCH_NUM_PORTS; i++) {
- if (dev == adm5120_devs[i])
- t &= ~adm5120_eth_vlans[i];
- }
- sw_write_reg(SWITCH_REG_PORT_CONF0, t);
-
- netif_start_queue(dev);
-
- return 0;
-
-err:
- adm5120_if_napi_disable(dev);
- return err;
-}
-
-static int adm5120_if_stop(struct net_device *dev)
-{
- u32 t;
- int i;
-
- netif_stop_queue(dev);
- adm5120_if_napi_disable(dev);
-
- /* disable port if not assigned to other devices */
- t = sw_read_reg(SWITCH_REG_PORT_CONF0);
- t |= SWITCH_PORTS_NOCPU;
- for (i = 0; i < SWITCH_NUM_PORTS; i++) {
- if ((dev != adm5120_devs[i]) && netif_running(adm5120_devs[i]))
- t &= ~adm5120_eth_vlans[i];
- }
- sw_write_reg(SWITCH_REG_PORT_CONF0, t);
-
- if (!--sw_used)
- sw_int_mask(SWITCH_INTS_USED);
-
- free_irq(dev->irq, dev);
-
- return 0;
-}
-
-static int adm5120_if_hard_start_xmit(struct sk_buff *skb,
- struct net_device *dev)
-{
- struct dma_desc *desc;
- struct adm5120_if_priv *priv = netdev_priv(dev);
- unsigned int entry;
- unsigned long data;
- int i;
-
- /* lock switch irq */
- spin_lock_irq(&tx_lock);
-
- /* calculate the next TX descriptor entry. */
- entry = cur_txl % TX_RING_SIZE;
-
- desc = &txl_descs[entry];
- if (desc->buf1 & DESC_OWN) {
- /* We want to write a packet but the TX queue is still
- * occupied by the DMA. We are faster than the DMA... */
- SW_DBG("%s unable to transmit, packet dopped\n", dev->name);
- dev_kfree_skb(skb);
- dev->stats.tx_dropped++;
- return 0;
- }
-
- txl_skbuff[entry] = skb;
- data = (desc->buf1 & DESC_EOR);
- data |= DESC_ADDR(skb->data);
-
- desc->misc =
- ((skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len) << DESC_PKTLEN_SHIFT) |
- (0x1 << priv->vlan_no);
-
- desc->buflen = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
-
- desc->buf1 = data | DESC_OWN;
- sw_write_reg(SWITCH_REG_SEND_TRIG, SEND_TRIG_STL);
-
- cur_txl++;
- if (cur_txl == dirty_txl + TX_QUEUE_LEN) {
- for (i = 0; i < SWITCH_NUM_PORTS; i++) {
- if (!adm5120_devs[i])
- continue;
- netif_stop_queue(adm5120_devs[i]);
- }
- }
-
- dev->trans_start = jiffies;
-
- spin_unlock_irq(&tx_lock);
-
- return 0;
-}
-
-static void adm5120_if_tx_timeout(struct net_device *dev)
-{
- SW_INFO("TX timeout on %s\n", dev->name);
-}
-
-static void adm5120_if_set_rx_mode(struct net_device *dev)
-{
- struct adm5120_if_priv *priv = netdev_priv(dev);
- u32 ports;
- u32 t;
-
- ports = adm5120_eth_vlans[priv->vlan_no] & SWITCH_PORTS_NOCPU;
-
- t = sw_read_reg(SWITCH_REG_CPUP_CONF);
- if (dev->flags & IFF_PROMISC)
- /* enable unknown packets */
- t &= ~(ports << CPUP_CONF_DUNP_SHIFT);
- else
- /* disable unknown packets */
- t |= (ports << CPUP_CONF_DUNP_SHIFT);
-
- if (dev->flags & IFF_PROMISC || dev->flags & IFF_ALLMULTI ||
- netdev_mc_count(dev))
- /* enable multicast packets */
- t &= ~(ports << CPUP_CONF_DMCP_SHIFT);
- else
- /* disable multicast packets */
- t |= (ports << CPUP_CONF_DMCP_SHIFT);
-
- /* If there is any port configured to be in promiscuous mode, then the */
- /* Bridge Test Mode has to be activated. This will result in */
- /* transporting also packets learned in another VLAN to be forwarded */
- /* to the CPU. */
- /* The difficult scenario is when we want to build a bridge on the CPU.*/
- /* Assume we have port0 and the CPU port in VLAN0 and port1 and the */
- /* CPU port in VLAN1. Now we build a bridge on the CPU between */
- /* VLAN0 and VLAN1. Both ports of the VLANs are set in promisc mode. */
- /* Now assume a packet with ethernet source address 99 enters port 0 */
- /* It will be forwarded to the CPU because it is unknown. Then the */
- /* bridge in the CPU will send it to VLAN1 and it goes out at port 1. */
- /* When now a packet with ethernet destination address 99 comes in at */
- /* port 1 in VLAN1, then the switch has learned that this address is */
- /* located at port 0 in VLAN0. Therefore the switch will drop */
- /* this packet. In order to avoid this and to send the packet still */
- /* to the CPU, the Bridge Test Mode has to be activated. */
-
- /* Check if there is any vlan in promisc mode. */
- if (~t & (SWITCH_PORTS_NOCPU << CPUP_CONF_DUNP_SHIFT))
- t |= CPUP_CONF_BTM; /* Enable Bridge Testing Mode */
- else
- t &= ~CPUP_CONF_BTM; /* Disable Bridge Testing Mode */
-
- sw_write_reg(SWITCH_REG_CPUP_CONF, t);
-
-}
-
-static int adm5120_if_set_mac_address(struct net_device *dev, void *p)
-{
- int ret;
-
- ret = eth_mac_addr(dev, p);
- if (ret)
- return ret;
-
- adm5120_write_mac(dev);
- return 0;
-}
-
-static int adm5120_if_do_ioctl(struct net_device *dev, struct ifreq *rq,
- int cmd)
-{
- int err;
- struct adm5120_sw_info info;
- struct adm5120_if_priv *priv = netdev_priv(dev);
-
- switch (cmd) {
- case SIOCGADMINFO:
- info.magic = 0x5120;
- info.ports = adm5120_nrdevs;
- info.vlan = priv->vlan_no;
- err = copy_to_user(rq->ifr_data, &info, sizeof(info));
- if (err)
- return -EFAULT;
- break;
- case SIOCSMATRIX:
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
- err = copy_from_user(adm5120_eth_vlans, rq->ifr_data,
- sizeof(adm5120_eth_vlans));
- if (err)
- return -EFAULT;
- adm5120_set_vlan(adm5120_eth_vlans);
- break;
- case SIOCGMATRIX:
- err = copy_to_user(rq->ifr_data, adm5120_eth_vlans,
- sizeof(adm5120_eth_vlans));
- if (err)
- return -EFAULT;
- break;
- default:
- return -EOPNOTSUPP;
- }
- return 0;
-}
-
-static const struct net_device_ops adm5120sw_netdev_ops = {
- .ndo_open = adm5120_if_open,
- .ndo_stop = adm5120_if_stop,
- .ndo_start_xmit = adm5120_if_hard_start_xmit,
- .ndo_set_rx_mode = adm5120_if_set_rx_mode,
- .ndo_do_ioctl = adm5120_if_do_ioctl,
- .ndo_tx_timeout = adm5120_if_tx_timeout,
- .ndo_validate_addr = eth_validate_addr,
- .ndo_change_mtu = eth_change_mtu,
- .ndo_set_mac_address = adm5120_if_set_mac_address,
-};
-
-static struct net_device *adm5120_if_alloc(void)
-{
- struct net_device *dev;
- struct adm5120_if_priv *priv;
-
- dev = alloc_etherdev(sizeof(*priv));
- if (!dev)
- return NULL;
-
- priv = netdev_priv(dev);
- priv->dev = dev;
-
- dev->irq = ADM5120_IRQ_SWITCH;
- dev->netdev_ops = &adm5120sw_netdev_ops;
- dev->watchdog_timeo = TX_TIMEOUT;
-
-#ifdef CONFIG_ADM5120_SWITCH_NAPI
- netif_napi_add(dev, &priv->napi, adm5120_if_poll, 64);
-#endif
-
- return dev;
-}
-
-/* ------------------------------------------------------------------------ */
-
-static void adm5120_switch_cleanup(void)
-{
- int i;
-
- /* disable interrupts */
- sw_int_mask(SWITCH_INTS_ALL);
-
- for (i = 0; i < SWITCH_NUM_PORTS; i++) {
- struct net_device *dev = adm5120_devs[i];
- if (dev) {
- unregister_netdev(dev);
- free_netdev(dev);
- }
- }
-
- adm5120_switch_tx_ring_free();
- adm5120_switch_rx_ring_free();
-}
-
-static int adm5120_switch_probe(struct platform_device *pdev)
-{
- u32 t;
- int i, err;
-
- adm5120_nrdevs = adm5120_eth_num_ports;
-
- t = CPUP_CONF_DCPUP | CPUP_CONF_CRCP |
- SWITCH_PORTS_NOCPU << CPUP_CONF_DUNP_SHIFT |
- SWITCH_PORTS_NOCPU << CPUP_CONF_DMCP_SHIFT ;
- sw_write_reg(SWITCH_REG_CPUP_CONF, t);
-
- t = (SWITCH_PORTS_NOCPU << PORT_CONF0_EMCP_SHIFT) |
- (SWITCH_PORTS_NOCPU << PORT_CONF0_BP_SHIFT) |
- (SWITCH_PORTS_NOCPU);
- sw_write_reg(SWITCH_REG_PORT_CONF0, t);
-
- /* setup ports to Autoneg/100M/Full duplex/Auto MDIX */
- t = SWITCH_PORTS_PHY |
- (SWITCH_PORTS_PHY << PHY_CNTL2_SC_SHIFT) |
- (SWITCH_PORTS_PHY << PHY_CNTL2_DC_SHIFT) |
- (SWITCH_PORTS_PHY << PHY_CNTL2_PHYR_SHIFT) |
- (SWITCH_PORTS_PHY << PHY_CNTL2_AMDIX_SHIFT) |
- PHY_CNTL2_RMAE;
- sw_write_reg(SWITCH_REG_PHY_CNTL2, t);
-
- t = sw_read_reg(SWITCH_REG_PHY_CNTL3);
- t |= PHY_CNTL3_RNT;
- sw_write_reg(SWITCH_REG_PHY_CNTL3, t);
-
- /* Force all the packets from all ports are low priority */
- sw_write_reg(SWITCH_REG_PRI_CNTL, 0);
-
- sw_int_mask(SWITCH_INTS_ALL);
- sw_int_ack(SWITCH_INTS_ALL);
-
- err = adm5120_switch_rx_ring_alloc();
- if (err)
- goto err;
-
- err = adm5120_switch_tx_ring_alloc();
- if (err)
- goto err;
-
- adm5120_switch_tx_ring_reset(txl_descs, txl_skbuff, TX_RING_SIZE);
- adm5120_switch_rx_ring_reset(rxl_descs, rxl_skbuff, RX_RING_SIZE);
-
- sw_write_reg(SWITCH_REG_SHDA, 0);
- sw_write_reg(SWITCH_REG_SLDA, KSEG1ADDR(txl_descs));
- sw_write_reg(SWITCH_REG_RHDA, 0);
- sw_write_reg(SWITCH_REG_RLDA, KSEG1ADDR(rxl_descs));
-
- for (i = 0; i < SWITCH_NUM_PORTS; i++) {
- struct net_device *dev;
- struct adm5120_if_priv *priv;
-
- dev = adm5120_if_alloc();
- if (!dev) {
- err = -ENOMEM;
- goto err;
- }
-
- adm5120_devs[i] = dev;
- priv = netdev_priv(dev);
-
- priv->vlan_no = i;
- priv->port_mask = adm5120_eth_vlans[i];
-
- memcpy(dev->dev_addr, adm5120_eth_macs[i], 6);
- adm5120_write_mac(dev);
-
- err = register_netdev(dev);
- if (err) {
- SW_INFO("%s register failed, error=%d\n",
- dev->name, err);
- goto err;
- }
- }
-
- /* setup vlan/port mapping after devs are filled up */
- adm5120_set_vlan(adm5120_eth_vlans);
-
- /* enable CPU port */
- t = sw_read_reg(SWITCH_REG_CPUP_CONF);
- t &= ~CPUP_CONF_DCPUP;
- sw_write_reg(SWITCH_REG_CPUP_CONF, t);
-
- return 0;
-
-err:
- adm5120_switch_cleanup();
-
- SW_ERR("init failed\n");
- return err;
-}
-
-static int adm5120_switch_remove(struct platform_device *pdev)
-{
- adm5120_switch_cleanup();
- return 0;
-}
-
-static struct platform_driver adm5120_switch_driver = {
- .probe = adm5120_switch_probe,
- .remove = adm5120_switch_remove,
- .driver = {
- .name = DRV_NAME,
- },
-};
-
-/* -------------------------------------------------------------------------- */
-
-static int __init adm5120_switch_mod_init(void)
-{
- int err;
-
- pr_info(DRV_DESC " version " DRV_VERSION "\n");
- err = platform_driver_register(&adm5120_switch_driver);
-
- return err;
-}
-
-static void __exit adm5120_switch_mod_exit(void)
-{
- platform_driver_unregister(&adm5120_switch_driver);
-}
-
-module_init(adm5120_switch_mod_init);
-module_exit(adm5120_switch_mod_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
-MODULE_DESCRIPTION(DRV_DESC);
-MODULE_VERSION(DRV_VERSION);
+++ /dev/null
-/*
- * Defines for ADM5120 built in ethernet switch driver
- *
- * Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005
- *
- * Values come from ADM5120 datasheet and original ADMtek 2.4 driver,
- * Copyright ADMtek Inc.
- */
-
-#ifndef _INCLUDE_ADM5120SW_H_
-#define _INCLUDE_ADM5120SW_H_
-
-#define SIOCSMATRIX SIOCDEVPRIVATE
-#define SIOCGMATRIX (SIOCDEVPRIVATE + 1)
-#define SIOCGADMINFO (SIOCDEVPRIVATE + 2)
-
-struct adm5120_sw_info {
- u16 magic;
- u16 ports;
- u16 vlan;
-};
-
-#endif /* _INCLUDE_ADM5120SW_H_ */
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/usb/host/ohci-dbg.c
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-/*-------------------------------------------------------------------------*/
-
-static inline char *ed_typestring(int ed_type)
-{
- switch (ed_type) {
- case PIPE_CONTROL:
- return "ctrl";
- case PIPE_BULK:
- return "bulk";
- case PIPE_INTERRUPT:
- return "intr";
- case PIPE_ISOCHRONOUS:
- return "isoc";
- }
- return "(bad ed_type)";
-}
-
-static inline char *ed_statestring(int state)
-{
- switch (state) {
- case ED_IDLE:
- return "IDLE";
- case ED_UNLINK:
- return "UNLINK";
- case ED_OPER:
- return "OPER";
- }
- return "?STATE";
-}
-
-static inline char *pipestring(int pipe)
-{
- return ed_typestring(usb_pipetype(pipe));
-}
-
-static inline char *td_pidstring(u32 info)
-{
- switch (info & TD_DP) {
- case TD_DP_SETUP:
- return "SETUP";
- case TD_DP_IN:
- return "IN";
- case TD_DP_OUT:
- return "OUT";
- }
- return "?PID";
-}
-
-static inline char *td_togglestring(u32 info)
-{
- switch (info & TD_T) {
- case TD_T_DATA0:
- return "DATA0";
- case TD_T_DATA1:
- return "DATA1";
- case TD_T_CARRY:
- return "CARRY";
- }
- return "?TOGGLE";
-}
-
-/*-------------------------------------------------------------------------*/
-
-#ifdef DEBUG
-
-/* debug| print the main components of an URB
- * small: 0) header + data packets 1) just header
- */
-static void __attribute__((unused))
-urb_print(struct admhcd *ahcd, struct urb *urb, char *str, int small, int status)
-{
- unsigned int pipe = urb->pipe;
-
- if (!urb->dev || !urb->dev->bus) {
- admhc_dbg(ahcd, "%s URB: no dev", str);
- return;
- }
-
-#ifndef ADMHC_VERBOSE_DEBUG
- if (status != 0)
-#endif
- admhc_dbg(ahcd, "URB-%s %p dev=%d ep=%d%s-%s flags=%x len=%d/%d "
- "stat=%d\n",
- str,
- urb,
- usb_pipedevice(pipe),
- usb_pipeendpoint(pipe),
- usb_pipeout(pipe) ? "out" : "in",
- pipestring(pipe),
- urb->transfer_flags,
- urb->actual_length,
- urb->transfer_buffer_length,
- status);
-
-#ifdef ADMHC_VERBOSE_DEBUG
- if (!small) {
- int i, len;
-
- if (usb_pipecontrol(pipe)) {
- admhc_dbg(ahcd, "setup(8):");
- for (i = 0; i < 8 ; i++)
- printk(KERN_INFO" %02x", ((__u8 *)urb->setup_packet)[i]);
- printk(KERN_INFO "\n");
- }
- if (urb->transfer_buffer_length > 0 && urb->transfer_buffer) {
- admhc_dbg(ahcd, "data(%d/%d):",
- urb->actual_length,
- urb->transfer_buffer_length);
- len = usb_pipeout(pipe) ?
- urb->transfer_buffer_length : urb->actual_length;
- for (i = 0; i < 16 && i < len; i++)
- printk(KERN_INFO " %02x", ((__u8 *)urb->transfer_buffer)[i]);
- printk(KERN_INFO "%s stat:%d\n", i < len ? "..." : "", status);
- }
- }
-#endif /* ADMHC_VERBOSE_DEBUG */
-}
-
-#define admhc_dbg_sw(ahcd, next, size, format, arg...) \
- do { \
- if (next) { \
- unsigned s_len; \
- s_len = scnprintf(*next, *size, format, ## arg); \
- *size -= s_len; *next += s_len; \
- } else \
- admhc_dbg(ahcd, format, ## arg); \
- } while (0);
-
-
-static void admhc_dump_intr_mask(struct admhcd *ahcd, char *label, u32 mask,
- char **next, unsigned *size)
-{
- admhc_dbg_sw(ahcd, next, size, "%s 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n",
- label,
- mask,
- (mask & ADMHC_INTR_INTA) ? " INTA" : "",
- (mask & ADMHC_INTR_FATI) ? " FATI" : "",
- (mask & ADMHC_INTR_SWI) ? " SWI" : "",
- (mask & ADMHC_INTR_TDC) ? " TDC" : "",
- (mask & ADMHC_INTR_FNO) ? " FNO" : "",
- (mask & ADMHC_INTR_SO) ? " SO" : "",
- (mask & ADMHC_INTR_INSM) ? " INSM" : "",
- (mask & ADMHC_INTR_BABI) ? " BABI" : "",
- (mask & ADMHC_INTR_7) ? " !7!" : "",
- (mask & ADMHC_INTR_6) ? " !6!" : "",
- (mask & ADMHC_INTR_RESI) ? " RESI" : "",
- (mask & ADMHC_INTR_SOFI) ? " SOFI" : ""
- );
-}
-
-static void maybe_print_eds(struct admhcd *ahcd, char *label, u32 value,
- char **next, unsigned *size)
-{
- if (value)
- admhc_dbg_sw(ahcd, next, size, "%s %08x\n", label, value);
-}
-
-static char *buss2string(int state)
-{
- switch (state) {
- case ADMHC_BUSS_RESET:
- return "reset";
- case ADMHC_BUSS_RESUME:
- return "resume";
- case ADMHC_BUSS_OPER:
- return "operational";
- case ADMHC_BUSS_SUSPEND:
- return "suspend";
- }
- return "?state";
-}
-
-static void
-admhc_dump_status(struct admhcd *ahcd, char **next, unsigned *size)
-{
- struct admhcd_regs __iomem *regs = ahcd->regs;
- u32 temp;
-
- temp = admhc_readl(ahcd, ®s->gencontrol);
- admhc_dbg_sw(ahcd, next, size,
- "gencontrol 0x%08x%s%s%s%s\n",
- temp,
- (temp & ADMHC_CTRL_UHFE) ? " UHFE" : "",
- (temp & ADMHC_CTRL_SIR) ? " SIR" : "",
- (temp & ADMHC_CTRL_DMAA) ? " DMAA" : "",
- (temp & ADMHC_CTRL_SR) ? " SR" : ""
- );
-
- temp = admhc_readl(ahcd, ®s->host_control);
- admhc_dbg_sw(ahcd, next, size,
- "host_control 0x%08x BUSS=%s%s\n",
- temp,
- buss2string(temp & ADMHC_HC_BUSS),
- (temp & ADMHC_HC_DMAE) ? " DMAE" : ""
- );
-
- admhc_dump_intr_mask(ahcd, "int_status",
- admhc_readl(ahcd, ®s->int_status),
- next, size);
- admhc_dump_intr_mask(ahcd, "int_enable",
- admhc_readl(ahcd, ®s->int_enable),
- next, size);
-
- maybe_print_eds(ahcd, "hosthead",
- admhc_readl(ahcd, ®s->hosthead), next, size);
-}
-
-#define dbg_port_sw(hc, num, value, next, size) \
- admhc_dbg_sw(hc, next, size, \
- "portstatus [%d] " \
- "0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \
- num, temp, \
- (temp & ADMHC_PS_PRSC) ? " PRSC" : "", \
- (temp & ADMHC_PS_OCIC) ? " OCIC" : "", \
- (temp & ADMHC_PS_PSSC) ? " PSSC" : "", \
- (temp & ADMHC_PS_PESC) ? " PESC" : "", \
- (temp & ADMHC_PS_CSC) ? " CSC" : "", \
- \
- (temp & ADMHC_PS_LSDA) ? " LSDA" : "", \
- (temp & ADMHC_PS_PPS) ? " PPS" : "", \
- (temp & ADMHC_PS_PRS) ? " PRS" : "", \
- (temp & ADMHC_PS_POCI) ? " POCI" : "", \
- (temp & ADMHC_PS_PSS) ? " PSS" : "", \
- \
- (temp & ADMHC_PS_PES) ? " PES" : "", \
- (temp & ADMHC_PS_CCS) ? " CCS" : "" \
- );
-
-
-static void
-admhc_dump_roothub(
- struct admhcd *ahcd,
- int verbose,
- char **next,
- unsigned *size)
-{
- u32 temp, i;
-
- temp = admhc_read_rhdesc(ahcd);
- if (temp == ~(u32)0)
- return;
-
- if (verbose) {
- admhc_dbg_sw(ahcd, next, size,
- "rhdesc %08x%s%s%s%s%s%s PPCM=%02x%s%s%s%s NUMP=%d(%d)\n",
- temp,
- (temp & ADMHC_RH_CRWE) ? " CRWE" : "",
- (temp & ADMHC_RH_OCIC) ? " OCIC" : "",
- (temp & ADMHC_RH_LPSC) ? " LPSC" : "",
- (temp & ADMHC_RH_LPSC) ? " DRWE" : "",
- (temp & ADMHC_RH_LPSC) ? " OCI" : "",
- (temp & ADMHC_RH_LPSC) ? " LPS" : "",
- ((temp & ADMHC_RH_PPCM) >> 16),
- (temp & ADMHC_RH_NOCP) ? " NOCP" : "",
- (temp & ADMHC_RH_OCPM) ? " OCPM" : "",
- (temp & ADMHC_RH_NPS) ? " NPS" : "",
- (temp & ADMHC_RH_PSM) ? " PSM" : "",
- (temp & ADMHC_RH_NUMP), ahcd->num_ports
- );
- }
-
- for (i = 0; i < ahcd->num_ports; i++) {
- temp = admhc_read_portstatus(ahcd, i);
- dbg_port_sw(ahcd, i, temp, next, size);
- }
-}
-
-static void admhc_dump(struct admhcd *ahcd, int verbose)
-{
- admhc_dbg(ahcd, "ADMHC ahcd state\n");
-
- /* dumps some of the state we know about */
- admhc_dump_status(ahcd, NULL, NULL);
- admhc_dbg(ahcd, "current frame #%04x\n",
- admhc_frame_no(ahcd));
-
- admhc_dump_roothub(ahcd, verbose, NULL, NULL);
-}
-
-static const char data0[] = "DATA0";
-static const char data1[] = "DATA1";
-
-static void admhc_dump_td(const struct admhcd *ahcd, const char *label,
- const struct td *td)
-{
- u32 tmp;
-
- admhc_dbg(ahcd, "%s td %p; urb %p index %d; hwNextTD %08x\n",
- label, td,
- td->urb, td->index,
- hc32_to_cpup(ahcd, &td->hwNextTD));
-
- tmp = hc32_to_cpup(ahcd, &td->hwINFO);
- admhc_dbg(ahcd, " status %08x%s CC=%x EC=%d %s %s ISI=%x FN=%x\n",
- tmp,
- (tmp & TD_OWN) ? " OWN" : "",
- TD_CC_GET(tmp),
- TD_EC_GET(tmp),
- td_togglestring(tmp),
- td_pidstring(tmp),
- TD_ISI_GET(tmp),
- TD_FN_GET(tmp));
-
- tmp = hc32_to_cpup(ahcd, &td->hwCBL);
- admhc_dbg(ahcd, " dbp %08x; cbl %08x; LEN=%d%s\n",
- hc32_to_cpup(ahcd, &td->hwDBP),
- tmp,
- TD_BL_GET(tmp),
- (tmp & TD_IE) ? " IE" : "");
-}
-
-/* caller MUST own hcd spinlock if verbose is set! */
-static void __attribute__((unused))
-admhc_dump_ed(const struct admhcd *ahcd, const char *label,
- const struct ed *ed, int verbose)
-{
- u32 tmp = hc32_to_cpu(ahcd, ed->hwINFO);
-
- admhc_dbg(ahcd, "%s ed %p %s type %s; next ed %08x\n",
- label,
- ed, ed_statestring(ed->state), ed_typestring(ed->type),
- hc32_to_cpup(ahcd, &ed->hwNextED));
-
- admhc_dbg(ahcd, " info %08x MAX=%d%s%s%s%s EP=%d DEV=%d\n", tmp,
- ED_MPS_GET(tmp),
- (tmp & ED_ISO) ? " ISO" : "",
- (tmp & ED_SKIP) ? " SKIP" : "",
- (tmp & ED_SPEED_FULL) ? " FULL" : " LOW",
- (tmp & ED_INT) ? " INT" : "",
- ED_EN_GET(tmp),
- ED_FA_GET(tmp));
-
- tmp = hc32_to_cpup(ahcd, &ed->hwHeadP);
- admhc_dbg(ahcd, " tds: head %08x tail %08x %s%s%s\n",
- tmp & TD_MASK,
- hc32_to_cpup(ahcd, &ed->hwTailP),
- (tmp & ED_C) ? data1 : data0,
- (tmp & ED_H) ? " HALT" : "",
- verbose ? " td list follows" : " (not listing)");
-
- if (verbose) {
- struct list_head *tmp;
-
- /* use ed->td_list because HC concurrently modifies
- * hwNextTD as it accumulates ed_donelist.
- */
- list_for_each(tmp, &ed->td_list) {
- struct td *td;
- td = list_entry(tmp, struct td, td_list);
- admhc_dump_td(ahcd, " ->", td);
- }
- }
-}
-
-#else /* ifdef DEBUG */
-
-static inline void urb_print(struct admhcd *ahcd, struct urb * urb, char * str,
- int small, int status) {}
-static inline void admhc_dump_ed(const struct admhcd *ahcd, const char *label,
- const struct ed *ed, int verbose) {}
-static inline void admhc_dump_td(const struct admhcd *ahcd, const char *label,
- const struct td *td) {}
-static inline void admhc_dump(struct admhcd *ahcd, int verbose) {}
-
-#undef ADMHC_VERBOSE_DEBUG
-
-#endif /* DEBUG */
-
-/*-------------------------------------------------------------------------*/
-
-#ifdef STUB_DEBUG_FILES
-
-static inline void create_debug_files(struct admhcd *bus) { }
-static inline void remove_debug_files(struct admhcd *bus) { }
-
-#else
-
-static int debug_async_open(struct inode *, struct file *);
-static int debug_periodic_open(struct inode *, struct file *);
-static int debug_registers_open(struct inode *, struct file *);
-static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*);
-static int debug_close(struct inode *, struct file *);
-
-static const struct file_operations debug_async_fops = {
- .owner = THIS_MODULE,
- .open = debug_async_open,
- .read = debug_output,
- .release = debug_close,
- .llseek = default_llseek,
-};
-static const struct file_operations debug_periodic_fops = {
- .owner = THIS_MODULE,
- .open = debug_periodic_open,
- .read = debug_output,
- .release = debug_close,
- .llseek = default_llseek,
-};
-static const struct file_operations debug_registers_fops = {
- .owner = THIS_MODULE,
- .open = debug_registers_open,
- .read = debug_output,
- .release = debug_close,
- .llseek = default_llseek,
-};
-
-static struct dentry *admhc_debug_root;
-
-struct debug_buffer {
- ssize_t (*fill_func)(struct debug_buffer *); /* fill method */
- struct admhcd *ahcd;
- struct mutex mutex; /* protect filling of buffer */
- size_t count; /* number of characters filled into buffer */
- char *page;
-};
-
-static ssize_t
-show_list(struct admhcd *ahcd, char *buf, size_t count, struct ed *ed)
-{
- unsigned temp;
- unsigned size = count;
-
- if (!ed)
- return 0;
-
- /* dump a snapshot of the bulk or control schedule */
- while (ed) {
- u32 info = hc32_to_cpu(ahcd, ed->hwINFO);
- u32 headp = hc32_to_cpu(ahcd, ed->hwHeadP);
- u32 tailp = hc32_to_cpu(ahcd, ed->hwTailP);
- struct list_head *entry;
- struct td *td;
-
- temp = scnprintf(buf, size,
- "ed/%p %s %s %cs dev%d ep%d %s%smax %d %08x%s%s %s"
- " h:%08x t:%08x",
- ed,
- ed_statestring(ed->state),
- ed_typestring(ed->type),
- (info & ED_SPEED_FULL) ? 'f' : 'l',
- info & ED_FA_MASK,
- (info >> ED_EN_SHIFT) & ED_EN_MASK,
- (info & ED_INT) ? "INT " : "",
- (info & ED_ISO) ? "ISO " : "",
- (info >> ED_MPS_SHIFT) & ED_MPS_MASK ,
- info,
- (info & ED_SKIP) ? " S" : "",
- (headp & ED_H) ? " H" : "",
- (headp & ED_C) ? data1 : data0,
- headp & ED_MASK, tailp);
- size -= temp;
- buf += temp;
-
- list_for_each(entry, &ed->td_list) {
- u32 dbp, cbl;
-
- td = list_entry(entry, struct td, td_list);
- info = hc32_to_cpup(ahcd, &td->hwINFO);
- dbp = hc32_to_cpup(ahcd, &td->hwDBP);
- cbl = hc32_to_cpup(ahcd, &td->hwCBL);
-
- temp = scnprintf(buf, size,
- "\n\ttd/%p %s %d %s%scc=%x urb %p (%08x,%08x)",
- td,
- td_pidstring(info),
- TD_BL_GET(cbl),
- (info & TD_OWN) ? "" : "DONE ",
- (cbl & TD_IE) ? "IE " : "",
- TD_CC_GET(info), td->urb, info, cbl);
- size -= temp;
- buf += temp;
- }
-
- temp = scnprintf(buf, size, "\n");
- size -= temp;
- buf += temp;
-
- ed = ed->ed_next;
- }
-
- return count - size;
-}
-
-static ssize_t fill_async_buffer(struct debug_buffer *buf)
-{
- struct admhcd *ahcd;
- size_t temp;
- unsigned long flags;
-
- ahcd = buf->ahcd;
-
- spin_lock_irqsave(&ahcd->lock, flags);
- temp = show_list(ahcd, buf->page, PAGE_SIZE, ahcd->ed_head);
- spin_unlock_irqrestore(&ahcd->lock, flags);
-
- return temp;
-}
-
-
-#define DBG_SCHED_LIMIT 64
-
-static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
-{
- struct admhcd *ahcd;
- struct ed **seen, *ed;
- unsigned long flags;
- unsigned temp, size, seen_count;
- char *next;
- unsigned i;
-
- seen = kmalloc(DBG_SCHED_LIMIT * sizeof(*seen), GFP_ATOMIC);
- if (!seen)
- return 0;
- seen_count = 0;
-
- ahcd = buf->ahcd;
- next = buf->page;
- size = PAGE_SIZE;
-
- temp = scnprintf(next, size, "size = %d\n", NUM_INTS);
- size -= temp;
- next += temp;
-
- /* dump a snapshot of the periodic schedule (and load) */
- spin_lock_irqsave(&ahcd->lock, flags);
- for (i = 0; i < NUM_INTS; i++) {
- ed = ahcd->periodic[i];
- if (!ed)
- continue;
-
- temp = scnprintf(next, size, "%2d [%3d]:", i, ahcd->load[i]);
- size -= temp;
- next += temp;
-
- do {
- temp = scnprintf(next, size, " ed%d/%p",
- ed->interval, ed);
- size -= temp;
- next += temp;
- for (temp = 0; temp < seen_count; temp++) {
- if (seen[temp] == ed)
- break;
- }
-
- /* show more info the first time around */
- if (temp == seen_count) {
- u32 info = hc32_to_cpu(ahcd, ed->hwINFO);
- struct list_head *entry;
- unsigned qlen = 0;
-
- /* qlen measured here in TDs, not urbs */
- list_for_each(entry, &ed->td_list)
- qlen++;
- temp = scnprintf(next, size,
- " (%cs dev%d ep%d%s qlen %u"
- " max %d %08x%s%s)",
- (info & ED_SPEED_FULL) ? 'f' : 'l',
- ED_FA_GET(info),
- ED_EN_GET(info),
- (info & ED_ISO) ? "iso" : "int",
- qlen,
- ED_MPS_GET(info),
- info,
- (info & ED_SKIP) ? " K" : "",
- (ed->hwHeadP &
- cpu_to_hc32(ahcd, ED_H)) ?
- " H" : "");
- size -= temp;
- next += temp;
-
- if (seen_count < DBG_SCHED_LIMIT)
- seen[seen_count++] = ed;
-
- ed = ed->ed_next;
-
- } else {
- /* we've seen it and what's after */
- temp = 0;
- ed = NULL;
- }
-
- } while (ed);
-
- temp = scnprintf(next, size, "\n");
- size -= temp;
- next += temp;
- }
- spin_unlock_irqrestore(&ahcd->lock, flags);
- kfree(seen);
-
- return PAGE_SIZE - size;
-}
-
-
-#undef DBG_SCHED_LIMIT
-
-static ssize_t fill_registers_buffer(struct debug_buffer *buf)
-{
- struct usb_hcd *hcd;
- struct admhcd *ahcd;
- struct admhcd_regs __iomem *regs;
- unsigned long flags;
- unsigned temp, size;
- char *next;
- u32 rdata;
-
- ahcd = buf->ahcd;
- hcd = admhc_to_hcd(ahcd);
- regs = ahcd->regs;
- next = buf->page;
- size = PAGE_SIZE;
-
- spin_lock_irqsave(&ahcd->lock, flags);
-
- /* dump driver info, then registers in spec order */
-
- admhc_dbg_sw(ahcd, &next, &size,
- "bus %s, device %s\n"
- "%s\n"
- "%s\n",
- hcd->self.controller->bus->name,
- dev_name(hcd->self.controller),
- hcd->product_desc,
- hcd_name);
-
- if (!HCD_HW_ACCESSIBLE(hcd)) {
- size -= scnprintf(next, size,
- "SUSPENDED (no register access)\n");
- goto done;
- }
-
- admhc_dump_status(ahcd, &next, &size);
-
- /* other registers mostly affect frame timings */
- rdata = admhc_readl(ahcd, ®s->fminterval);
- temp = scnprintf(next, size,
- "fmintvl 0x%08x %sFSLDP=0x%04x FI=0x%04x\n",
- rdata, (rdata & ADMHC_SFI_FIT) ? "FIT " : "",
- (rdata >> ADMHC_SFI_FSLDP_SHIFT) & ADMHC_SFI_FSLDP_MASK,
- rdata & ADMHC_SFI_FI_MASK);
- size -= temp;
- next += temp;
-
- rdata = admhc_readl(ahcd, ®s->fmnumber);
- temp = scnprintf(next, size, "fmnumber 0x%08x %sFR=0x%04x FN=%04x\n",
- rdata, (rdata & ADMHC_SFN_FRT) ? "FRT " : "",
- (rdata >> ADMHC_SFN_FR_SHIFT) & ADMHC_SFN_FR_MASK,
- rdata & ADMHC_SFN_FN_MASK);
- size -= temp;
- next += temp;
-
- /* TODO: use predefined bitmask */
- rdata = admhc_readl(ahcd, ®s->lsthresh);
- temp = scnprintf(next, size, "lsthresh 0x%04x\n",
- rdata & 0x3fff);
- size -= temp;
- next += temp;
-
- temp = scnprintf(next, size, "hub poll timer: %s\n",
- admhcd_to_hcd(ahcd)->poll_rh ? "ON" : "OFF");
- size -= temp;
- next += temp;
-
- /* roothub */
- admhc_dump_roothub(ahcd, 1, &next, &size);
-
-done:
- spin_unlock_irqrestore(&ahcd->lock, flags);
- return PAGE_SIZE - size;
-}
-
-
-static struct debug_buffer *alloc_buffer(struct admhcd *ahcd,
- ssize_t (*fill_func)(struct debug_buffer *))
-{
- struct debug_buffer *buf;
-
- buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
-
- if (buf) {
- buf->ahcd = ahcd;
- buf->fill_func = fill_func;
- mutex_init(&buf->mutex);
- }
-
- return buf;
-}
-
-static int fill_buffer(struct debug_buffer *buf)
-{
- int ret = 0;
-
- if (!buf->page)
- buf->page = (char *)get_zeroed_page(GFP_KERNEL);
-
- if (!buf->page) {
- ret = -ENOMEM;
- goto out;
- }
-
- ret = buf->fill_func(buf);
-
- if (ret >= 0) {
- buf->count = ret;
- ret = 0;
- }
-
-out:
- return ret;
-}
-
-static ssize_t debug_output(struct file *file, char __user *user_buf,
- size_t len, loff_t *offset)
-{
- struct debug_buffer *buf = file->private_data;
- int ret = 0;
-
- mutex_lock(&buf->mutex);
- if (buf->count == 0) {
- ret = fill_buffer(buf);
- if (ret != 0) {
- mutex_unlock(&buf->mutex);
- goto out;
- }
- }
- mutex_unlock(&buf->mutex);
-
- ret = simple_read_from_buffer(user_buf, len, offset,
- buf->page, buf->count);
-
-out:
- return ret;
-}
-
-static int debug_close(struct inode *inode, struct file *file)
-{
- struct debug_buffer *buf = file->private_data;
-
- if (buf) {
- if (buf->page)
- free_page((unsigned long)buf->page);
- kfree(buf);
- }
-
- return 0;
-}
-
-static int debug_async_open(struct inode *inode, struct file *file)
-{
- file->private_data = alloc_buffer(inode->i_private, fill_async_buffer);
-
- return file->private_data ? 0 : -ENOMEM;
-}
-
-static int debug_periodic_open(struct inode *inode, struct file *file)
-{
- file->private_data = alloc_buffer(inode->i_private,
- fill_periodic_buffer);
-
- return file->private_data ? 0 : -ENOMEM;
-}
-
-static int debug_registers_open(struct inode *inode, struct file *file)
-{
- file->private_data = alloc_buffer(inode->i_private,
- fill_registers_buffer);
-
- return file->private_data ? 0 : -ENOMEM;
-}
-
-static inline void create_debug_files(struct admhcd *ahcd)
-{
- struct usb_bus *bus = &admhcd_to_hcd(ahcd)->self;
-
- ahcd->debug_dir = debugfs_create_dir(bus->bus_name, admhc_debug_root);
- if (!ahcd->debug_dir)
- goto dir_error;
-
- ahcd->debug_async = debugfs_create_file("async", S_IRUGO,
- ahcd->debug_dir, ahcd,
- &debug_async_fops);
- if (!ahcd->debug_async)
- goto async_error;
-
- ahcd->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
- ahcd->debug_dir, ahcd,
- &debug_periodic_fops);
- if (!ahcd->debug_periodic)
- goto periodic_error;
-
- ahcd->debug_registers = debugfs_create_file("registers", S_IRUGO,
- ahcd->debug_dir, ahcd,
- &debug_registers_fops);
- if (!ahcd->debug_registers)
- goto registers_error;
-
- admhc_dbg(ahcd, "created debug files\n");
- return;
-
-registers_error:
- debugfs_remove(ahcd->debug_periodic);
-periodic_error:
- debugfs_remove(ahcd->debug_async);
-async_error:
- debugfs_remove(ahcd->debug_dir);
-dir_error:
- ahcd->debug_periodic = NULL;
- ahcd->debug_async = NULL;
- ahcd->debug_dir = NULL;
-}
-
-static inline void remove_debug_files(struct admhcd *ahcd)
-{
- debugfs_remove(ahcd->debug_registers);
- debugfs_remove(ahcd->debug_periodic);
- debugfs_remove(ahcd->debug_async);
- debugfs_remove(ahcd->debug_dir);
-}
-
-#endif
-
-/*-------------------------------------------------------------------------*/
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/usb/host/ohci-au1xxx.c
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
- * (C) Copyright 2002 Hewlett-Packard Company
- *
- * Written by Christopher Hoover <ch@hpl.hp.com>
- * Based on fragments of previous driver by Russell King et al.
- *
- * Modified for LH7A404 from ahcd-sa1111.c
- * by Durgesh Pattamatta <pattamattad@sharpsec.com>
- * Modified for AMD Alchemy Au1xxx
- * by Matt Porter <mporter@kernel.crashing.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/platform_device.h>
-#include <linux/signal.h>
-
-#include <asm/bootinfo.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-
-#ifdef DEBUG
-#define HCD_DBG(f, a...) printk(KERN_DEBUG "%s: " f, hcd_name, ## a)
-#else
-#define HCD_DBG(f, a...) do {} while (0)
-#endif
-#define HCD_ERR(f, a...) printk(KERN_ERR "%s: " f, hcd_name, ## a)
-#define HCD_INFO(f, a...) printk(KERN_INFO "%s: " f, hcd_name, ## a)
-
-/*-------------------------------------------------------------------------*/
-
-static int admhc_adm5120_probe(const struct hc_driver *driver,
- struct platform_device *dev)
-{
- int retval;
- struct usb_hcd *hcd;
- int irq;
- struct resource *regs;
-
- /* sanity checks */
- regs = platform_get_resource(dev, IORESOURCE_MEM, 0);
- if (!regs) {
- HCD_DBG("no IOMEM resource found\n");
- return -ENODEV;
- }
-
- irq = platform_get_irq(dev, 0);
- if (irq < 0) {
- HCD_DBG("no IRQ resource found\n");
- return -ENODEV;
- }
-
- hcd = usb_create_hcd(driver, &dev->dev, "ADM5120");
- if (!hcd)
- return -ENOMEM;
-
- hcd->rsrc_start = regs->start;
- hcd->rsrc_len = regs->end - regs->start + 1;
-
- if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
- HCD_DBG("request_mem_region failed\n");
- retval = -EBUSY;
- goto err_dev;
- }
-
- hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
- if (!hcd->regs) {
- HCD_DBG("ioremap failed\n");
- retval = -ENOMEM;
- goto err_mem;
- }
-
- admhc_hcd_init(hcd_to_admhcd(hcd));
-
- retval = usb_add_hcd(hcd, irq, 0);
- if (retval)
- goto err_io;
-
- return 0;
-
-err_io:
- iounmap(hcd->regs);
-err_mem:
- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
-err_dev:
- usb_put_hcd(hcd);
- return retval;
-}
-
-
-/* may be called without controller electrically present */
-/* may be called with controller, bus, and devices active */
-
-static void admhc_adm5120_remove(struct usb_hcd *hcd,
- struct platform_device *dev)
-{
- usb_remove_hcd(hcd);
- iounmap(hcd->regs);
- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
- usb_put_hcd(hcd);
-}
-
-static int admhc_adm5120_start(struct usb_hcd *hcd)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- int ret;
-
- ret = admhc_init(ahcd);
- if (ret < 0) {
- HCD_ERR("unable to init %s\n", hcd->self.bus_name);
- goto err;
- }
-
- ret = admhc_run(ahcd);
- if (ret < 0) {
- HCD_ERR("unable to run %s\n", hcd->self.bus_name);
- goto err_stop;
- }
-
- return 0;
-
-err_stop:
- admhc_stop(hcd);
-err:
- return ret;
-}
-
-static const struct hc_driver adm5120_hc_driver = {
- .description = hcd_name,
- .product_desc = "ADM5120 built-in USB 1.1 Host Controller",
- .hcd_priv_size = sizeof(struct admhcd),
-
- /*
- * generic hardware linkage
- */
- .irq = admhc_irq,
- .flags = HCD_USB11 | HCD_MEMORY,
-
- /*
- * basic lifecycle operations
- */
- .start = admhc_adm5120_start,
- .stop = admhc_stop,
- .shutdown = admhc_shutdown,
-
- /*
- * managing i/o requests and associated device resources
- */
- .urb_enqueue = admhc_urb_enqueue,
- .urb_dequeue = admhc_urb_dequeue,
- .endpoint_disable = admhc_endpoint_disable,
-
- /*
- * scheduling support
- */
- .get_frame_number = admhc_get_frame_number,
-
- /*
- * root hub support
- */
- .hub_status_data = admhc_hub_status_data,
- .hub_control = admhc_hub_control,
-#ifdef CONFIG_PM
- .bus_suspend = admhc_bus_suspend,
- .bus_resume = admhc_bus_resume,
-#endif
- .start_port_reset = admhc_start_port_reset,
-};
-
-static int usb_hcd_adm5120_probe(struct platform_device *pdev)
-{
- int ret;
-
- ret = admhc_adm5120_probe(&adm5120_hc_driver, pdev);
-
- return ret;
-}
-
-static int usb_hcd_adm5120_remove(struct platform_device *pdev)
-{
- struct usb_hcd *hcd = platform_get_drvdata(pdev);
-
- admhc_adm5120_remove(hcd, pdev);
-
- return 0;
-}
-
-#ifdef CONFIG_PM
-/* TODO */
-static int usb_hcd_adm5120_suspend(struct platform_device *dev)
-{
- struct usb_hcd *hcd = platform_get_drvdata(dev);
-
- return 0;
-}
-
-static int usb_hcd_adm5120_resume(struct platform_device *dev)
-{
- struct usb_hcd *hcd = platform_get_drvdata(dev);
-
- return 0;
-}
-#else
-#define usb_hcd_adm5120_suspend NULL
-#define usb_hcd_adm5120_resume NULL
-#endif /* CONFIG_PM */
-
-static struct platform_driver usb_hcd_adm5120_driver = {
- .probe = usb_hcd_adm5120_probe,
- .remove = usb_hcd_adm5120_remove,
- .shutdown = usb_hcd_platform_shutdown,
- .suspend = usb_hcd_adm5120_suspend,
- .resume = usb_hcd_adm5120_resume,
- .driver = {
- .name = "adm5120-hcd",
- .owner = THIS_MODULE,
- },
-};
-
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/usb/host/ohci-hcd.c
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
- *
- * [ Initialisation is based on Linus' ]
- * [ uhci code and gregs ahcd fragments ]
- * [ (C) Copyright 1999 Linus Torvalds ]
- * [ (C) Copyright 1999 Gregory P. Smith]
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/pci.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/timer.h>
-#include <linux/list.h>
-#include <linux/usb.h>
-#include <linux/usb/otg.h>
-#include <linux/usb/hcd.h>
-#include <linux/dma-mapping.h>
-#include <linux/dmapool.h>
-#include <linux/debugfs.h>
-#include <linux/io.h>
-
-#include <asm/irq.h>
-#include <asm/unaligned.h>
-#include <asm/byteorder.h>
-
-#define DRIVER_VERSION "0.27.0"
-#define DRIVER_AUTHOR "Gabor Juhos <juhosg@openwrt.org>"
-#define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver"
-
-/*-------------------------------------------------------------------------*/
-
-#undef ADMHC_VERBOSE_DEBUG /* not always helpful */
-
-/* For initializing controller (mask in an HCFS mode too) */
-#define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
-
-#define ADMHC_INTR_INIT \
- (ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \
- | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI)
-
-/*-------------------------------------------------------------------------*/
-
-static const char hcd_name[] = "admhc-hcd";
-
-#define STATECHANGE_DELAY msecs_to_jiffies(300)
-
-#include "adm5120.h"
-
-static void admhc_dump(struct admhcd *ahcd, int verbose);
-static int admhc_init(struct admhcd *ahcd);
-static void admhc_stop(struct usb_hcd *hcd);
-
-#include "adm5120-dbg.c"
-#include "adm5120-mem.c"
-#include "adm5120-pm.c"
-#include "adm5120-hub.c"
-#include "adm5120-q.c"
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * queue up an urb for anything except the root hub
- */
-static int admhc_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
- gfp_t mem_flags)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- struct ed *ed;
- struct urb_priv *urb_priv;
- unsigned int pipe = urb->pipe;
- int td_cnt = 0;
- unsigned long flags;
- int ret = 0;
-
-#ifdef ADMHC_VERBOSE_DEBUG
- spin_lock_irqsave(&ahcd->lock, flags);
- urb_print(ahcd, urb, "ENQEUE", usb_pipein(pipe), -EINPROGRESS);
- spin_unlock_irqrestore(&ahcd->lock, flags);
-#endif
-
- /* every endpoint has an ed, locate and maybe (re)initialize it */
- ed = ed_get(ahcd, urb->ep, urb->dev, pipe, urb->interval);
- if (!ed)
- return -ENOMEM;
-
- /* for the private part of the URB we need the number of TDs */
- switch (ed->type) {
- case PIPE_CONTROL:
- if (urb->transfer_buffer_length > TD_DATALEN_MAX)
- /* td_submit_urb() doesn't yet handle these */
- return -EMSGSIZE;
-
- /* 1 TD for setup, 1 for ACK, plus ... */
- td_cnt = 2;
- /* FALLTHROUGH */
- case PIPE_BULK:
- /* one TD for every 4096 Bytes (can be up to 8K) */
- td_cnt += urb->transfer_buffer_length / TD_DATALEN_MAX;
- /* ... and for any remaining bytes ... */
- if ((urb->transfer_buffer_length % TD_DATALEN_MAX) != 0)
- td_cnt++;
- /* ... and maybe a zero length packet to wrap it up */
- if (td_cnt == 0)
- td_cnt++;
- else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
- && (urb->transfer_buffer_length
- % usb_maxpacket(urb->dev, pipe,
- usb_pipeout(pipe))) == 0)
- td_cnt++;
- break;
- case PIPE_INTERRUPT:
- /*
- * for Interrupt IN/OUT transactions, each ED contains
- * only 1 TD.
- * TODO: check transfer_buffer_length?
- */
- td_cnt = 1;
- break;
- case PIPE_ISOCHRONOUS:
- /* number of packets from URB */
- td_cnt = urb->number_of_packets;
- break;
- }
-
- urb_priv = urb_priv_alloc(ahcd, td_cnt, mem_flags);
- if (!urb_priv)
- return -ENOMEM;
-
- urb_priv->ed = ed;
-
- spin_lock_irqsave(&ahcd->lock, flags);
- /* don't submit to a dead HC */
- if (!HCD_HW_ACCESSIBLE(hcd)) {
- ret = -ENODEV;
- goto fail;
- }
- if (!HC_IS_RUNNING(hcd->state)) {
- ret = -ENODEV;
- goto fail;
- }
-
- ret = usb_hcd_link_urb_to_ep(hcd, urb);
- if (ret)
- goto fail;
-
- /* schedule the ed if needed */
- if (ed->state == ED_IDLE) {
- ret = ed_schedule(ahcd, ed);
- if (ret < 0) {
- usb_hcd_unlink_urb_from_ep(hcd, urb);
- goto fail;
- }
- if (ed->type == PIPE_ISOCHRONOUS) {
- u16 frame = admhc_frame_no(ahcd);
-
- /* delay a few frames before the first TD */
- frame += max_t (u16, 8, ed->interval);
- frame &= ~(ed->interval - 1);
- frame |= ed->branch;
- urb->start_frame = frame;
-
- /* yes, only URB_ISO_ASAP is supported, and
- * urb->start_frame is never used as input.
- */
- }
- } else if (ed->type == PIPE_ISOCHRONOUS)
- urb->start_frame = ed->last_iso + ed->interval;
-
- /* fill the TDs and link them to the ed; and
- * enable that part of the schedule, if needed
- * and update count of queued periodic urbs
- */
- urb->hcpriv = urb_priv;
- td_submit_urb(ahcd, urb);
-
-#ifdef ADMHC_VERBOSE_DEBUG
- admhc_dump_ed(ahcd, "admhc_urb_enqueue", urb_priv->ed, 1);
-#endif
-
-fail:
- if (ret)
- urb_priv_free(ahcd, urb_priv);
-
- spin_unlock_irqrestore(&ahcd->lock, flags);
- return ret;
-}
-
-/*
- * decouple the URB from the HC queues (TDs, urb_priv);
- * reporting is always done
- * asynchronously, and we might be dealing with an urb that's
- * partially transferred, or an ED with other urbs being unlinked.
- */
-static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb,
- int status)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- unsigned long flags;
- int ret;
-
- spin_lock_irqsave(&ahcd->lock, flags);
-
-#ifdef ADMHC_VERBOSE_DEBUG
- urb_print(ahcd, urb, "DEQUEUE", 1, status);
-#endif
- ret = usb_hcd_check_unlink_urb(hcd, urb, status);
- if (ret) {
- /* Do nothing */
- ;
- } else if (HC_IS_RUNNING(hcd->state)) {
- struct urb_priv *urb_priv;
-
- /* Unless an IRQ completed the unlink while it was being
- * handed to us, flag it for unlink and giveback, and force
- * some upcoming INTR_SF to call finish_unlinks()
- */
- urb_priv = urb->hcpriv;
- if (urb_priv) {
- if (urb_priv->ed->state == ED_OPER)
- start_ed_unlink(ahcd, urb_priv->ed);
- }
- } else {
- /*
- * with HC dead, we won't respect hc queue pointers
- * any more ... just clean up every urb's memory.
- */
- if (urb->hcpriv)
- finish_urb(ahcd, urb, status);
- }
- spin_unlock_irqrestore(&ahcd->lock, flags);
-
- return ret;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* frees config/altsetting state for endpoints,
- * including ED memory, dummy TD, and bulk/intr data toggle
- */
-
-static void admhc_endpoint_disable(struct usb_hcd *hcd,
- struct usb_host_endpoint *ep)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- unsigned long flags;
- struct ed *ed = ep->hcpriv;
- unsigned limit = 1000;
-
- /* ASSERT: any requests/urbs are being unlinked */
- /* ASSERT: nobody can be submitting urbs for this any more */
-
- if (!ed)
- return;
-
-#ifdef ADMHC_VERBOSE_DEBUG
- spin_lock_irqsave(&ahcd->lock, flags);
- admhc_dump_ed(ahcd, "EP-DISABLE", ed, 1);
- spin_unlock_irqrestore(&ahcd->lock, flags);
-#endif
-
-rescan:
- spin_lock_irqsave(&ahcd->lock, flags);
-
- if (!HC_IS_RUNNING(hcd->state)) {
-sanitize:
- ed->state = ED_IDLE;
- finish_unlinks(ahcd, 0);
- }
-
- switch (ed->state) {
- case ED_UNLINK: /* wait for hw to finish? */
- /* major IRQ delivery trouble loses INTR_SOFI too... */
- if (limit-- == 0) {
- admhc_warn(ahcd, "IRQ INTR_SOFI lossage\n");
- goto sanitize;
- }
- spin_unlock_irqrestore(&ahcd->lock, flags);
- schedule_timeout_uninterruptible(1);
- goto rescan;
- case ED_IDLE: /* fully unlinked */
- if (list_empty(&ed->td_list)) {
- td_free(ahcd, ed->dummy);
- ed_free(ahcd, ed);
- break;
- }
- /* else FALL THROUGH */
- default:
- /* caller was supposed to have unlinked any requests;
- * that's not our job. can't recover; must leak ed.
- */
- admhc_err(ahcd, "leak ed %p (#%02x) state %d%s\n",
- ed, ep->desc.bEndpointAddress, ed->state,
- list_empty(&ed->td_list) ? "" : " (has tds)");
- td_free(ahcd, ed->dummy);
- break;
- }
-
- ep->hcpriv = NULL;
-
- spin_unlock_irqrestore(&ahcd->lock, flags);
-}
-
-static int admhc_get_frame_number(struct usb_hcd *hcd)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
-
- return admhc_frame_no(ahcd);
-}
-
-static void admhc_usb_reset(struct admhcd *ahcd)
-{
-#if 0
- ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control);
- ahcd->hc_control &= OHCI_CTRL_RWC;
- admhc_writel(ahcd, ahcd->hc_control, &ahcd->regs->control);
-#else
- /* FIXME */
- ahcd->host_control = ADMHC_BUSS_RESET;
- admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
-#endif
-}
-
-/* admhc_shutdown forcibly disables IRQs and DMA, helping kexec and
- * other cases where the next software may expect clean state from the
- * "firmware". this is bus-neutral, unlike shutdown() methods.
- */
-static void
-admhc_shutdown(struct usb_hcd *hcd)
-{
- struct admhcd *ahcd;
-
- ahcd = hcd_to_admhcd(hcd);
- admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
- admhc_dma_disable(ahcd);
- admhc_usb_reset(ahcd);
- /* flush the writes */
- admhc_writel_flush(ahcd);
-}
-
-/*-------------------------------------------------------------------------*
- * HC functions
- *-------------------------------------------------------------------------*/
-
-static void admhc_eds_cleanup(struct admhcd *ahcd)
-{
- if (ahcd->ed_tails[PIPE_INTERRUPT]) {
- ed_free(ahcd, ahcd->ed_tails[PIPE_INTERRUPT]);
- ahcd->ed_tails[PIPE_INTERRUPT] = NULL;
- }
-
- if (ahcd->ed_tails[PIPE_ISOCHRONOUS]) {
- ed_free(ahcd, ahcd->ed_tails[PIPE_ISOCHRONOUS]);
- ahcd->ed_tails[PIPE_ISOCHRONOUS] = NULL;
- }
-
- if (ahcd->ed_tails[PIPE_CONTROL]) {
- ed_free(ahcd, ahcd->ed_tails[PIPE_CONTROL]);
- ahcd->ed_tails[PIPE_CONTROL] = NULL;
- }
-
- if (ahcd->ed_tails[PIPE_BULK]) {
- ed_free(ahcd, ahcd->ed_tails[PIPE_BULK]);
- ahcd->ed_tails[PIPE_BULK] = NULL;
- }
-
- ahcd->ed_head = NULL;
-}
-
-#define ED_DUMMY_INFO (ED_SPEED_FULL | ED_SKIP)
-
-static int admhc_eds_init(struct admhcd *ahcd)
-{
- struct ed *ed;
-
- ed = ed_create(ahcd, PIPE_INTERRUPT, ED_DUMMY_INFO);
- if (!ed)
- goto err;
-
- ahcd->ed_tails[PIPE_INTERRUPT] = ed;
-
- ed = ed_create(ahcd, PIPE_ISOCHRONOUS, ED_DUMMY_INFO);
- if (!ed)
- goto err;
-
- ahcd->ed_tails[PIPE_ISOCHRONOUS] = ed;
- ed->ed_prev = ahcd->ed_tails[PIPE_INTERRUPT];
- ahcd->ed_tails[PIPE_INTERRUPT]->ed_next = ed;
- ahcd->ed_tails[PIPE_INTERRUPT]->hwNextED = cpu_to_hc32(ahcd, ed->dma);
-
- ed = ed_create(ahcd, PIPE_CONTROL, ED_DUMMY_INFO);
- if (!ed)
- goto err;
-
- ahcd->ed_tails[PIPE_CONTROL] = ed;
- ed->ed_prev = ahcd->ed_tails[PIPE_ISOCHRONOUS];
- ahcd->ed_tails[PIPE_ISOCHRONOUS]->ed_next = ed;
- ahcd->ed_tails[PIPE_ISOCHRONOUS]->hwNextED = cpu_to_hc32(ahcd, ed->dma);
-
- ed = ed_create(ahcd, PIPE_BULK, ED_DUMMY_INFO);
- if (!ed)
- goto err;
-
- ahcd->ed_tails[PIPE_BULK] = ed;
- ed->ed_prev = ahcd->ed_tails[PIPE_CONTROL];
- ahcd->ed_tails[PIPE_CONTROL]->ed_next = ed;
- ahcd->ed_tails[PIPE_CONTROL]->hwNextED = cpu_to_hc32(ahcd, ed->dma);
-
- ahcd->ed_head = ahcd->ed_tails[PIPE_INTERRUPT];
-
-#ifdef ADMHC_VERBOSE_DEBUG
- admhc_dump_ed(ahcd, "ed intr", ahcd->ed_tails[PIPE_INTERRUPT], 1);
- admhc_dump_ed(ahcd, "ed isoc", ahcd->ed_tails[PIPE_ISOCHRONOUS], 1);
- admhc_dump_ed(ahcd, "ed ctrl", ahcd->ed_tails[PIPE_CONTROL], 1);
- admhc_dump_ed(ahcd, "ed bulk", ahcd->ed_tails[PIPE_BULK], 1);
-#endif
-
- return 0;
-
-err:
- admhc_eds_cleanup(ahcd);
- return -ENOMEM;
-}
-
-/* init memory, and kick BIOS/SMM off */
-
-static int admhc_init(struct admhcd *ahcd)
-{
- struct usb_hcd *hcd = admhcd_to_hcd(ahcd);
- int ret;
-
- admhc_disable(ahcd);
- ahcd->regs = hcd->regs;
-
- /* Disable HC interrupts */
- admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
-
- /* Read the number of ports unless overridden */
- if (ahcd->num_ports == 0)
- ahcd->num_ports = admhc_read_rhdesc(ahcd) & ADMHC_RH_NUMP;
-
- ret = admhc_mem_init(ahcd);
- if (ret)
- goto err;
-
- /* init dummy endpoints */
- ret = admhc_eds_init(ahcd);
- if (ret)
- goto err;
-
- create_debug_files(ahcd);
-
- return 0;
-
-err:
- admhc_stop(hcd);
- return ret;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* Start an OHCI controller, set the BUS operational
- * resets USB and controller
- * enable interrupts
- */
-static int admhc_run(struct admhcd *ahcd)
-{
- u32 val;
- int first = ahcd->fminterval == 0;
- struct usb_hcd *hcd = admhcd_to_hcd(ahcd);
-
- admhc_disable(ahcd);
-
- /* boot firmware should have set this up (5.1.1.3.1) */
- if (first) {
- val = admhc_readl(ahcd, &ahcd->regs->fminterval);
- ahcd->fminterval = val & ADMHC_SFI_FI_MASK;
- if (ahcd->fminterval != FI)
- admhc_dbg(ahcd, "fminterval delta %d\n",
- ahcd->fminterval - FI);
- ahcd->fminterval |=
- (FSLDP(ahcd->fminterval) << ADMHC_SFI_FSLDP_SHIFT);
- /* also: power/overcurrent flags in rhdesc */
- }
-
-#if 0 /* TODO: not applicable */
- /* Reset USB nearly "by the book". RemoteWakeupConnected has
- * to be checked in case boot firmware (BIOS/SMM/...) has set up
- * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM).
- * If the bus glue detected wakeup capability then it should
- * already be enabled; if so we'll just enable it again.
- */
- if ((ahcd->hc_control & OHCI_CTRL_RWC) != 0)
- device_set_wakeup_capable(hcd->self.controller, 1);
-#endif
-
- switch (ahcd->host_control & ADMHC_HC_BUSS) {
- case ADMHC_BUSS_OPER:
- val = 0;
- break;
- case ADMHC_BUSS_SUSPEND:
- /* FALLTHROUGH ? */
- case ADMHC_BUSS_RESUME:
- ahcd->host_control = ADMHC_BUSS_RESUME;
- val = 10 /* msec wait */;
- break;
- /* case ADMHC_BUSS_RESET: */
- default:
- ahcd->host_control = ADMHC_BUSS_RESET;
- val = 50 /* msec wait */;
- break;
- }
- admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
-
- /* flush the writes */
- admhc_writel_flush(ahcd);
-
- msleep(val);
- val = admhc_read_rhdesc(ahcd);
- if (!(val & ADMHC_RH_NPS)) {
- /* power down each port */
- for (val = 0; val < ahcd->num_ports; val++)
- admhc_write_portstatus(ahcd, val, ADMHC_PS_CPP);
- }
- /* flush those writes */
- admhc_writel_flush(ahcd);
-
- /* 2msec timelimit here means no irqs/preempt */
- spin_lock_irq(&ahcd->lock);
-
- admhc_writel(ahcd, ADMHC_CTRL_SR, &ahcd->regs->gencontrol);
- val = 30; /* ... allow extra time */
- while ((admhc_readl(ahcd, &ahcd->regs->gencontrol) & ADMHC_CTRL_SR) != 0) {
- if (--val == 0) {
- spin_unlock_irq(&ahcd->lock);
- admhc_err(ahcd, "USB HC reset timed out!\n");
- return -1;
- }
- udelay(1);
- }
-
- /* enable HOST mode, before access any host specific register */
- admhc_writel(ahcd, ADMHC_CTRL_UHFE, &ahcd->regs->gencontrol);
-
- /* Tell the controller where the descriptor list is */
- admhc_writel(ahcd, (u32)ahcd->ed_head->dma, &ahcd->regs->hosthead);
-
- periodic_reinit(ahcd);
-
- /* use rhsc irqs after khubd is fully initialized */
- set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
- hcd->uses_new_polling = 1;
-
-#if 0
- /* wake on ConnectStatusChange, matching external hubs */
- admhc_writel(ahcd, RH_HS_DRWE, &ahcd->regs->roothub.status);
-#else
- /* FIXME roothub_write_status (ahcd, ADMHC_RH_DRWE); */
-#endif
-
- /* Choose the interrupts we care about now, others later on demand */
- admhc_intr_ack(ahcd, ~0);
- admhc_intr_enable(ahcd, ADMHC_INTR_INIT);
-
- admhc_writel(ahcd, ADMHC_RH_NPS | ADMHC_RH_LPSC, &ahcd->regs->rhdesc);
-
- /* flush those writes */
- admhc_writel_flush(ahcd);
-
- /* start controller operations */
- ahcd->host_control = ADMHC_BUSS_OPER;
- admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
-
- val = 20;
- while ((admhc_readl(ahcd, &ahcd->regs->host_control)
- & ADMHC_HC_BUSS) != ADMHC_BUSS_OPER) {
- if (--val == 0) {
- spin_unlock_irq(&ahcd->lock);
- admhc_err(ahcd, "unable to setup operational mode!\n");
- return -1;
- }
- mdelay(1);
- }
-
- hcd->state = HC_STATE_RUNNING;
-
- ahcd->next_statechange = jiffies + STATECHANGE_DELAY;
-
-#if 0
- /* FIXME: enabling DMA is always failed here for an unknown reason */
- admhc_dma_enable(ahcd);
-
- val = 200;
- while ((admhc_readl(ahcd, &ahcd->regs->host_control)
- & ADMHC_HC_DMAE) != ADMHC_HC_DMAE) {
- if (--val == 0) {
- spin_unlock_irq(&ahcd->lock);
- admhc_err(ahcd, "unable to enable DMA!\n");
- admhc_dump(ahcd, 1);
- return -1;
- }
- mdelay(1);
- }
-
-#endif
-
- spin_unlock_irq(&ahcd->lock);
-
- mdelay(ADMHC_POTPGT);
-
- return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* an interrupt happens */
-
-static irqreturn_t admhc_irq(struct usb_hcd *hcd)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- struct admhcd_regs __iomem *regs = ahcd->regs;
- u32 ints;
-
- ints = admhc_readl(ahcd, ®s->int_status);
- if ((ints & ADMHC_INTR_INTA) == 0) {
- /* no unmasked interrupt status is set */
- return IRQ_NONE;
- }
-
- ints &= admhc_readl(ahcd, ®s->int_enable);
-
- if (ints & ADMHC_INTR_FATI) {
- /* e.g. due to PCI Master/Target Abort */
- admhc_disable(ahcd);
- admhc_err(ahcd, "Fatal Error, controller disabled\n");
- admhc_dump(ahcd, 1);
- admhc_usb_reset(ahcd);
- }
-
- if (ints & ADMHC_INTR_BABI) {
- admhc_intr_disable(ahcd, ADMHC_INTR_BABI);
- admhc_intr_ack(ahcd, ADMHC_INTR_BABI);
- admhc_err(ahcd, "Babble Detected\n");
- }
-
- if (ints & ADMHC_INTR_INSM) {
- admhc_vdbg(ahcd, "Root Hub Status Change\n");
- ahcd->next_statechange = jiffies + STATECHANGE_DELAY;
- admhc_intr_ack(ahcd, ADMHC_INTR_RESI | ADMHC_INTR_INSM);
-
- /* NOTE: Vendors didn't always make the same implementation
- * choices for RHSC. Many followed the spec; RHSC triggers
- * on an edge, like setting and maybe clearing a port status
- * change bit. With others it's level-triggered, active
- * until khubd clears all the port status change bits. We'll
- * always disable it here and rely on polling until khubd
- * re-enables it.
- */
- admhc_intr_disable(ahcd, ADMHC_INTR_INSM);
- usb_hcd_poll_rh_status(hcd);
- } else if (ints & ADMHC_INTR_RESI) {
- /* For connect and disconnect events, we expect the controller
- * to turn on RHSC along with RD. But for remote wakeup events
- * this might not happen.
- */
- admhc_vdbg(ahcd, "Resume Detect\n");
- admhc_intr_ack(ahcd, ADMHC_INTR_RESI);
- set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
- if (ahcd->autostop) {
- spin_lock(&ahcd->lock);
- admhc_rh_resume(ahcd);
- spin_unlock(&ahcd->lock);
- } else
- usb_hcd_resume_root_hub(hcd);
- }
-
- if (ints & ADMHC_INTR_TDC) {
- admhc_vdbg(ahcd, "Transfer Descriptor Complete\n");
- admhc_intr_ack(ahcd, ADMHC_INTR_TDC);
- if (HC_IS_RUNNING(hcd->state))
- admhc_intr_disable(ahcd, ADMHC_INTR_TDC);
- spin_lock(&ahcd->lock);
- admhc_td_complete(ahcd);
- spin_unlock(&ahcd->lock);
- if (HC_IS_RUNNING(hcd->state))
- admhc_intr_enable(ahcd, ADMHC_INTR_TDC);
- }
-
- if (ints & ADMHC_INTR_SO) {
- /* could track INTR_SO to reduce available PCI/... bandwidth */
- admhc_vdbg(ahcd, "Schedule Overrun\n");
- }
-
-#if 1
- spin_lock(&ahcd->lock);
- if (ahcd->ed_rm_list)
- finish_unlinks(ahcd, admhc_frame_no(ahcd));
-
- if ((ints & ADMHC_INTR_SOFI) != 0 && !ahcd->ed_rm_list
- && HC_IS_RUNNING(hcd->state))
- admhc_intr_disable(ahcd, ADMHC_INTR_SOFI);
- spin_unlock(&ahcd->lock);
-#else
- if (ints & ADMHC_INTR_SOFI) {
- admhc_vdbg(ahcd, "Start Of Frame\n");
- spin_lock(&ahcd->lock);
-
- /* handle any pending ED removes */
- finish_unlinks(ahcd, admhc_frameno(ahcd));
-
- /* leaving INTR_SOFI enabled when there's still unlinking
- * to be done in the (next frame).
- */
- if ((ahcd->ed_rm_list == NULL) ||
- HC_IS_RUNNING(hcd->state) == 0)
- /*
- * disable INTR_SOFI if there are no unlinking to be
- * done (in the next frame)
- */
- admhc_intr_disable(ahcd, ADMHC_INTR_SOFI);
-
- spin_unlock(&ahcd->lock);
- }
-#endif
-
- if (HC_IS_RUNNING(hcd->state)) {
- admhc_intr_ack(ahcd, ints);
- admhc_intr_enable(ahcd, ADMHC_INTR_MIE);
- admhc_writel_flush(ahcd);
- }
-
- return IRQ_HANDLED;
-}
-
-/*-------------------------------------------------------------------------*/
-
-static void admhc_stop(struct usb_hcd *hcd)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
-
- admhc_dump(ahcd, 1);
-
- flush_scheduled_work();
-
- admhc_usb_reset(ahcd);
- admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
-
- free_irq(hcd->irq, hcd);
- hcd->irq = -1;
-
- remove_debug_files(ahcd);
- admhc_eds_cleanup(ahcd);
- admhc_mem_cleanup(ahcd);
-}
-
-/*-------------------------------------------------------------------------*/
-
-#ifdef CONFIG_ADM5120
-#include "adm5120-drv.c"
-#define PLATFORM_DRIVER usb_hcd_adm5120_driver
-#endif
-
-#if !defined(PLATFORM_DRIVER)
-#error "missing bus glue for admhc-hcd"
-#endif
-
-#define DRIVER_INFO DRIVER_DESC " version " DRIVER_VERSION
-
-static int __init admhc_hcd_mod_init(void)
-{
- int ret = 0;
-
- if (usb_disabled())
- return -ENODEV;
-
- pr_info("%s: " DRIVER_INFO "\n", hcd_name);
- pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
- sizeof(struct ed), sizeof(struct td));
- set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
-
-#ifdef DEBUG
- admhc_debug_root = debugfs_create_dir("admhc", usb_debug_root);
- if (!admhc_debug_root) {
- ret = -ENOENT;
- goto error_debug;
- }
-#endif
-
-#ifdef PLATFORM_DRIVER
- ret = platform_driver_register(&PLATFORM_DRIVER);
- if (ret < 0)
- goto error_platform;
-#endif
-
- return ret;
-
-#ifdef PLATFORM_DRIVER
- platform_driver_unregister(&PLATFORM_DRIVER);
-error_platform:
-#endif
-
-#ifdef DEBUG
- debugfs_remove(admhc_debug_root);
- admhc_debug_root = NULL;
-error_debug:
-#endif
- clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
- return ret;
-}
-module_init(admhc_hcd_mod_init);
-
-static void __exit admhc_hcd_mod_exit(void)
-{
- platform_driver_unregister(&PLATFORM_DRIVER);
-#ifdef DEBUG
- debugfs_remove(admhc_debug_root);
-#endif
- clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
-}
-module_exit(admhc_hcd_mod_exit);
-
-MODULE_AUTHOR(DRIVER_AUTHOR);
-MODULE_DESCRIPTION(DRIVER_INFO);
-MODULE_VERSION(DRIVER_VERSION);
-MODULE_LICENSE("GPL v2");
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/usb/host/ohci-hub.c
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * ADM5120 Root Hub ... the nonsharable stuff
- */
-
-#define dbg_port(hc, label, num, value) \
- admhc_dbg(hc, \
- "%s port%d " \
- "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \
- label, num, value, \
- (value & ADMHC_PS_PRSC) ? " PRSC" : "", \
- (value & ADMHC_PS_OCIC) ? " OCIC" : "", \
- (value & ADMHC_PS_PSSC) ? " PSSC" : "", \
- (value & ADMHC_PS_PESC) ? " PESC" : "", \
- (value & ADMHC_PS_CSC) ? " CSC" : "", \
- \
- (value & ADMHC_PS_LSDA) ? " LSDA" : "", \
- (value & ADMHC_PS_PPS) ? " PPS" : "", \
- (value & ADMHC_PS_PRS) ? " PRS" : "", \
- (value & ADMHC_PS_POCI) ? " POCI" : "", \
- (value & ADMHC_PS_PSS) ? " PSS" : "", \
- \
- (value & ADMHC_PS_PES) ? " PES" : "", \
- (value & ADMHC_PS_CCS) ? " CCS" : "" \
- );
-
-#define dbg_port_write(hc, label, num, value) \
- admhc_dbg(hc, \
- "%s port%d " \
- "= 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \
- label, num, value, \
- (value & ADMHC_PS_PRSC) ? " PRSC" : "", \
- (value & ADMHC_PS_OCIC) ? " OCIC" : "", \
- (value & ADMHC_PS_PSSC) ? " PSSC" : "", \
- (value & ADMHC_PS_PESC) ? " PESC" : "", \
- (value & ADMHC_PS_CSC) ? " CSC" : "", \
- \
- (value & ADMHC_PS_CPP) ? " CPP" : "", \
- (value & ADMHC_PS_SPP) ? " SPP" : "", \
- (value & ADMHC_PS_SPR) ? " SPR" : "", \
- (value & ADMHC_PS_CPS) ? " CPS" : "", \
- (value & ADMHC_PS_SPS) ? " SPS" : "", \
- \
- (value & ADMHC_PS_SPE) ? " SPE" : "", \
- (value & ADMHC_PS_CPE) ? " CPE" : "" \
- );
-
-/*-------------------------------------------------------------------------*/
-
-/* build "status change" packet (one or two bytes) from HC registers */
-
-static int
-admhc_hub_status_data(struct usb_hcd *hcd, char *buf)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- int i, changed = 0, length = 1;
- int any_connected = 0;
- unsigned long flags;
- u32 status;
-
- spin_lock_irqsave(&ahcd->lock, flags);
- if (!HCD_HW_ACCESSIBLE(hcd))
- goto done;
-
- /* init status */
- status = admhc_read_rhdesc(ahcd);
- if (status & (ADMHC_RH_LPSC | ADMHC_RH_OCIC))
- buf[0] = changed = 1;
- else
- buf[0] = 0;
- if (ahcd->num_ports > 7) {
- buf[1] = 0;
- length++;
- }
-
- /* look at each port */
- for (i = 0; i < ahcd->num_ports; i++) {
- status = admhc_read_portstatus(ahcd, i);
-
- /* can't autostop if ports are connected */
- any_connected |= (status & ADMHC_PS_CCS);
-
- if (status & (ADMHC_PS_CSC | ADMHC_PS_PESC | ADMHC_PS_PSSC
- | ADMHC_PS_OCIC | ADMHC_PS_PRSC)) {
- changed = 1;
- if (i < 7)
- buf[0] |= 1 << (i + 1);
- else
- buf[1] |= 1 << (i - 7);
- }
- }
-
- if (admhc_root_hub_state_changes(ahcd, changed,
- any_connected))
- set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
- else
- clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
-
-done:
- spin_unlock_irqrestore(&ahcd->lock, flags);
-
- return changed ? length : 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-static int admhc_get_hub_descriptor(struct admhcd *ahcd, char *buf)
-{
- struct usb_hub_descriptor *desc = (struct usb_hub_descriptor *)buf;
- u32 rh = admhc_read_rhdesc(ahcd);
- u16 temp;
-
- desc->bDescriptorType = USB_DT_HUB; /* Hub-descriptor */
- desc->bPwrOn2PwrGood = ADMHC_POTPGT/2; /* use default value */
- desc->bHubContrCurrent = 0x00; /* 0mA */
-
- desc->bNbrPorts = ahcd->num_ports;
- temp = 1 + (ahcd->num_ports / 8);
- desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * temp;
-
- /* FIXME */
- temp = 0;
- if (rh & ADMHC_RH_NPS) /* no power switching? */
- temp |= 0x0002;
- if (rh & ADMHC_RH_PSM) /* per-port power switching? */
- temp |= 0x0001;
- if (rh & ADMHC_RH_NOCP) /* no overcurrent reporting? */
- temp |= 0x0010;
- else if (rh & ADMHC_RH_OCPM) /* per-port overcurrent reporting? */
- temp |= 0x0008;
- desc->wHubCharacteristics = (__force __u16)cpu_to_hc16(ahcd, temp);
-
- /* ports removable, and usb 1.0 legacy PortPwrCtrlMask */
- desc->u.hs.DeviceRemovable[0] = 0;
- desc->u.hs.DeviceRemovable[0] = ~0;
-
- return 0;
-}
-
-static int admhc_get_hub_status(struct admhcd *ahcd, char *buf)
-{
- struct usb_hub_status *hs = (struct usb_hub_status *)buf;
- u32 t = admhc_read_rhdesc(ahcd);
- u16 status, change;
-
- status = 0;
- status |= (t & ADMHC_RH_LPS) ? HUB_STATUS_LOCAL_POWER : 0;
- status |= (t & ADMHC_RH_OCI) ? HUB_STATUS_OVERCURRENT : 0;
-
- change = 0;
- change |= (t & ADMHC_RH_LPSC) ? HUB_CHANGE_LOCAL_POWER : 0;
- change |= (t & ADMHC_RH_OCIC) ? HUB_CHANGE_OVERCURRENT : 0;
-
- hs->wHubStatus = (__force __u16)cpu_to_hc16(ahcd, status);
- hs->wHubChange = (__force __u16)cpu_to_hc16(ahcd, change);
-
- return 0;
-}
-
-static int admhc_get_port_status(struct admhcd *ahcd, unsigned port, char *buf)
-{
- struct usb_port_status *ps = (struct usb_port_status *)buf;
- u32 t = admhc_read_portstatus(ahcd, port);
- u16 status, change;
-
- status = 0;
- status |= (t & ADMHC_PS_CCS) ? USB_PORT_STAT_CONNECTION : 0;
- status |= (t & ADMHC_PS_PES) ? USB_PORT_STAT_ENABLE : 0;
- status |= (t & ADMHC_PS_PSS) ? USB_PORT_STAT_SUSPEND : 0;
- status |= (t & ADMHC_PS_POCI) ? USB_PORT_STAT_OVERCURRENT : 0;
- status |= (t & ADMHC_PS_PRS) ? USB_PORT_STAT_RESET : 0;
- status |= (t & ADMHC_PS_PPS) ? USB_PORT_STAT_POWER : 0;
- status |= (t & ADMHC_PS_LSDA) ? USB_PORT_STAT_LOW_SPEED : 0;
-
- change = 0;
- change |= (t & ADMHC_PS_CSC) ? USB_PORT_STAT_C_CONNECTION : 0;
- change |= (t & ADMHC_PS_PESC) ? USB_PORT_STAT_C_ENABLE : 0;
- change |= (t & ADMHC_PS_PSSC) ? USB_PORT_STAT_C_SUSPEND : 0;
- change |= (t & ADMHC_PS_OCIC) ? USB_PORT_STAT_C_OVERCURRENT : 0;
- change |= (t & ADMHC_PS_PRSC) ? USB_PORT_STAT_C_RESET : 0;
-
- ps->wPortStatus = (__force __u16)cpu_to_hc16(ahcd, status);
- ps->wPortChange = (__force __u16)cpu_to_hc16(ahcd, change);
-
- return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-#ifdef CONFIG_USB_OTG
-
-static int admhc_start_port_reset(struct usb_hcd *hcd, unsigned port)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- u32 status;
-
- if (!port)
- return -EINVAL;
- port--;
-
- /* start port reset before HNP protocol times out */
- status = admhc_read_portstatus(ahcd, port);
- if (!(status & ADMHC_PS_CCS))
- return -ENODEV;
-
- /* khubd will finish the reset later */
- admhc_write_portstatus(ahcd, port, ADMHC_PS_PRS);
- return 0;
-}
-
-static void start_hnp(struct admhcd *ahcd);
-
-#else
-
-#define admhc_start_port_reset NULL
-
-#endif
-
-/*-------------------------------------------------------------------------*/
-
-
-/* See usb 7.1.7.5: root hubs must issue at least 50 msec reset signaling,
- * not necessarily continuous ... to guard against resume signaling.
- * The short timeout is safe for non-root hubs, and is backward-compatible
- * with earlier Linux hosts.
- */
-#ifdef CONFIG_USB_SUSPEND
-#define PORT_RESET_MSEC 50
-#else
-#define PORT_RESET_MSEC 10
-#endif
-
-/* this timer value might be vendor-specific ... */
-#define PORT_RESET_HW_MSEC 10
-
-/* wrap-aware logic morphed from <linux/jiffies.h> */
-#define tick_before(t1, t2) ((s16)(((s16)(t1)) - ((s16)(t2))) < 0)
-
-/* called from some task, normally khubd */
-static inline int admhc_port_reset(struct admhcd *ahcd, unsigned port)
-{
- u32 t;
-
- admhc_vdbg(ahcd, "reset port%d\n", port);
- t = admhc_read_portstatus(ahcd, port);
- if (!(t & ADMHC_PS_CCS))
- return -ENODEV;
-
- admhc_write_portstatus(ahcd, port, ADMHC_PS_SPR);
- mdelay(10);
- admhc_write_portstatus(ahcd, port, (ADMHC_PS_SPE | ADMHC_PS_CSC));
- mdelay(100);
-
- return 0;
-}
-
-static inline int admhc_port_enable(struct admhcd *ahcd, unsigned port)
-{
- u32 t;
-
- admhc_vdbg(ahcd, "enable port%d\n", port);
- t = admhc_read_portstatus(ahcd, port);
- if (!(t & ADMHC_PS_CCS))
- return -ENODEV;
-
- admhc_write_portstatus(ahcd, port, ADMHC_PS_SPE);
-
- return 0;
-}
-
-static inline int admhc_port_disable(struct admhcd *ahcd, unsigned port)
-{
- u32 t;
-
- admhc_vdbg(ahcd, "disable port%d\n", port);
- t = admhc_read_portstatus(ahcd, port);
- if (!(t & ADMHC_PS_CCS))
- return -ENODEV;
-
- admhc_write_portstatus(ahcd, port, ADMHC_PS_CPE);
-
- return 0;
-}
-
-static inline int admhc_port_write(struct admhcd *ahcd, unsigned port,
- u32 val)
-{
-#ifdef ADMHC_VERBOSE_DEBUG
- dbg_port_write(ahcd, "write", port, val);
-#endif
- admhc_write_portstatus(ahcd, port, val);
-
- return 0;
-}
-
-static int admhc_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
- u16 wIndex, char *buf, u16 wLength)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- int ports = ahcd->num_ports;
- int ret = 0;
-
- if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
- return -ESHUTDOWN;
-
- switch (typeReq) {
- case ClearHubFeature:
- switch (wValue) {
- case C_HUB_OVER_CURRENT:
-#if 0 /* FIXME */
- admhc_writel(ahcd, ADMHC_RH_OCIC,
- &ahcd->regs->roothub.status);
-#endif
- case C_HUB_LOCAL_POWER:
- break;
- default:
- goto error;
- }
- break;
- case ClearPortFeature:
- if (!wIndex || wIndex > ports)
- goto error;
- wIndex--;
-
- switch (wValue) {
- case USB_PORT_FEAT_ENABLE:
- ret = admhc_port_disable(ahcd, wIndex);
- break;
- case USB_PORT_FEAT_SUSPEND:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CPS);
- break;
- case USB_PORT_FEAT_POWER:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CPP);
- break;
- case USB_PORT_FEAT_C_CONNECTION:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_CSC);
- break;
- case USB_PORT_FEAT_C_ENABLE:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PESC);
- break;
- case USB_PORT_FEAT_C_SUSPEND:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PSSC);
- break;
- case USB_PORT_FEAT_C_OVER_CURRENT:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_OCIC);
- break;
- case USB_PORT_FEAT_C_RESET:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_PRSC);
- break;
- default:
- goto error;
- }
- break;
- case GetHubDescriptor:
- ret = admhc_get_hub_descriptor(ahcd, buf);
- break;
- case GetHubStatus:
- ret = admhc_get_hub_status(ahcd, buf);
- break;
- case GetPortStatus:
- if (!wIndex || wIndex > ports)
- goto error;
- wIndex--;
-
- ret = admhc_get_port_status(ahcd, wIndex, buf);
- break;
- case SetHubFeature:
- switch (wValue) {
- case C_HUB_OVER_CURRENT:
- /* FIXME: this can be cleared, yes? */
- case C_HUB_LOCAL_POWER:
- break;
- default:
- goto error;
- }
- break;
- case SetPortFeature:
- if (!wIndex || wIndex > ports)
- goto error;
- wIndex--;
-
- switch (wValue) {
- case USB_PORT_FEAT_ENABLE:
- ret = admhc_port_enable(ahcd, wIndex);
- break;
- case USB_PORT_FEAT_RESET:
- ret = admhc_port_reset(ahcd, wIndex);
- break;
- case USB_PORT_FEAT_SUSPEND:
-#ifdef CONFIG_USB_OTG
- if (hcd->self.otg_port == (wIndex + 1)
- && hcd->self.b_hnp_enable)
- start_hnp(ahcd);
- else
-#endif
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_SPS);
- break;
- case USB_PORT_FEAT_POWER:
- ret = admhc_port_write(ahcd, wIndex, ADMHC_PS_SPP);
- break;
- default:
- goto error;
- }
- break;
-
- default:
-error:
- /* "protocol stall" on error */
- ret = -EPIPE;
- }
-
- return ret;
-}
-
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/usb/host/ohci-mem.c
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * OHCI deals with three types of memory:
- * - data used only by the HCD ... kmalloc is fine
- * - async and periodic schedules, shared by HC and HCD ... these
- * need to use dma_pool or dma_alloc_coherent
- * - driver buffers, read/written by HC ... the hcd glue or the
- * device driver provides us with dma addresses
- *
- * There's also "register" data, which is memory mapped.
- * No memory seen by this driver (or any HCD) may be paged out.
- */
-
-/*-------------------------------------------------------------------------*/
-
-static void admhc_hcd_init(struct admhcd *ahcd)
-{
- ahcd->next_statechange = jiffies;
- spin_lock_init(&ahcd->lock);
- INIT_LIST_HEAD(&ahcd->pending);
-}
-
-/*-------------------------------------------------------------------------*/
-
-static int admhc_mem_init(struct admhcd *ahcd)
-{
- ahcd->td_cache = dma_pool_create("admhc_td",
- admhcd_to_hcd(ahcd)->self.controller,
- sizeof(struct td),
- TD_ALIGN, /* byte alignment */
- 0 /* no page-crossing issues */
- );
- if (!ahcd->td_cache)
- goto err;
-
- ahcd->ed_cache = dma_pool_create("admhc_ed",
- admhcd_to_hcd(ahcd)->self.controller,
- sizeof(struct ed),
- ED_ALIGN, /* byte alignment */
- 0 /* no page-crossing issues */
- );
- if (!ahcd->ed_cache)
- goto err_td_cache;
-
- return 0;
-
-err_td_cache:
- dma_pool_destroy(ahcd->td_cache);
- ahcd->td_cache = NULL;
-err:
- return -ENOMEM;
-}
-
-static void admhc_mem_cleanup(struct admhcd *ahcd)
-{
- if (ahcd->td_cache) {
- dma_pool_destroy(ahcd->td_cache);
- ahcd->td_cache = NULL;
- }
-
- if (ahcd->ed_cache) {
- dma_pool_destroy(ahcd->ed_cache);
- ahcd->ed_cache = NULL;
- }
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* ahcd "done list" processing needs this mapping */
-static inline struct td *dma_to_td(struct admhcd *ahcd, dma_addr_t td_dma)
-{
- struct td *td;
-
- td_dma &= TD_MASK;
- td = ahcd->td_hash[TD_HASH_FUNC(td_dma)];
- while (td && td->td_dma != td_dma)
- td = td->td_hash;
-
- return td;
-}
-
-/* TDs ... */
-static struct td *td_alloc(struct admhcd *ahcd, gfp_t mem_flags)
-{
- dma_addr_t dma;
- struct td *td;
-
- td = dma_pool_alloc(ahcd->td_cache, mem_flags, &dma);
- if (!td)
- return NULL;
-
- /* in case ahcd fetches it, make it look dead */
- memset(td, 0, sizeof *td);
- td->hwNextTD = cpu_to_hc32(ahcd, dma);
- td->td_dma = dma;
- /* hashed in td_fill */
-
- return td;
-}
-
-static void td_free(struct admhcd *ahcd, struct td *td)
-{
- struct td **prev = &ahcd->td_hash[TD_HASH_FUNC(td->td_dma)];
-
- while (*prev && *prev != td)
- prev = &(*prev)->td_hash;
- if (*prev)
- *prev = td->td_hash;
-#if 0
- /* TODO: remove */
- else if ((td->hwINFO & cpu_to_hc32(ahcd, TD_DONE)) != 0)
- admhc_dbg(ahcd, "no hash for td %p\n", td);
-#else
- else if ((td->flags & TD_FLAG_DONE) != 0)
- admhc_dbg(ahcd, "no hash for td %p\n", td);
-#endif
- dma_pool_free(ahcd->td_cache, td, td->td_dma);
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* EDs ... */
-static struct ed *ed_alloc(struct admhcd *ahcd, gfp_t mem_flags)
-{
- dma_addr_t dma;
- struct ed *ed;
-
- ed = dma_pool_alloc(ahcd->ed_cache, mem_flags, &dma);
- if (!ed)
- return NULL;
-
- memset(ed, 0, sizeof(*ed));
- ed->dma = dma;
-
- INIT_LIST_HEAD(&ed->td_list);
- INIT_LIST_HEAD(&ed->urb_list);
-
- return ed;
-}
-
-static void ed_free(struct admhcd *ahcd, struct ed *ed)
-{
- dma_pool_free(ahcd->ed_cache, ed, ed->dma);
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* URB priv ... */
-static void urb_priv_free(struct admhcd *ahcd, struct urb_priv *urb_priv)
-{
- int i;
-
- for (i = 0; i < urb_priv->td_cnt; i++)
- if (urb_priv->td[i])
- td_free(ahcd, urb_priv->td[i]);
-
- list_del(&urb_priv->pending);
- kfree(urb_priv);
-}
-
-static struct urb_priv *urb_priv_alloc(struct admhcd *ahcd, int num_tds,
- gfp_t mem_flags)
-{
- struct urb_priv *priv;
-
- /* allocate the private part of the URB */
- priv = kzalloc(sizeof(*priv) + sizeof(struct td) * num_tds, mem_flags);
- if (!priv)
- goto err;
-
- /* allocate the TDs (deferring hash chain updates) */
- for (priv->td_cnt = 0; priv->td_cnt < num_tds; priv->td_cnt++) {
- priv->td[priv->td_cnt] = td_alloc(ahcd, mem_flags);
- if (priv->td[priv->td_cnt] == NULL)
- goto err_free;
- }
-
- INIT_LIST_HEAD(&priv->pending);
-
- return priv;
-
-err_free:
- urb_priv_free(ahcd, priv);
-err:
- return NULL;
-}
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from fragments of the OHCI driver.
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#define OHCI_SCHED_ENABLES \
- (OHCI_CTRL_CLE|OHCI_CTRL_BLE|OHCI_CTRL_PLE|OHCI_CTRL_IE)
-
-#ifdef CONFIG_PM
-static int admhc_restart(struct admhcd *ahcd);
-
-static int admhc_rh_suspend(struct admhcd *ahcd, int autostop)
-__releases(ahcd->lock)
-__acquires(ahcd->lock)
-{
- int status = 0;
-
- ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control);
- switch (ahcd->hc_control & OHCI_CTRL_HCFS) {
- case OHCI_USB_RESUME:
- admhc_dbg(ahcd, "resume/suspend?\n");
- ahcd->hc_control &= ~OHCI_CTRL_HCFS;
- ahcd->hc_control |= OHCI_USB_RESET;
- admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control);
- (void) admhc_readl(ahcd, &ahcd->regs->control);
- /* FALL THROUGH */
- case OHCI_USB_RESET:
- status = -EBUSY;
- admhc_dbg(ahcd, "needs reinit!\n");
- goto done;
- case OHCI_USB_SUSPEND:
- if (!ahcd->autostop) {
- admhc_dbg(ahcd, "already suspended\n");
- goto done;
- }
- }
- admhc_dbg(ahcd, "%s root hub\n",
- autostop ? "auto-stop" : "suspend");
-
- /* First stop any processing */
- if (!autostop && (ahcd->hc_control & OHCI_SCHED_ENABLES)) {
- ahcd->hc_control &= ~OHCI_SCHED_ENABLES;
- admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control);
- ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control);
- admhc_writel(ahcd, OHCI_INTR_SF, &ahcd->regs->intrstatus);
-
- /* sched disables take effect on the next frame,
- * then the last WDH could take 6+ msec
- */
- admhc_dbg(ahcd, "stopping schedules ...\n");
- ahcd->autostop = 0;
- spin_unlock_irq (&ahcd->lock);
- msleep (8);
- spin_lock_irq(&ahcd->lock);
- }
- dl_done_list (ahcd);
- finish_unlinks (ahcd, admhc_frame_no(ahcd));
-
- /* maybe resume can wake root hub */
- if (device_may_wakeup(&admhcd_to_hcd(ahcd)->self.root_hub->dev) ||
- autostop)
- ahcd->hc_control |= OHCI_CTRL_RWE;
- else {
- admhc_writel(ahcd, OHCI_INTR_RHSC, &ahcd->regs->intrdisable);
- ahcd->hc_control &= ~OHCI_CTRL_RWE;
- }
-
- /* Suspend hub ... this is the "global (to this bus) suspend" mode,
- * which doesn't imply ports will first be individually suspended.
- */
- ahcd->hc_control &= ~OHCI_CTRL_HCFS;
- ahcd->hc_control |= OHCI_USB_SUSPEND;
- admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control);
- (void) admhc_readl(ahcd, &ahcd->regs->control);
-
- /* no resumes until devices finish suspending */
- if (!autostop) {
- ahcd->next_statechange = jiffies + msecs_to_jiffies (5);
- ahcd->autostop = 0;
- }
-
-done:
- return status;
-}
-
-static inline struct ed *find_head(struct ed *ed)
-{
- /* for bulk and control lists */
- while (ed->ed_prev)
- ed = ed->ed_prev;
- return ed;
-}
-
-/* caller has locked the root hub */
-static int admhc_rh_resume(struct admhcd *ahcd)
-__releases(ahcd->lock)
-__acquires(ahcd->lock)
-{
- struct usb_hcd *hcd = admhcd_to_hcd (ahcd);
- u32 temp, enables;
- int status = -EINPROGRESS;
- int autostopped = ahcd->autostop;
-
- ahcd->autostop = 0;
- ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control);
-
- if (ahcd->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
- /* this can happen after resuming a swsusp snapshot */
- if (hcd->state == HC_STATE_RESUMING) {
- admhc_dbg(ahcd, "BIOS/SMM active, control %03x\n",
- ahcd->hc_control);
- status = -EBUSY;
- /* this happens when pmcore resumes HC then root */
- } else {
- admhc_dbg(ahcd, "duplicate resume\n");
- status = 0;
- }
- } else switch (ahcd->hc_control & OHCI_CTRL_HCFS) {
- case OHCI_USB_SUSPEND:
- ahcd->hc_control &= ~(OHCI_CTRL_HCFS|OHCI_SCHED_ENABLES);
- ahcd->hc_control |= OHCI_USB_RESUME;
- admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control);
- (void) admhc_readl(ahcd, &ahcd->regs->control);
- admhc_dbg(ahcd, "%s root hub\n",
- autostopped ? "auto-start" : "resume");
- break;
- case OHCI_USB_RESUME:
- /* HCFS changes sometime after INTR_RD */
- admhc_dbg(ahcd, "%swakeup root hub\n",
- autostopped ? "auto-" : "");
- break;
- case OHCI_USB_OPER:
- /* this can happen after resuming a swsusp snapshot */
- admhc_dbg(ahcd, "snapshot resume? reinit\n");
- status = -EBUSY;
- break;
- default: /* RESET, we lost power */
- admhc_dbg(ahcd, "lost power\n");
- status = -EBUSY;
- }
- if (status == -EBUSY) {
- if (!autostopped) {
- spin_unlock_irq (&ahcd->lock);
- (void) ahcd_init (ahcd);
- status = admhc_restart (ahcd);
- spin_lock_irq(&ahcd->lock);
- }
- return status;
- }
- if (status != -EINPROGRESS)
- return status;
- if (autostopped)
- goto skip_resume;
- spin_unlock_irq (&ahcd->lock);
-
- /* Some controllers (lucent erratum) need extra-long delays */
- msleep (20 /* usb 11.5.1.10 */ + 12 /* 32 msec counter */ + 1);
-
- temp = admhc_readl(ahcd, &ahcd->regs->control);
- temp &= OHCI_CTRL_HCFS;
- if (temp != OHCI_USB_RESUME) {
- admhc_err (ahcd, "controller won't resume\n");
- spin_lock_irq(&ahcd->lock);
- return -EBUSY;
- }
-
- /* disable old schedule state, reinit from scratch */
- admhc_writel(ahcd, 0, &ahcd->regs->ed_controlhead);
- admhc_writel(ahcd, 0, &ahcd->regs->ed_controlcurrent);
- admhc_writel(ahcd, 0, &ahcd->regs->ed_bulkhead);
- admhc_writel(ahcd, 0, &ahcd->regs->ed_bulkcurrent);
- admhc_writel(ahcd, 0, &ahcd->regs->ed_periodcurrent);
- admhc_writel(ahcd, (u32) ahcd->hcca_dma, &ahcd->ahcd->regs->hcca);
-
- /* Sometimes PCI D3 suspend trashes frame timings ... */
- periodic_reinit(ahcd);
-
- /* the following code is executed with ahcd->lock held and
- * irqs disabled if and only if autostopped is true
- */
-
-skip_resume:
- /* interrupts might have been disabled */
- admhc_writel(ahcd, OHCI_INTR_INIT, &ahcd->regs->int_enable);
- if (ahcd->ed_rm_list)
- admhc_writel(ahcd, OHCI_INTR_SF, &ahcd->regs->int_enable);
-
- /* Then re-enable operations */
- admhc_writel(ahcd, OHCI_USB_OPER, &ahcd->regs->control);
- (void) admhc_readl(ahcd, &ahcd->regs->control);
- if (!autostopped)
- msleep (3);
-
- temp = ahcd->hc_control;
- temp &= OHCI_CTRL_RWC;
- temp |= OHCI_CONTROL_INIT | OHCI_USB_OPER;
- ahcd->hc_control = temp;
- admhc_writel(ahcd, temp, &ahcd->regs->control);
- (void) admhc_readl(ahcd, &ahcd->regs->control);
-
- /* TRSMRCY */
- if (!autostopped) {
- msleep (10);
- spin_lock_irq(&ahcd->lock);
- }
- /* now ahcd->lock is always held and irqs are always disabled */
-
- /* keep it alive for more than ~5x suspend + resume costs */
- ahcd->next_statechange = jiffies + STATECHANGE_DELAY;
-
- /* maybe turn schedules back on */
- enables = 0;
- temp = 0;
- if (!ahcd->ed_rm_list) {
- if (ahcd->ed_controltail) {
- admhc_writel(ahcd,
- find_head (ahcd->ed_controltail)->dma,
- &ahcd->regs->ed_controlhead);
- enables |= OHCI_CTRL_CLE;
- temp |= OHCI_CLF;
- }
- if (ahcd->ed_bulktail) {
- admhc_writel(ahcd, find_head (ahcd->ed_bulktail)->dma,
- &ahcd->regs->ed_bulkhead);
- enables |= OHCI_CTRL_BLE;
- temp |= OHCI_BLF;
- }
- }
- if (hcd->self.bandwidth_isoc_reqs || hcd->self.bandwidth_int_reqs)
- enables |= OHCI_CTRL_PLE|OHCI_CTRL_IE;
- if (enables) {
- admhc_dbg(ahcd, "restarting schedules ... %08x\n", enables);
- ahcd->hc_control |= enables;
- admhc_writel(ahcd, ahcd->hc_control, &ahcd->ahcd->regs->control);
- if (temp)
- admhc_writel(ahcd, temp, &ahcd->regs->cmdstatus);
- (void) admhc_readl(ahcd, &ahcd->regs->control);
- }
-
- return 0;
-}
-
-static int admhc_bus_suspend(struct usb_hcd *hcd)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- int rc;
-
- spin_lock_irq(&ahcd->lock);
-
- if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
- rc = -ESHUTDOWN;
- else
- rc = admhc_rh_suspend(ahcd, 0);
- spin_unlock_irq(&ahcd->lock);
- return rc;
-}
-
-static int admhc_bus_resume(struct usb_hcd *hcd)
-{
- struct admhcd *ahcd = hcd_to_admhcd(hcd);
- int rc;
-
- if (time_before(jiffies, ahcd->next_statechange))
- msleep(5);
-
- spin_lock_irq(&ahcd->lock);
-
- if (unlikely(!HCD_HW_ACCESSIBLE(hcd)))
- rc = -ESHUTDOWN;
- else
- rc = admhc_rh_resume(ahcd);
- spin_unlock_irq(&ahcd->lock);
-
- /* poll until we know a device is connected or we autostop */
- if (rc == 0)
- usb_hcd_poll_rh_status(hcd);
- return rc;
-}
-
-/* Carry out polling-, autostop-, and autoresume-related state changes */
-static int admhc_root_hub_state_changes(struct admhcd *ahcd, int changed,
- int any_connected)
-{
- int poll_rh = 1;
-
- switch (ahcd->hc_control & OHCI_CTRL_HCFS) {
-
- case OHCI_USB_OPER:
- /* keep on polling until we know a device is connected
- * and RHSC is enabled */
- if (!ahcd->autostop) {
- if (any_connected ||
- !device_may_wakeup(&admhcd_to_hcd(ahcd)
- ->self.root_hub->dev)) {
- if (admhc_readl(ahcd, &ahcd->regs->int_enable) &
- OHCI_INTR_RHSC)
- poll_rh = 0;
- } else {
- ahcd->autostop = 1;
- ahcd->next_statechange = jiffies + HZ;
- }
-
- /* if no devices have been attached for one second, autostop */
- } else {
- if (changed || any_connected) {
- ahcd->autostop = 0;
- ahcd->next_statechange = jiffies +
- STATECHANGE_DELAY;
- } else if (time_after_eq(jiffies,
- ahcd->next_statechange)
- && !ahcd->ed_rm_list
- && !(ahcd->hc_control &
- OHCI_SCHED_ENABLES)) {
- ahcd_rh_suspend(ahcd, 1);
- }
- }
- break;
-
- /* if there is a port change, autostart or ask to be resumed */
- case OHCI_USB_SUSPEND:
- case OHCI_USB_RESUME:
- if (changed) {
- if (ahcd->autostop)
- admhc_rh_resume(ahcd);
- else
- usb_hcd_resume_root_hub(admhcd_to_hcd(ahcd));
- } else {
- /* everything is idle, no need for polling */
- poll_rh = 0;
- }
- break;
- }
- return poll_rh;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* must not be called from interrupt context */
-static int admhc_restart(struct admhcd *ahcd)
-{
- int temp;
- int i;
- struct urb_priv *priv;
-
- /* mark any devices gone, so they do nothing till khubd disconnects.
- * recycle any "live" eds/tds (and urbs) right away.
- * later, khubd disconnect processing will recycle the other state,
- * (either as disconnect/reconnect, or maybe someday as a reset).
- */
- spin_lock_irq(&ahcd->lock);
- admhc_disable(ahcd);
- usb_root_hub_lost_power(admhcd_to_hcd(ahcd)->self.root_hub);
- if (!list_empty(&ahcd->pending))
- admhc_dbg(ahcd, "abort schedule...\n");
- list_for_each_entry(priv, &ahcd->pending, pending) {
- struct urb *urb = priv->td[0]->urb;
- struct ed *ed = priv->ed;
-
- switch (ed->state) {
- case ED_OPER:
- ed->state = ED_UNLINK;
- ed->hwINFO |= cpu_to_hc32(ahcd, ED_DEQUEUE);
- ed_deschedule (ahcd, ed);
-
- ed->ed_next = ahcd->ed_rm_list;
- ed->ed_prev = NULL;
- ahcd->ed_rm_list = ed;
- /* FALLTHROUGH */
- case ED_UNLINK:
- break;
- default:
- admhc_dbg(ahcd, "bogus ed %p state %d\n",
- ed, ed->state);
- }
-
- if (!urb->unlinked)
- urb->unlinked = -ESHUTDOWN;
- }
- finish_unlinks(ahcd, 0);
- spin_unlock_irq(&ahcd->lock);
-
- /* paranoia, in case that didn't work: */
-
- /* empty the interrupt branches */
- for (i = 0; i < NUM_INTS; i++) ahcd->load[i] = 0;
- for (i = 0; i < NUM_INTS; i++) ahcd->hcca->int_table[i] = 0;
-
- /* no EDs to remove */
- ahcd->ed_rm_list = NULL;
-
- /* empty control and bulk lists */
- ahcd->ed_controltail = NULL;
- ahcd->ed_bulktail = NULL;
-
- if ((temp = admhc_run(ahcd)) < 0) {
- admhc_err(ahcd, "can't restart, %d\n", temp);
- return temp;
- } else {
- /* here we "know" root ports should always stay powered,
- * and that if we try to turn them back on the root hub
- * will respond to CSC processing.
- */
- i = ahcd->num_ports;
- while (i--)
- admhc_writel(ahcd, RH_PS_PSS,
- &ahcd->regs->portstatus[i]);
- admhc_dbg(ahcd, "restart complete\n");
- }
- return 0;
-}
-
-#else /* CONFIG_PM */
-
-static inline int admhc_rh_resume(struct admhcd *ahcd)
-{
- return 0;
-}
-
-/* Carry out polling-related state changes.
- * autostop isn't used when CONFIG_PM is turned off.
- */
-static int admhc_root_hub_state_changes(struct admhcd *ahcd, int changed,
- int any_connected)
-{
- /* If INSM is enabled, don't poll */
- if (admhc_readl(ahcd, &ahcd->regs->int_enable) & ADMHC_INTR_INSM)
- return 0;
-
- /* If no status changes are pending, enable status-change interrupts */
- if (!changed) {
- admhc_intr_enable(ahcd, ADMHC_INTR_INSM);
- return 0;
- }
-
- return 1;
-}
-
-#endif /* CONFIG_PM */
-
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/usb/host/ohci-q.c
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-#include <linux/irq.h>
-#include <linux/slab.h>
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * URB goes back to driver, and isn't reissued.
- * It's completely gone from HC data structures.
- * PRECONDITION: ahcd lock held, irqs blocked.
- */
-static void
-finish_urb(struct admhcd *ahcd, struct urb *urb, int status)
-__releases(ahcd->lock)
-__acquires(ahcd->lock)
-{
- urb_priv_free(ahcd, urb->hcpriv);
-
- if (likely(status == -EINPROGRESS))
- status = 0;
-
- switch (usb_pipetype(urb->pipe)) {
- case PIPE_ISOCHRONOUS:
- admhcd_to_hcd(ahcd)->self.bandwidth_isoc_reqs--;
- break;
- case PIPE_INTERRUPT:
- admhcd_to_hcd(ahcd)->self.bandwidth_int_reqs--;
- break;
- }
-
-#ifdef ADMHC_VERBOSE_DEBUG
- urb_print(ahcd, urb, "RET", usb_pipeout(urb->pipe), status);
-#endif
-
- /* urb->complete() can reenter this HCD */
- usb_hcd_unlink_urb_from_ep(admhcd_to_hcd(ahcd), urb);
- spin_unlock(&ahcd->lock);
- usb_hcd_giveback_urb(admhcd_to_hcd(ahcd), urb, status);
- spin_lock(&ahcd->lock);
-}
-
-
-/*-------------------------------------------------------------------------*
- * ED handling functions
- *-------------------------------------------------------------------------*/
-
-#if 0 /* FIXME */
-/* search for the right schedule branch to use for a periodic ed.
- * does some load balancing; returns the branch, or negative errno.
- */
-static int balance(struct admhcd *ahcd, int interval, int load)
-{
- int i, branch = -ENOSPC;
-
- /* iso periods can be huge; iso tds specify frame numbers */
- if (interval > NUM_INTS)
- interval = NUM_INTS;
-
- /* search for the least loaded schedule branch of that period
- * that has enough bandwidth left unreserved.
- */
- for (i = 0; i < interval ; i++) {
- if (branch < 0 || ahcd->load[branch] > ahcd->load[i]) {
- int j;
-
- /* usb 1.1 says 90% of one frame */
- for (j = i; j < NUM_INTS; j += interval) {
- if ((ahcd->load[j] + load) > 900)
- break;
- }
- if (j < NUM_INTS)
- continue;
- branch = i;
- }
- }
- return branch;
-}
-#endif
-
-/*-------------------------------------------------------------------------*/
-
-#if 0 /* FIXME */
-/* both iso and interrupt requests have periods; this routine puts them
- * into the schedule tree in the apppropriate place. most iso devices use
- * 1msec periods, but that's not required.
- */
-static void periodic_link(struct admhcd *ahcd, struct ed *ed)
-{
- unsigned i;
-
- admhc_vdbg(ahcd, "link %sed %p branch %d [%dus.], interval %d\n",
- (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "",
- ed, ed->branch, ed->load, ed->interval);
-
- for (i = ed->branch; i < NUM_INTS; i += ed->interval) {
- struct ed **prev = &ahcd->periodic[i];
- __hc32 *prev_p = &ahcd->hcca->int_table[i];
- struct ed *here = *prev;
-
- /* sorting each branch by period (slow before fast)
- * lets us share the faster parts of the tree.
- * (plus maybe: put interrupt eds before iso)
- */
- while (here && ed != here) {
- if (ed->interval > here->interval)
- break;
- prev = &here->ed_next;
- prev_p = &here->hwNextED;
- here = *prev;
- }
- if (ed != here) {
- ed->ed_next = here;
- if (here)
- ed->hwNextED = *prev_p;
- wmb();
- *prev = ed;
- *prev_p = cpu_to_hc32(ahcd, ed->dma);
- wmb();
- }
- ahcd->load[i] += ed->load;
- }
- admhcd_to_hcd(ahcd)->self.bandwidth_allocated += ed->load / ed->interval;
-}
-#endif
-
-/* link an ed into the HC chain */
-
-static int ed_schedule(struct admhcd *ahcd, struct ed *ed)
-{
- struct ed *old_tail;
-
- if (admhcd_to_hcd(ahcd)->state == HC_STATE_QUIESCING)
- return -EAGAIN;
-
- ed->state = ED_OPER;
-
- old_tail = ahcd->ed_tails[ed->type];
-
- ed->ed_next = old_tail->ed_next;
- if (ed->ed_next) {
- ed->ed_next->ed_prev = ed;
- ed->hwNextED = cpu_to_hc32(ahcd, ed->ed_next->dma);
- }
- ed->ed_prev = old_tail;
-
- old_tail->ed_next = ed;
- old_tail->hwNextED = cpu_to_hc32(ahcd, ed->dma);
-
- ahcd->ed_tails[ed->type] = ed;
-
- admhc_dma_enable(ahcd);
-
- return 0;
-}
-
-/*-------------------------------------------------------------------------*/
-
-#if 0 /* FIXME */
-/* scan the periodic table to find and unlink this ED */
-static void periodic_unlink(struct admhcd *ahcd, struct ed *ed)
-{
- int i;
-
- for (i = ed->branch; i < NUM_INTS; i += ed->interval) {
- struct ed *temp;
- struct ed **prev = &ahcd->periodic[i];
- __hc32 *prev_p = &ahcd->hcca->int_table[i];
-
- while (*prev && (temp = *prev) != ed) {
- prev_p = &temp->hwNextED;
- prev = &temp->ed_next;
- }
- if (*prev) {
- *prev_p = ed->hwNextED;
- *prev = ed->ed_next;
- }
- ahcd->load[i] -= ed->load;
- }
-
- admhcd_to_hcd(ahcd)->self.bandwidth_allocated -= ed->load / ed->interval;
- admhc_vdbg(ahcd, "unlink %sed %p branch %d [%dus.], interval %d\n",
- (ed->hwINFO & cpu_to_hc32(ahcd, ED_ISO)) ? "iso " : "",
- ed, ed->branch, ed->load, ed->interval);
-}
-#endif
-
-/* unlink an ed from the HC chain.
- * just the link to the ed is unlinked.
- * the link from the ed still points to another operational ed or 0
- * so the HC can eventually finish the processing of the unlinked ed
- * (assuming it already started that, which needn't be true).
- *
- * ED_UNLINK is a transient state: the HC may still see this ED, but soon
- * it won't. ED_SKIP means the HC will finish its current transaction,
- * but won't start anything new. The TD queue may still grow; device
- * drivers don't know about this HCD-internal state.
- *
- * When the HC can't see the ED, something changes ED_UNLINK to one of:
- *
- * - ED_OPER: when there's any request queued, the ED gets rescheduled
- * immediately. HC should be working on them.
- *
- * - ED_IDLE: when there's no TD queue. there's no reason for the HC
- * to care about this ED; safe to disable the endpoint.
- *
- * When finish_unlinks() runs later, after SOF interrupt, it will often
- * complete one or more URB unlinks before making that state change.
- */
-static void ed_deschedule(struct admhcd *ahcd, struct ed *ed)
-{
-
-#ifdef ADMHC_VERBOSE_DEBUG
- admhc_dump_ed(ahcd, "ED-DESCHED", ed, 1);
-#endif
-
- ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP);
- wmb();
- ed->state = ED_UNLINK;
-
- /* remove this ED from the HC list */
- ed->ed_prev->hwNextED = ed->hwNextED;
-
- /* and remove it from our list also */
- ed->ed_prev->ed_next = ed->ed_next;
-
- if (ed->ed_next)
- ed->ed_next->ed_prev = ed->ed_prev;
-
- if (ahcd->ed_tails[ed->type] == ed)
- ahcd->ed_tails[ed->type] = ed->ed_prev;
-}
-
-/*-------------------------------------------------------------------------*/
-
-static struct ed *ed_create(struct admhcd *ahcd, unsigned int type, u32 info)
-{
- struct ed *ed;
- struct td *td;
-
- ed = ed_alloc(ahcd, GFP_ATOMIC);
- if (!ed)
- goto err;
-
- /* dummy td; end of td list for this ed */
- td = td_alloc(ahcd, GFP_ATOMIC);
- if (!td)
- goto err_free_ed;
-
- switch (type) {
- case PIPE_INTERRUPT:
- info |= ED_INT;
- break;
- case PIPE_ISOCHRONOUS:
- info |= ED_ISO;
- break;
- }
-
- ed->dummy = td;
- ed->state = ED_IDLE;
- ed->type = type;
-
- ed->hwINFO = cpu_to_hc32(ahcd, info);
- ed->hwTailP = cpu_to_hc32(ahcd, td->td_dma);
- ed->hwHeadP = ed->hwTailP; /* ED_C, ED_H zeroed */
-
- return ed;
-
-err_free_ed:
- ed_free(ahcd, ed);
-err:
- return NULL;
-}
-
-/* get and maybe (re)init an endpoint. init _should_ be done only as part
- * of enumeration, usb_set_configuration() or usb_set_interface().
- */
-static struct ed *ed_get(struct admhcd *ahcd, struct usb_host_endpoint *ep,
- struct usb_device *udev, unsigned int pipe, int interval)
-{
- struct ed *ed;
- unsigned long flags;
-
- spin_lock_irqsave(&ahcd->lock, flags);
-
- ed = ep->hcpriv;
- if (!ed) {
- u32 info;
-
- /* FIXME: usbcore changes dev->devnum before SET_ADDRESS
- * succeeds ... otherwise we wouldn't need "pipe".
- */
- info = usb_pipedevice(pipe);
- info |= (ep->desc.bEndpointAddress & ~USB_DIR_IN) << ED_EN_SHIFT;
- info |= le16_to_cpu(ep->desc.wMaxPacketSize) << ED_MPS_SHIFT;
- if (udev->speed == USB_SPEED_FULL)
- info |= ED_SPEED_FULL;
-
- ed = ed_create(ahcd, usb_pipetype(pipe), info);
- if (ed)
- ep->hcpriv = ed;
- }
-
- spin_unlock_irqrestore(&ahcd->lock, flags);
-
- return ed;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* request unlinking of an endpoint from an operational HC.
- * put the ep on the rm_list
- * real work is done at the next start frame (SOFI) hardware interrupt
- * caller guarantees HCD is running, so hardware access is safe,
- * and that ed->state is ED_OPER
- */
-static void start_ed_unlink(struct admhcd *ahcd, struct ed *ed)
-{
-
-#ifdef ADMHC_VERBOSE_DEBUG
- admhc_dump_ed(ahcd, "ED-UNLINK", ed, 1);
-#endif
-
- ed->hwINFO |= cpu_to_hc32(ahcd, ED_DEQUEUE);
- ed_deschedule(ahcd, ed);
-
- /* add this ED into the remove list */
- ed->ed_rm_next = ahcd->ed_rm_list;
- ahcd->ed_rm_list = ed;
-
- /* enable SOF interrupt */
- admhc_intr_ack(ahcd, ADMHC_INTR_SOFI);
- admhc_intr_enable(ahcd, ADMHC_INTR_SOFI);
- /* flush those writes */
- admhc_writel_flush(ahcd);
-
- /* SOF interrupt might get delayed; record the frame counter value that
- * indicates when the HC isn't looking at it, so concurrent unlinks
- * behave. frame_no wraps every 2^16 msec, and changes right before
- * SOF is triggered.
- */
- ed->tick = admhc_frame_no(ahcd) + 1;
-}
-
-/*-------------------------------------------------------------------------*
- * TD handling functions
- *-------------------------------------------------------------------------*/
-
-/* enqueue next TD for this URB (OHCI spec 5.2.8.2) */
-
-static void
-td_fill(struct admhcd *ahcd, u32 info, dma_addr_t data, int len,
- struct urb *urb, int index)
-{
- struct td *td, *td_pt;
- struct urb_priv *urb_priv = urb->hcpriv;
- int hash;
- u32 cbl = 0;
-
-#if 1
- if (index == (urb_priv->td_cnt - 1) &&
- ((urb->transfer_flags & URB_NO_INTERRUPT) == 0))
- cbl |= TD_IE;
-#else
- if (index == (urb_priv->td_cnt - 1))
- cbl |= TD_IE;
-#endif
-
- /* use this td as the next dummy */
- td_pt = urb_priv->td[index];
-
- /* fill the old dummy TD */
- td = urb_priv->td[index] = urb_priv->ed->dummy;
- urb_priv->ed->dummy = td_pt;
-
- td->ed = urb_priv->ed;
- td->next_dl_td = NULL;
- td->index = index;
- td->urb = urb;
- td->data_dma = data;
- if (!len)
- data = 0;
-
- if (data)
- cbl |= (len & TD_BL_MASK);
-
- info |= TD_OWN;
-
- /* setup hardware specific fields */
- td->hwINFO = cpu_to_hc32(ahcd, info);
- td->hwDBP = cpu_to_hc32(ahcd, data);
- td->hwCBL = cpu_to_hc32(ahcd, cbl);
- td->hwNextTD = cpu_to_hc32(ahcd, td_pt->td_dma);
-
- /* append to queue */
- list_add_tail(&td->td_list, &td->ed->td_list);
-
- /* hash it for later reverse mapping */
- hash = TD_HASH_FUNC(td->td_dma);
- td->td_hash = ahcd->td_hash[hash];
- ahcd->td_hash[hash] = td;
-
- /* HC might read the TD (or cachelines) right away ... */
- wmb();
- td->ed->hwTailP = td->hwNextTD;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* Prepare all TDs of a transfer, and queue them onto the ED.
- * Caller guarantees HC is active.
- * Usually the ED is already on the schedule, so TDs might be
- * processed as soon as they're queued.
- */
-static void td_submit_urb(struct admhcd *ahcd, struct urb *urb)
-{
- struct urb_priv *urb_priv = urb->hcpriv;
- dma_addr_t data;
- int data_len = urb->transfer_buffer_length;
- int cnt = 0;
- u32 info = 0;
- int is_out = usb_pipeout(urb->pipe);
- u32 toggle = 0;
-
- /* OHCI handles the bulk/interrupt data toggles itself. We just
- * use the device toggle bits for resetting, and rely on the fact
- * that resetting toggle is meaningless if the endpoint is active.
- */
-
- if (usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe), is_out)) {
- toggle = TD_T_CARRY;
- } else {
- toggle = TD_T_DATA0;
- usb_settoggle(urb->dev, usb_pipeendpoint (urb->pipe),
- is_out, 1);
- }
-
- urb_priv->td_idx = 0;
- list_add(&urb_priv->pending, &ahcd->pending);
-
- if (data_len)
- data = urb->transfer_dma;
- else
- data = 0;
-
- /* NOTE: TD_CC is set so we can tell which TDs the HC processed by
- * using TD_CC_GET, as well as by seeing them on the done list.
- * (CC = NotAccessed ... 0x0F, or 0x0E in PSWs for ISO.)
- */
- switch (urb_priv->ed->type) {
- case PIPE_INTERRUPT:
- info = is_out
- ? TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_OUT
- : TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_IN;
-
- /* setup service interval and starting frame number */
- info |= (urb->start_frame & TD_FN_MASK);
- info |= (urb->interval & TD_ISI_MASK) << TD_ISI_SHIFT;
-
- td_fill(ahcd, info, data, data_len, urb, cnt);
- cnt++;
-
- admhcd_to_hcd(ahcd)->self.bandwidth_int_reqs++;
- break;
-
- case PIPE_BULK:
- info = is_out
- ? TD_SCC_NOTACCESSED | TD_DP_OUT
- : TD_SCC_NOTACCESSED | TD_DP_IN;
-
- /* TDs _could_ transfer up to 8K each */
- while (data_len > TD_DATALEN_MAX) {
- td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle),
- data, TD_DATALEN_MAX, urb, cnt);
- data += TD_DATALEN_MAX;
- data_len -= TD_DATALEN_MAX;
- cnt++;
- }
-
- td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle), data,
- data_len, urb, cnt);
- cnt++;
-
- if ((urb->transfer_flags & URB_ZERO_PACKET)
- && (cnt < urb_priv->td_cnt)) {
- td_fill(ahcd, info | ((cnt) ? TD_T_CARRY : toggle),
- 0, 0, urb, cnt);
- cnt++;
- }
- break;
-
- /* control manages DATA0/DATA1 toggle per-request; SETUP resets it,
- * any DATA phase works normally, and the STATUS ack is special.
- */
- case PIPE_CONTROL:
- /* fill a TD for the setup */
- info = TD_SCC_NOTACCESSED | TD_DP_SETUP | TD_T_DATA0;
- td_fill(ahcd, info, urb->setup_dma, 8, urb, cnt++);
-
- if (data_len > 0) {
- /* fill a TD for the data */
- info = TD_SCC_NOTACCESSED | TD_T_DATA1;
- info |= is_out ? TD_DP_OUT : TD_DP_IN;
- /* NOTE: mishandles transfers >8K, some >4K */
- td_fill(ahcd, info, data, data_len, urb, cnt++);
- }
-
- /* fill a TD for the ACK */
- info = (is_out || data_len == 0)
- ? TD_SCC_NOTACCESSED | TD_DP_IN | TD_T_DATA1
- : TD_SCC_NOTACCESSED | TD_DP_OUT | TD_T_DATA1;
- td_fill(ahcd, info, data, 0, urb, cnt++);
-
- break;
-
- /* ISO has no retransmit, so no toggle;
- * Each TD could handle multiple consecutive frames (interval 1);
- * we could often reduce the number of TDs here.
- */
- case PIPE_ISOCHRONOUS:
- info = is_out
- ? TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_OUT
- : TD_T_CARRY | TD_SCC_NOTACCESSED | TD_DP_IN;
-
- for (cnt = 0; cnt < urb->number_of_packets; cnt++) {
- int frame = urb->start_frame;
-
- frame += cnt * urb->interval;
- frame &= TD_FN_MASK;
- td_fill(ahcd, info | frame,
- data + urb->iso_frame_desc[cnt].offset,
- urb->iso_frame_desc[cnt].length, urb, cnt);
- }
- admhcd_to_hcd(ahcd)->self.bandwidth_isoc_reqs++;
- break;
- }
-
- if (urb_priv->td_cnt != cnt)
- admhc_err(ahcd, "bad number of tds created for urb %p\n", urb);
-}
-
-/*-------------------------------------------------------------------------*
- * Done List handling functions
- *-------------------------------------------------------------------------*/
-
-/* calculate transfer length/status and update the urb */
-static int td_done(struct admhcd *ahcd, struct urb *urb, struct td *td)
-{
- struct urb_priv *urb_priv = urb->hcpriv;
- u32 info;
- u32 bl;
- u32 tdDBP;
- int type = usb_pipetype(urb->pipe);
- int cc;
- int status = -EINPROGRESS;
-
- info = hc32_to_cpup(ahcd, &td->hwINFO);
- tdDBP = hc32_to_cpup(ahcd, &td->hwDBP);
- bl = TD_BL_GET(hc32_to_cpup(ahcd, &td->hwCBL));
- cc = TD_CC_GET(info);
-
- /* ISO ... drivers see per-TD length/status */
- if (type == PIPE_ISOCHRONOUS) {
- /* TODO */
- int dlen = 0;
-
- /* NOTE: assumes FC in tdINFO == 0, and that
- * only the first of 0..MAXPSW psws is used.
- */
- if (info & TD_CC) /* hc didn't touch? */
- return status;
-
- if (usb_pipeout(urb->pipe))
- dlen = urb->iso_frame_desc[td->index].length;
- else {
- /* short reads are always OK for ISO */
- if (cc == TD_CC_DATAUNDERRUN)
- cc = TD_CC_NOERROR;
- dlen = tdDBP - td->data_dma + bl;
- }
-
- urb->actual_length += dlen;
- urb->iso_frame_desc[td->index].actual_length = dlen;
- urb->iso_frame_desc[td->index].status = cc_to_error[cc];
-
- if (cc != TD_CC_NOERROR)
- admhc_vdbg(ahcd,
- "urb %p iso td %p (%d) len %d cc %d\n",
- urb, td, 1 + td->index, dlen, cc);
-
- /* BULK, INT, CONTROL ... drivers see aggregate length/status,
- * except that "setup" bytes aren't counted and "short" transfers
- * might not be reported as errors.
- */
- } else {
- /* update packet status if needed (short is normally ok) */
- if (cc == TD_CC_DATAUNDERRUN
- && !(urb->transfer_flags & URB_SHORT_NOT_OK))
- cc = TD_CC_NOERROR;
-
- if (cc != TD_CC_NOERROR && cc < TD_CC_HCD0)
- status = cc_to_error[cc];
-
-
- /* count all non-empty packets except control SETUP packet */
- if ((type != PIPE_CONTROL || td->index != 0) && tdDBP != 0)
- urb->actual_length += tdDBP - td->data_dma + bl;
-
- if (cc != TD_CC_NOERROR && cc < TD_CC_HCD0)
- admhc_vdbg(ahcd,
- "urb %p td %p (%d) cc %d, len=%d/%d\n",
- urb, td, td->index, cc,
- urb->actual_length,
- urb->transfer_buffer_length);
- }
-
- list_del(&td->td_list);
- urb_priv->td_idx++;
-
- return status;
-}
-
-/*-------------------------------------------------------------------------*/
-
-static void ed_halted(struct admhcd *ahcd, struct td *td, int cc)
-{
- struct urb *urb = td->urb;
- struct urb_priv *urb_priv = urb->hcpriv;
- struct ed *ed = td->ed;
- struct list_head *tmp = td->td_list.next;
- __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C);
-
- admhc_dump_ed(ahcd, "ed halted", td->ed, 1);
- /* clear ed halt; this is the td that caused it, but keep it inactive
- * until its urb->complete() has a chance to clean up.
- */
- ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP);
- wmb();
- ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H);
-
- /* Get rid of all later tds from this urb. We don't have
- * to be careful: no errors and nothing was transferred.
- * Also patch the ed so it looks as if those tds completed normally.
- */
- while (tmp != &ed->td_list) {
- struct td *next;
-
- next = list_entry(tmp, struct td, td_list);
- tmp = next->td_list.next;
-
- if (next->urb != urb)
- break;
-
- /* NOTE: if multi-td control DATA segments get supported,
- * this urb had one of them, this td wasn't the last td
- * in that segment (TD_R clear), this ed halted because
- * of a short read, _and_ URB_SHORT_NOT_OK is clear ...
- * then we need to leave the control STATUS packet queued
- * and clear ED_SKIP.
- */
- list_del(&next->td_list);
- urb_priv->td_cnt++;
- ed->hwHeadP = next->hwNextTD | toggle;
- }
-
- /* help for troubleshooting: report anything that
- * looks odd ... that doesn't include protocol stalls
- * (or maybe some other things)
- */
- switch (cc) {
- case TD_CC_DATAUNDERRUN:
- if ((urb->transfer_flags & URB_SHORT_NOT_OK) == 0)
- break;
- /* fallthrough */
- case TD_CC_STALL:
- if (usb_pipecontrol(urb->pipe))
- break;
- /* fallthrough */
- default:
- admhc_dbg(ahcd,
- "urb %p path %s ep%d%s %08x cc %d --> status %d\n",
- urb, urb->dev->devpath,
- usb_pipeendpoint (urb->pipe),
- usb_pipein(urb->pipe) ? "in" : "out",
- hc32_to_cpu(ahcd, td->hwINFO),
- cc, cc_to_error[cc]);
- }
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* there are some urbs/eds to unlink; called in_irq(), with HCD locked */
-static void
-finish_unlinks(struct admhcd *ahcd, u16 tick)
-{
- struct ed *ed, **last;
-
-rescan_all:
- for (last = &ahcd->ed_rm_list, ed = *last; ed != NULL; ed = *last) {
- struct list_head *entry, *tmp;
- int completed, modified;
- __hc32 *prev;
-
- /* only take off EDs that the HC isn't using, accounting for
- * frame counter wraps and EDs with partially retired TDs
- */
- if (likely(HC_IS_RUNNING(admhcd_to_hcd(ahcd)->state))) {
- if (tick_before(tick, ed->tick)) {
-skip_ed:
- last = &ed->ed_rm_next;
- continue;
- }
-#if 0
- if (!list_empty(&ed->td_list)) {
- struct td *td;
- u32 head;
-
- td = list_entry(ed->td_list.next, struct td,
- td_list);
- head = hc32_to_cpu(ahcd, ed->hwHeadP) &
- TD_MASK;
-
- /* INTR_WDH may need to clean up first */
- if (td->td_dma != head)
- goto skip_ed;
- }
-#endif
- }
-
- /* reentrancy: if we drop the schedule lock, someone might
- * have modified this list. normally it's just prepending
- * entries (which we'd ignore), but paranoia won't hurt.
- */
- *last = ed->ed_rm_next;
- ed->ed_rm_next = NULL;
- modified = 0;
-
- /* unlink urbs as requested, but rescan the list after
- * we call a completion since it might have unlinked
- * another (earlier) urb
- *
- * When we get here, the HC doesn't see this ed. But it
- * must not be rescheduled until all completed URBs have
- * been given back to the driver.
- */
-rescan_this:
- completed = 0;
- prev = &ed->hwHeadP;
- list_for_each_safe(entry, tmp, &ed->td_list) {
- struct td *td;
- struct urb *urb;
- struct urb_priv *urb_priv;
- __hc32 savebits;
- u32 tdINFO;
- int status;
-
- td = list_entry(entry, struct td, td_list);
- urb = td->urb;
- urb_priv = td->urb->hcpriv;
-
- if (!urb->unlinked) {
- prev = &td->hwNextTD;
- continue;
- }
-
- if ((urb_priv) == NULL)
- continue;
-
- /* patch pointer hc uses */
- savebits = *prev & ~cpu_to_hc32(ahcd, TD_MASK);
- *prev = td->hwNextTD | savebits;
- /* If this was unlinked, the TD may not have been
- * retired ... so manually save dhe data toggle.
- * The controller ignores the value we save for
- * control and ISO endpoints.
- */
- tdINFO = hc32_to_cpup(ahcd, &td->hwINFO);
- if ((tdINFO & TD_T) == TD_T_DATA0)
- ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_C);
- else if ((tdINFO & TD_T) == TD_T_DATA1)
- ed->hwHeadP |= cpu_to_hc32(ahcd, ED_C);
-
- /* HC may have partly processed this TD */
-#ifdef ADMHC_VERBOSE_DEBUG
- urb_print(ahcd, urb, "PARTIAL", 0);
-#endif
- status = td_done(ahcd, urb, td);
-
- /* if URB is done, clean up */
- if (urb_priv->td_idx == urb_priv->td_cnt) {
- modified = completed = 1;
- finish_urb(ahcd, urb, status);
- }
- }
- if (completed && !list_empty(&ed->td_list))
- goto rescan_this;
-
- /* ED's now officially unlinked, hc doesn't see */
- ed->state = ED_IDLE;
- ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H);
- ed->hwNextED = 0;
- wmb();
- ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP | ED_DEQUEUE);
-
- /* but if there's work queued, reschedule */
- if (!list_empty(&ed->td_list)) {
- if (HC_IS_RUNNING(admhcd_to_hcd(ahcd)->state))
- ed_schedule(ahcd, ed);
- }
-
- if (modified)
- goto rescan_all;
- }
-}
-
-/*-------------------------------------------------------------------------*/
-/*
- * Process normal completions (error or success) and clean the schedules.
- *
- * This is the main path for handing urbs back to drivers. The only other
- * normal path is finish_unlinks(), which unlinks URBs using ed_rm_list,
- * instead of scanning the (re-reversed) donelist as this does.
- */
-
-static void ed_unhalt(struct admhcd *ahcd, struct ed *ed, struct urb *urb)
-{
- struct list_head *entry, *tmp;
- __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C);
-
-#ifdef ADMHC_VERBOSE_DEBUG
- admhc_dump_ed(ahcd, "UNHALT", ed, 0);
-#endif
- /* clear ed halt; this is the td that caused it, but keep it inactive
- * until its urb->complete() has a chance to clean up.
- */
- ed->hwINFO |= cpu_to_hc32(ahcd, ED_SKIP);
- wmb();
- ed->hwHeadP &= ~cpu_to_hc32(ahcd, ED_H);
-
- list_for_each_safe(entry, tmp, &ed->td_list) {
- struct td *td = list_entry(entry, struct td, td_list);
- __hc32 info;
-
- if (td->urb != urb)
- break;
-
- info = td->hwINFO;
- info &= ~cpu_to_hc32(ahcd, TD_CC | TD_OWN);
- td->hwINFO = info;
-
- ed->hwHeadP = td->hwNextTD | toggle;
- wmb();
- }
-
-}
-
-static void ed_intr_refill(struct admhcd *ahcd, struct ed *ed)
-{
- __hc32 toggle = ed->hwHeadP & cpu_to_hc32(ahcd, ED_C);
-
- ed->hwHeadP = ed->hwTailP | toggle;
-}
-
-
-static inline int is_ed_halted(struct admhcd *ahcd, struct ed *ed)
-{
- return ((hc32_to_cpup(ahcd, &ed->hwHeadP) & ED_H) == ED_H);
-}
-
-static inline int is_td_halted(struct admhcd *ahcd, struct ed *ed,
- struct td *td)
-{
- return ((hc32_to_cpup(ahcd, &ed->hwHeadP) & TD_MASK) ==
- (hc32_to_cpup(ahcd, &td->hwNextTD) & TD_MASK));
-}
-
-static void ed_update(struct admhcd *ahcd, struct ed *ed)
-{
- struct list_head *entry, *tmp;
-
-#ifdef ADMHC_VERBOSE_DEBUG
- admhc_dump_ed(ahcd, "UPDATE", ed, 1);
-#endif
-
- list_for_each_safe(entry, tmp, &ed->td_list) {
- struct td *td = list_entry(entry, struct td, td_list);
- struct urb *urb = td->urb;
- struct urb_priv *urb_priv = urb->hcpriv;
- int status;
-
- if (hc32_to_cpup(ahcd, &td->hwINFO) & TD_OWN)
- break;
-
- /* update URB's length and status from TD */
- status = td_done(ahcd, urb, td);
- if (is_ed_halted(ahcd, ed) && is_td_halted(ahcd, ed, td))
- ed_unhalt(ahcd, ed, urb);
-
- if (ed->type == PIPE_INTERRUPT)
- ed_intr_refill(ahcd, ed);
-
- /* If all this urb's TDs are done, call complete() */
- if (urb_priv->td_idx == urb_priv->td_cnt)
- finish_urb(ahcd, urb, status);
-
- /* clean schedule: unlink EDs that are no longer busy */
- if (list_empty(&ed->td_list)) {
- if (ed->state == ED_OPER)
- start_ed_unlink(ahcd, ed);
-
- /* ... reenabling halted EDs only after fault cleanup */
- } else if ((ed->hwINFO & cpu_to_hc32(ahcd,
- ED_SKIP | ED_DEQUEUE))
- == cpu_to_hc32(ahcd, ED_SKIP)) {
- td = list_entry(ed->td_list.next, struct td, td_list);
-#if 0
- if (!(td->hwINFO & cpu_to_hc32(ahcd, TD_DONE))) {
- ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP);
- /* ... hc may need waking-up */
- switch (ed->type) {
- case PIPE_CONTROL:
- admhc_writel(ahcd, OHCI_CLF,
- &ahcd->regs->cmdstatus);
- break;
- case PIPE_BULK:
- admhc_writel(ahcd, OHCI_BLF,
- &ahcd->regs->cmdstatus);
- break;
- }
- }
-#else
- if ((td->hwINFO & cpu_to_hc32(ahcd, TD_OWN)))
- ed->hwINFO &= ~cpu_to_hc32(ahcd, ED_SKIP);
-#endif
- }
-
- }
-}
-
-/* there are some tds completed; called in_irq(), with HCD locked */
-static void admhc_td_complete(struct admhcd *ahcd)
-{
- struct ed *ed;
-
- for (ed = ahcd->ed_head; ed; ed = ed->ed_next) {
- if (ed->state != ED_OPER)
- continue;
-
- ed_update(ahcd, ed);
- }
-}
+++ /dev/null
-/*
- * ADM5120 HCD (Host Controller Driver) for USB
- *
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This file was derived from: drivers/usb/host/ohci.h
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
- */
-
-/*
- * __hc32 and __hc16 are "Host Controller" types, they may be equivalent to
- * __leXX (normally) or __beXX (given OHCI_BIG_ENDIAN), depending on the
- * host controller implementation.
- */
-typedef __u32 __bitwise __hc32;
-typedef __u16 __bitwise __hc16;
-
-/*
- * OHCI Endpoint Descriptor (ED) ... holds TD queue
- * See OHCI spec, section 4.2
- *
- * This is a "Queue Head" for those transfers, which is why
- * both EHCI and UHCI call similar structures a "QH".
- */
-
-#define TD_DATALEN_MAX 4096
-
-#define ED_ALIGN 16
-#define ED_MASK ((u32)~(ED_ALIGN-1)) /* strip hw status in low addr bits */
-
-struct ed {
- /* first fields are hardware-specified */
- __hc32 hwINFO; /* endpoint config bitmap */
- /* info bits defined by hcd */
-#define ED_DEQUEUE (1 << 27)
- /* info bits defined by the hardware */
-#define ED_MPS_SHIFT 16
-#define ED_MPS_MASK ((1 << 11)-1)
-#define ED_MPS_GET(x) (((x) >> ED_MPS_SHIFT) & ED_MPS_MASK)
-#define ED_ISO (1 << 15) /* isochronous endpoint */
-#define ED_SKIP (1 << 14)
-#define ED_SPEED_FULL (1 << 13) /* fullspeed device */
-#define ED_INT (1 << 11) /* interrupt endpoint */
-#define ED_EN_SHIFT 7 /* endpoint shift */
-#define ED_EN_MASK ((1 << 4)-1) /* endpoint mask */
-#define ED_EN_GET(x) (((x) >> ED_EN_SHIFT) & ED_EN_MASK)
-#define ED_FA_MASK ((1 << 7)-1) /* function address mask */
-#define ED_FA_GET(x) ((x) & ED_FA_MASK)
- __hc32 hwTailP; /* tail of TD list */
- __hc32 hwHeadP; /* head of TD list (hc r/w) */
-#define ED_C (0x02) /* toggle carry */
-#define ED_H (0x01) /* halted */
- __hc32 hwNextED; /* next ED in list */
-
- /* rest are purely for the driver's use */
- dma_addr_t dma; /* addr of ED */
- struct td *dummy; /* next TD to activate */
-
- struct list_head urb_list; /* list of our URBs */
-
- /* host's view of schedule */
- struct ed *ed_next; /* on schedule list */
- struct ed *ed_prev; /* for non-interrupt EDs */
- struct ed *ed_rm_next; /* on rm list */
- struct list_head td_list; /* "shadow list" of our TDs */
-
- /* create --> IDLE --> OPER --> ... --> IDLE --> destroy
- * usually: OPER --> UNLINK --> (IDLE | OPER) --> ...
- */
- u8 state; /* ED_{IDLE,UNLINK,OPER} */
-#define ED_IDLE 0x00 /* NOT linked to HC */
-#define ED_UNLINK 0x01 /* being unlinked from hc */
-#define ED_OPER 0x02 /* IS linked to hc */
-
- u8 type; /* PIPE_{BULK,...} */
-
- /* periodic scheduling params (for intr and iso) */
- u8 branch;
- u16 interval;
- u16 load;
- u16 last_iso; /* iso only */
-
- /* HC may see EDs on rm_list until next frame (frame_no == tick) */
- u16 tick;
-} __attribute__ ((aligned(ED_ALIGN)));
-
-/*
- * OHCI Transfer Descriptor (TD) ... one per transfer segment
- * See OHCI spec, sections 4.3.1 (general = control/bulk/interrupt)
- * and 4.3.2 (iso)
- */
-
-#define TD_ALIGN 32
-#define TD_MASK ((u32)~(TD_ALIGN-1)) /* strip hw status in low addr bits */
-
-struct td {
- /* first fields are hardware-specified */
- __hc32 hwINFO; /* transfer info bitmask */
-
- /* hwINFO bits */
-#define TD_OWN (1 << 31) /* owner of the descriptor */
-#define TD_CC_SHIFT 27 /* condition code */
-#define TD_CC_MASK 0xf
-#define TD_CC (TD_CC_MASK << TD_CC_SHIFT)
-#define TD_CC_GET(x) (((x) >> TD_CC_SHIFT) & TD_CC_MASK)
-
-#define TD_EC_SHIFT 25 /* error count */
-#define TD_EC_MASK 0x3
-#define TD_EC (TD_EC_MASK << TD_EC_SHIFT)
-#define TD_EC_GET(x) ((x >> TD_EC_SHIFT) & TD_EC_MASK)
-#define TD_T_SHIFT 23 /* data toggle state */
-#define TD_T_MASK 0x3
-#define TD_T (TD_T_MASK << TD_T_SHIFT)
-#define TD_T_DATA0 (0x2 << TD_T_SHIFT) /* DATA0 */
-#define TD_T_DATA1 (0x3 << TD_T_SHIFT) /* DATA1 */
-#define TD_T_CARRY (0x0 << TD_T_SHIFT) /* uses ED_C */
-#define TD_T_GET(x) (((x) >> TD_T_SHIFT) & TD_T_MASK)
-#define TD_DP_SHIFT 21 /* direction/pid */
-#define TD_DP_MASK 0x3
-#define TD_DP (TD_DP_MASK << TD_DP_SHIFT)
-#define TD_DP_GET (((x) >> TD_DP_SHIFT) & TD_DP_MASK)
-#define TD_DP_SETUP (0x0 << TD_DP_SHIFT) /* SETUP pid */
-#define TD_DP_OUT (0x1 << TD_DP_SHIFT) /* OUT pid */
-#define TD_DP_IN (0x2 << TD_DP_SHIFT) /* IN pid */
-#define TD_ISI_SHIFT 8 /* Interrupt Service Interval */
-#define TD_ISI_MASK 0x3f
-#define TD_ISI_GET(x) (((x) >> TD_ISI_SHIFT) & TD_ISI_MASK)
-#define TD_FN_MASK 0x3f /* frame number */
-#define TD_FN_GET(x) ((x) & TD_FN_MASK)
-
- __hc32 hwDBP; /* Data Buffer Pointer (or 0) */
- __hc32 hwCBL; /* Controller/Buffer Length */
-
- /* hwCBL bits */
-#define TD_BL_MASK 0xffff /* buffer length */
-#define TD_BL_GET(x) ((x) & TD_BL_MASK)
-#define TD_IE (1 << 16) /* interrupt enable */
- __hc32 hwNextTD; /* Next TD Pointer */
-
- /* rest are purely for the driver's use */
- __u8 index;
- struct ed *ed;
- struct td *td_hash; /* dma-->td hashtable */
- struct td *next_dl_td;
- struct urb *urb;
-
- dma_addr_t td_dma; /* addr of this TD */
- dma_addr_t data_dma; /* addr of data it points to */
-
- struct list_head td_list; /* "shadow list", TDs on same ED */
-
- u32 flags;
-#define TD_FLAG_DONE (1 << 17) /* retired to done list */
-#define TD_FLAG_ISO (1 << 16) /* copy of ED_ISO */
-} __attribute__ ((aligned(TD_ALIGN))); /* c/b/i need 16; only iso needs 32 */
-
-/*
- * Hardware transfer status codes -- CC from td->hwINFO
- */
-#define TD_CC_NOERROR 0x00
-#define TD_CC_CRC 0x01
-#define TD_CC_BITSTUFFING 0x02
-#define TD_CC_DATATOGGLEM 0x03
-#define TD_CC_STALL 0x04
-#define TD_CC_DEVNOTRESP 0x05
-#define TD_CC_PIDCHECKFAIL 0x06
-#define TD_CC_UNEXPECTEDPID 0x07
-#define TD_CC_DATAOVERRUN 0x08
-#define TD_CC_DATAUNDERRUN 0x09
- /* 0x0A, 0x0B reserved for hardware */
-#define TD_CC_BUFFEROVERRUN 0x0C
-#define TD_CC_BUFFERUNDERRUN 0x0D
- /* 0x0E, 0x0F reserved for HCD */
-#define TD_CC_HCD0 0x0E
-#define TD_CC_NOTACCESSED 0x0F
-
-/*
- * preshifted status codes
- */
-#define TD_SCC_NOTACCESSED (TD_CC_NOTACCESSED << TD_CC_SHIFT)
-
-
-/* map OHCI TD status codes (CC) to errno values */
-static const int cc_to_error[16] = {
- /* No Error */ 0,
- /* CRC Error */ -EILSEQ,
- /* Bit Stuff */ -EPROTO,
- /* Data Togg */ -EILSEQ,
- /* Stall */ -EPIPE,
- /* DevNotResp */ -ETIME,
- /* PIDCheck */ -EPROTO,
- /* UnExpPID */ -EPROTO,
- /* DataOver */ -EOVERFLOW,
- /* DataUnder */ -EREMOTEIO,
- /* (for hw) */ -EIO,
- /* (for hw) */ -EIO,
- /* BufferOver */ -ECOMM,
- /* BuffUnder */ -ENOSR,
- /* (for HCD) */ -EALREADY,
- /* (for HCD) */ -EALREADY
-};
-
-#define NUM_INTS 32
-
-/*
- * This is the structure of the OHCI controller's memory mapped I/O region.
- * You must use readl() and writel() (in <asm/io.h>) to access these fields!!
- * Layout is in section 7 (and appendix B) of the spec.
- */
-struct admhcd_regs {
- __hc32 gencontrol; /* General Control */
- __hc32 int_status; /* Interrupt Status */
- __hc32 int_enable; /* Interrupt Enable */
- __hc32 reserved00;
- __hc32 host_control; /* Host General Control */
- __hc32 reserved01;
- __hc32 fminterval; /* Frame Interval */
- __hc32 fmnumber; /* Frame Number */
- __hc32 reserved02;
- __hc32 reserved03;
- __hc32 reserved04;
- __hc32 reserved05;
- __hc32 reserved06;
- __hc32 reserved07;
- __hc32 reserved08;
- __hc32 reserved09;
- __hc32 reserved10;
- __hc32 reserved11;
- __hc32 reserved12;
- __hc32 reserved13;
- __hc32 reserved14;
- __hc32 reserved15;
- __hc32 reserved16;
- __hc32 reserved17;
- __hc32 reserved18;
- __hc32 reserved19;
- __hc32 reserved20;
- __hc32 reserved21;
- __hc32 lsthresh; /* Low Speed Threshold */
- __hc32 rhdesc; /* Root Hub Descriptor */
-#define MAX_ROOT_PORTS 2
- __hc32 portstatus[MAX_ROOT_PORTS]; /* Port Status */
- __hc32 hosthead; /* Host Descriptor Head */
-} __attribute__ ((aligned(32)));
-
-/*
- * General Control register bits
- */
-#define ADMHC_CTRL_UHFE (1 << 0) /* USB Host Function Enable */
-#define ADMHC_CTRL_SIR (1 << 1) /* Software Interrupt request */
-#define ADMHC_CTRL_DMAA (1 << 2) /* DMA Arbitration Control */
-#define ADMHC_CTRL_SR (1 << 3) /* Software Reset */
-
-/*
- * Host General Control register bits
- */
-#define ADMHC_HC_BUSS 0x3 /* USB bus state */
-#define ADMHC_BUSS_RESET 0x0
-#define ADMHC_BUSS_RESUME 0x1
-#define ADMHC_BUSS_OPER 0x2
-#define ADMHC_BUSS_SUSPEND 0x3
-#define ADMHC_HC_DMAE (1 << 2) /* DMA enable */
-
-/*
- * Interrupt Status/Enable register bits
- */
-#define ADMHC_INTR_SOFI (1 << 4) /* start of frame */
-#define ADMHC_INTR_RESI (1 << 5) /* resume detected */
-#define ADMHC_INTR_6 (1 << 6) /* unknown */
-#define ADMHC_INTR_7 (1 << 7) /* unknown */
-#define ADMHC_INTR_BABI (1 << 8) /* babble detected */
-#define ADMHC_INTR_INSM (1 << 9) /* root hub status change */
-#define ADMHC_INTR_SO (1 << 10) /* scheduling overrun */
-#define ADMHC_INTR_FNO (1 << 11) /* frame number overflow */
-#define ADMHC_INTR_TDC (1 << 20) /* transfer descriptor completed */
-#define ADMHC_INTR_SWI (1 << 29) /* software interrupt */
-#define ADMHC_INTR_FATI (1 << 30) /* fatal error */
-#define ADMHC_INTR_INTA (1 << 31) /* interrupt active */
-
-#define ADMHC_INTR_MIE (1 << 31) /* master interrupt enable */
-
-/*
- * SOF Frame Interval register bits
- */
-#define ADMHC_SFI_FI_MASK ((1 << 14)-1) /* Frame Interval value */
-#define ADMHC_SFI_FSLDP_SHIFT 16
-#define ADMHC_SFI_FSLDP_MASK ((1 << 15)-1)
-#define ADMHC_SFI_FIT (1 << 31) /* Frame Interval Toggle */
-
-/*
- * SOF Frame Number register bits
- */
-#define ADMHC_SFN_FN_MASK ((1 << 16)-1) /* Frame Number Mask */
-#define ADMHC_SFN_FR_SHIFT 16 /* Frame Remaining Shift */
-#define ADMHC_SFN_FR_MASK ((1 << 14)-1) /* Frame Remaining Mask */
-#define ADMHC_SFN_FRT (1 << 31) /* Frame Remaining Toggle */
-
-/*
- * Root Hub Descriptor register bits
- */
-#define ADMHC_RH_NUMP 0xff /* number of ports */
-#define ADMHC_RH_PSM (1 << 8) /* power switching mode */
-#define ADMHC_RH_NPS (1 << 9) /* no power switching */
-#define ADMHC_RH_OCPM (1 << 10) /* over current protection mode */
-#define ADMHC_RH_NOCP (1 << 11) /* no over current protection */
-#define ADMHC_RH_PPCM (0xff << 16) /* port power control */
-
-#define ADMHC_RH_LPS (1 << 24) /* local power switch */
-#define ADMHC_RH_OCI (1 << 25) /* over current indicator */
-
-/* status change bits */
-#define ADMHC_RH_LPSC (1 << 26) /* local power switch change */
-#define ADMHC_RH_OCIC (1 << 27) /* over current indicator change */
-
-#define ADMHC_RH_DRWE (1 << 28) /* device remote wakeup enable */
-#define ADMHC_RH_CRWE (1 << 29) /* clear remote wakeup enable */
-
-#define ADMHC_RH_CGP (1 << 24) /* clear global power */
-#define ADMHC_RH_SGP (1 << 26) /* set global power */
-
-/*
- * Port Status register bits
- */
-#define ADMHC_PS_CCS (1 << 0) /* current connect status */
-#define ADMHC_PS_PES (1 << 1) /* port enable status */
-#define ADMHC_PS_PSS (1 << 2) /* port suspend status */
-#define ADMHC_PS_POCI (1 << 3) /* port over current indicator */
-#define ADMHC_PS_PRS (1 << 4) /* port reset status */
-#define ADMHC_PS_PPS (1 << 8) /* port power status */
-#define ADMHC_PS_LSDA (1 << 9) /* low speed device attached */
-
-/* status change bits */
-#define ADMHC_PS_CSC (1 << 16) /* connect status change */
-#define ADMHC_PS_PESC (1 << 17) /* port enable status change */
-#define ADMHC_PS_PSSC (1 << 18) /* port suspend status change */
-#define ADMHC_PS_OCIC (1 << 19) /* over current indicator change */
-#define ADMHC_PS_PRSC (1 << 20) /* port reset status change */
-
-/* port feature bits */
-#define ADMHC_PS_CPE (1 << 0) /* clear port enable */
-#define ADMHC_PS_SPE (1 << 1) /* set port enable */
-#define ADMHC_PS_SPS (1 << 2) /* set port suspend */
-#define ADMHC_PS_CPS (1 << 3) /* clear suspend status */
-#define ADMHC_PS_SPR (1 << 4) /* set port reset */
-#define ADMHC_PS_SPP (1 << 8) /* set port power */
-#define ADMHC_PS_CPP (1 << 9) /* clear port power */
-
-/*
- * the POTPGT value is not defined in the ADMHC, so define a dummy value
- */
-#define ADMHC_POTPGT 2 /* in ms */
-
-/* hcd-private per-urb state */
-struct urb_priv {
- struct ed *ed;
- struct list_head pending; /* URBs on the same ED */
-
- u32 td_cnt; /* # tds in this request */
- u32 td_idx; /* index of the current td */
- struct td *td[0]; /* all TDs in this request */
-};
-
-#define TD_HASH_SIZE 64 /* power'o'two */
-/* sizeof (struct td) ~= 64 == 2^6 ... */
-#define TD_HASH_FUNC(td_dma) ((td_dma ^ (td_dma >> 6)) % TD_HASH_SIZE)
-
-/*
- * This is the full ADMHCD controller description
- *
- * Note how the "proper" USB information is just
- * a subset of what the full implementation needs. (Linus)
- */
-
-struct admhcd {
- spinlock_t lock;
-
- /*
- * I/O memory used to communicate with the HC (dma-consistent)
- */
- struct admhcd_regs __iomem *regs;
-
- /*
- * hcd adds to schedule for a live hc any time, but removals finish
- * only at the start of the next frame.
- */
-
- struct ed *ed_head;
- struct ed *ed_tails[4];
-
- struct ed *ed_rm_list; /* to be removed */
-
- struct ed *periodic[NUM_INTS]; /* shadow int_table */
-
-#if 0 /* TODO: remove? */
- /*
- * OTG controllers and transceivers need software interaction;
- * other external transceivers should be software-transparent
- */
- struct otg_transceiver *transceiver;
- void (*start_hnp)(struct admhcd *ahcd);
-#endif
-
- /*
- * memory management for queue data structures
- */
- struct dma_pool *td_cache;
- struct dma_pool *ed_cache;
- struct td *td_hash[TD_HASH_SIZE];
- struct list_head pending;
-
- /*
- * driver state
- */
- int num_ports;
- int load[NUM_INTS];
- u32 host_control; /* copy of the host_control reg */
- unsigned long next_statechange; /* suspend/resume */
- u32 fminterval; /* saved register */
- unsigned autostop:1; /* rh auto stopping/stopped */
-
- unsigned long flags; /* for HC bugs */
-#define OHCI_QUIRK_AMD756 0x01 /* erratum #4 */
-#define OHCI_QUIRK_SUPERIO 0x02 /* natsemi */
-#define OHCI_QUIRK_INITRESET 0x04 /* SiS, OPTi, ... */
-#define OHCI_QUIRK_BE_DESC 0x08 /* BE descriptors */
-#define OHCI_QUIRK_BE_MMIO 0x10 /* BE registers */
-#define OHCI_QUIRK_ZFMICRO 0x20 /* Compaq ZFMicro chipset*/
- /* there are also chip quirks/bugs in init logic */
-
-#ifdef DEBUG
- struct dentry *debug_dir;
- struct dentry *debug_async;
- struct dentry *debug_periodic;
- struct dentry *debug_registers;
-#endif
-};
-
-/* convert between an hcd pointer and the corresponding ahcd_hcd */
-static inline struct admhcd *hcd_to_admhcd(struct usb_hcd *hcd)
-{
- return (struct admhcd *)(hcd->hcd_priv);
-}
-static inline struct usb_hcd *admhcd_to_hcd(const struct admhcd *ahcd)
-{
- return container_of((void *)ahcd, struct usb_hcd, hcd_priv);
-}
-
-/*-------------------------------------------------------------------------*/
-
-#ifndef DEBUG
-#define STUB_DEBUG_FILES
-#endif /* DEBUG */
-
-#ifdef DEBUG
-# define admhc_dbg(ahcd, fmt, args...) \
- printk(KERN_DEBUG "adm5120-hcd: " fmt, ## args)
-#else
-# define admhc_dbg(ahcd, fmt, args...) do { } while (0)
-#endif
-
-#define admhc_err(ahcd, fmt, args...) \
- printk(KERN_ERR "adm5120-hcd: " fmt, ## args)
-#define admhc_info(ahcd, fmt, args...) \
- printk(KERN_INFO "adm5120-hcd: " fmt, ## args)
-#define admhc_warn(ahcd, fmt, args...) \
- printk(KERN_WARNING "adm5120-hcd: " fmt, ## args)
-
-#ifdef ADMHC_VERBOSE_DEBUG
-# define admhc_vdbg admhc_dbg
-#else
-# define admhc_vdbg(ahcd, fmt, args...) do { } while (0)
-#endif
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * While most USB host controllers implement their registers and
- * in-memory communication descriptors in little-endian format,
- * a minority (notably the IBM STB04XXX and the Motorola MPC5200
- * processors) implement them in big endian format.
- *
- * In addition some more exotic implementations like the Toshiba
- * Spider (aka SCC) cell southbridge are "mixed" endian, that is,
- * they have a different endianness for registers vs. in-memory
- * descriptors.
- *
- * This attempts to support either format at compile time without a
- * runtime penalty, or both formats with the additional overhead
- * of checking a flag bit.
- *
- * That leads to some tricky Kconfig rules howevber. There are
- * different defaults based on some arch/ppc platforms, though
- * the basic rules are:
- *
- * Controller type Kconfig options needed
- * --------------- ----------------------
- * little endian CONFIG_USB_ADMHC_LITTLE_ENDIAN
- *
- * fully big endian CONFIG_USB_ADMHC_BIG_ENDIAN_DESC _and_
- * CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO
- *
- * mixed endian CONFIG_USB_ADMHC_LITTLE_ENDIAN _and_
- * CONFIG_USB_OHCI_BIG_ENDIAN_{MMIO,DESC}
- *
- * (If you have a mixed endian controller, you -must- also define
- * CONFIG_USB_ADMHC_LITTLE_ENDIAN or things will not work when building
- * both your mixed endian and a fully big endian controller support in
- * the same kernel image).
- */
-
-#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_DESC
-#ifdef CONFIG_USB_ADMHC_LITTLE_ENDIAN
-#define big_endian_desc(ahcd) (ahcd->flags & OHCI_QUIRK_BE_DESC)
-#else
-#define big_endian_desc(ahcd) 1 /* only big endian */
-#endif
-#else
-#define big_endian_desc(ahcd) 0 /* only little endian */
-#endif
-
-#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO
-#ifdef CONFIG_USB_ADMHC_LITTLE_ENDIAN
-#define big_endian_mmio(ahcd) (ahcd->flags & OHCI_QUIRK_BE_MMIO)
-#else
-#define big_endian_mmio(ahcd) 1 /* only big endian */
-#endif
-#else
-#define big_endian_mmio(ahcd) 0 /* only little endian */
-#endif
-
-/*
- * Big-endian read/write functions are arch-specific.
- * Other arches can be added if/when they're needed.
- *
- */
-static inline unsigned int admhc_readl(const struct admhcd *ahcd,
- __hc32 __iomem *regs)
-{
-#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO
- return big_endian_mmio(ahcd) ?
- readl_be(regs) :
- readl(regs);
-#else
- return readl(regs);
-#endif
-}
-
-static inline void admhc_writel(const struct admhcd *ahcd,
- const unsigned int val, __hc32 __iomem *regs)
-{
-#ifdef CONFIG_USB_ADMHC_BIG_ENDIAN_MMIO
- big_endian_mmio(ahcd) ?
- writel_be(val, regs) :
- writel(val, regs);
-#else
- writel(val, regs);
-#endif
-}
-
-static inline void admhc_writel_flush(const struct admhcd *ahcd)
-{
-#if 0
- /* TODO: remove? */
- (void) admhc_readl(ahcd, &ahcd->regs->gencontrol);
-#endif
-}
-
-
-/*-------------------------------------------------------------------------*/
-
-/* cpu to ahcd */
-static inline __hc16 cpu_to_hc16(const struct admhcd *ahcd, const u16 x)
-{
- return big_endian_desc(ahcd) ?
- (__force __hc16)cpu_to_be16(x) :
- (__force __hc16)cpu_to_le16(x);
-}
-
-static inline __hc16 cpu_to_hc16p(const struct admhcd *ahcd, const u16 *x)
-{
- return big_endian_desc(ahcd) ?
- cpu_to_be16p(x) :
- cpu_to_le16p(x);
-}
-
-static inline __hc32 cpu_to_hc32(const struct admhcd *ahcd, const u32 x)
-{
- return big_endian_desc(ahcd) ?
- (__force __hc32)cpu_to_be32(x) :
- (__force __hc32)cpu_to_le32(x);
-}
-
-static inline __hc32 cpu_to_hc32p(const struct admhcd *ahcd, const u32 *x)
-{
- return big_endian_desc(ahcd) ?
- cpu_to_be32p(x) :
- cpu_to_le32p(x);
-}
-
-/* ahcd to cpu */
-static inline u16 hc16_to_cpu(const struct admhcd *ahcd, const __hc16 x)
-{
- return big_endian_desc(ahcd) ?
- be16_to_cpu((__force __be16)x) :
- le16_to_cpu((__force __le16)x);
-}
-
-static inline u16 hc16_to_cpup(const struct admhcd *ahcd, const __hc16 *x)
-{
- return big_endian_desc(ahcd) ?
- be16_to_cpup((__force __be16 *)x) :
- le16_to_cpup((__force __le16 *)x);
-}
-
-static inline u32 hc32_to_cpu(const struct admhcd *ahcd, const __hc32 x)
-{
- return big_endian_desc(ahcd) ?
- be32_to_cpu((__force __be32)x) :
- le32_to_cpu((__force __le32)x);
-}
-
-static inline u32 hc32_to_cpup(const struct admhcd *ahcd, const __hc32 *x)
-{
- return big_endian_desc(ahcd) ?
- be32_to_cpup((__force __be32 *)x) :
- le32_to_cpup((__force __le32 *)x);
-}
-
-/*-------------------------------------------------------------------------*/
-
-static inline u16 admhc_frame_no(const struct admhcd *ahcd)
-{
- u32 t;
-
- t = admhc_readl(ahcd, &ahcd->regs->fmnumber) & ADMHC_SFN_FN_MASK;
- return (u16)t;
-}
-
-static inline u16 admhc_frame_remain(const struct admhcd *ahcd)
-{
- u32 t;
-
- t = admhc_readl(ahcd, &ahcd->regs->fmnumber) >> ADMHC_SFN_FR_SHIFT;
- t &= ADMHC_SFN_FR_MASK;
- return (u16)t;
-}
-
-/*-------------------------------------------------------------------------*/
-
-static inline void admhc_disable(struct admhcd *ahcd)
-{
- admhcd_to_hcd(ahcd)->state = HC_STATE_HALT;
-}
-
-#define FI 0x2edf /* 12000 bits per frame (-1) */
-#define FSLDP(fi) (0x7fff & ((6 * ((fi) - 1200)) / 7))
-#define FIT ADMHC_SFI_FIT
-#define LSTHRESH 0x628 /* lowspeed bit threshold */
-
-static inline void periodic_reinit(struct admhcd *ahcd)
-{
-#if 0
- u32 fi = ahcd->fminterval & ADMHC_SFI_FI_MASK;
- u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT;
-
- /* TODO: adjust FSLargestDataPacket value too? */
- admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval,
- &ahcd->regs->fminterval);
-#else
- u32 fit = admhc_readl(ahcd, &ahcd->regs->fminterval) & FIT;
-
- /* TODO: adjust FSLargestDataPacket value too? */
- admhc_writel(ahcd, (fit ^ FIT) | ahcd->fminterval,
- &ahcd->regs->fminterval);
-#endif
-}
-
-static inline u32 admhc_read_rhdesc(struct admhcd *ahcd)
-{
- return admhc_readl(ahcd, &ahcd->regs->rhdesc);
-}
-
-static inline u32 admhc_read_portstatus(struct admhcd *ahcd, int port)
-{
- return admhc_readl(ahcd, &ahcd->regs->portstatus[port]);
-}
-
-static inline void admhc_write_portstatus(struct admhcd *ahcd, int port,
- u32 value)
-{
- admhc_writel(ahcd, value, &ahcd->regs->portstatus[port]);
-}
-
-static inline void roothub_write_status(struct admhcd *ahcd, u32 value)
-{
- /* FIXME: read-only bits must be masked out */
- admhc_writel(ahcd, value, &ahcd->regs->rhdesc);
-}
-
-static inline void admhc_intr_disable(struct admhcd *ahcd, u32 ints)
-{
- u32 t;
-
- t = admhc_readl(ahcd, &ahcd->regs->int_enable);
- t &= ~(ints);
- admhc_writel(ahcd, t, &ahcd->regs->int_enable);
- /* TODO: flush writes ?*/
-}
-
-static inline void admhc_intr_enable(struct admhcd *ahcd, u32 ints)
-{
- u32 t;
-
- t = admhc_readl(ahcd, &ahcd->regs->int_enable);
- t |= ints;
- admhc_writel(ahcd, t, &ahcd->regs->int_enable);
- /* TODO: flush writes ?*/
-}
-
-static inline void admhc_intr_ack(struct admhcd *ahcd, u32 ints)
-{
- admhc_writel(ahcd, ints, &ahcd->regs->int_status);
-}
-
-static inline void admhc_dma_enable(struct admhcd *ahcd)
-{
- u32 t;
-
- t = admhc_readl(ahcd, &ahcd->regs->host_control);
- if (t & ADMHC_HC_DMAE)
- return;
-
- t |= ADMHC_HC_DMAE;
- admhc_writel(ahcd, t, &ahcd->regs->host_control);
- admhc_vdbg(ahcd, "DMA enabled\n");
-}
-
-static inline void admhc_dma_disable(struct admhcd *ahcd)
-{
- u32 t;
-
- t = admhc_readl(ahcd, &ahcd->regs->host_control);
- if (!(t & ADMHC_HC_DMAE))
- return;
-
- t &= ~ADMHC_HC_DMAE;
- admhc_writel(ahcd, t, &ahcd->regs->host_control);
- admhc_vdbg(ahcd, "DMA disabled\n");
-}
+++ /dev/null
-/*
- * ADM5120_WDT 0.01: Infineon ADM5120 SoC watchdog driver
- * Copyright (c) Ondrej Zajicek <santiago@crfreenet.org>, 2007
- *
- * based on
- *
- * RC32434_WDT 0.01: IDT Interprise 79RC32434 watchdog driver
- *
- * 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.
- *
- */
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <linux/watchdog.h>
-#include <linux/irq.h>
-
-#include <asm/bootinfo.h>
-
-#include <asm/mach-adm5120/adm5120_info.h>
-#include <asm/mach-adm5120/adm5120_defs.h>
-#include <asm/mach-adm5120/adm5120_switch.h>
-
-#define DEFAULT_TIMEOUT 15 /* (secs) Default is 15 seconds */
-#define MAX_TIMEOUT 327
-/* Max is 327 seconds, counter is 15-bit integer, step is 10 ms */
-
-#define NAME "adm5120_wdt"
-#define VERSION "0.1"
-
-static int expect_close;
-static int access;
-static unsigned int timeout = DEFAULT_TIMEOUT;
-
-static int nowayout = WATCHDOG_NOWAYOUT;
-module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-MODULE_LICENSE("GPL");
-
-
-static inline void wdt_set_timeout(void)
-{
- u32 val = (1 << 31) | (((timeout * 100) & 0x7FFF) << 16);
- SW_WRITE_REG(SWITCH_REG_WDOG0, val);
-}
-
-/*
- It looks like WDOG0-register-write don't modify counter,
- but WDOG0-register-read resets counter.
-*/
-
-static inline void wdt_reset_counter(void)
-{
- SW_READ_REG(SWITCH_REG_WDOG0);
-}
-
-static inline void wdt_disable(void)
-{
- SW_WRITE_REG(SWITCH_REG_WDOG0, 0x7FFF0000);
-}
-
-
-
-static int wdt_open(struct inode *inode, struct file *file)
-{
- /* Allow only one person to hold it open */
- if (access)
- return -EBUSY;
-
- if (nowayout)
- __module_get(THIS_MODULE);
-
- /* Activate timer */
- wdt_reset_counter();
- wdt_set_timeout();
- printk(KERN_INFO NAME ": enabling watchdog timer\n");
- access = 1;
- return 0;
-}
-
-static int wdt_release(struct inode *inode, struct file *file)
-{
- /*
- * Shut off the timer.
- * Lock it in if it's a module and we set nowayout
- */
- if (expect_close && (nowayout == 0)) {
- wdt_disable();
- printk(KERN_INFO NAME ": disabling watchdog timer\n");
- module_put(THIS_MODULE);
- } else
- printk(KERN_CRIT NAME ": device closed unexpectedly. WDT will not stop!\n");
-
- access = 0;
- return 0;
-}
-
-static ssize_t wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
-{
- /* Refresh the timer. */
- if (len) {
- if (!nowayout) {
- size_t i;
-
- /* In case it was set long ago */
- expect_close = 0;
-
- for (i = 0; i != len; i++) {
- char c;
- if (get_user(c, data + i))
- return -EFAULT;
- if (c == 'V')
- expect_close = 1;
- }
- }
- wdt_reset_counter();
- return len;
- }
- return 0;
-}
-
-static long wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
- int new_timeout;
- static struct watchdog_info ident = {
- .options = WDIOF_SETTIMEOUT |
- WDIOF_KEEPALIVEPING |
- WDIOF_MAGICCLOSE,
- .firmware_version = 0,
- .identity = "ADM5120_WDT Watchdog",
- };
- switch (cmd) {
- default:
- return -ENOTTY;
- case WDIOC_GETSUPPORT:
- if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
- return -EFAULT;
- return 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, (int *)arg);
- case WDIOC_KEEPALIVE:
- wdt_reset_counter();
- return 0;
- case WDIOC_SETTIMEOUT:
- if (get_user(new_timeout, (int *)arg))
- return -EFAULT;
- if (new_timeout < 1)
- return -EINVAL;
- if (new_timeout > MAX_TIMEOUT)
- return -EINVAL;
- timeout = new_timeout;
- wdt_set_timeout();
- /* Fall */
- case WDIOC_GETTIMEOUT:
- return put_user(timeout, (int *)arg);
- }
-}
-
-static const struct file_operations wdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = wdt_write,
- .unlocked_ioctl = wdt_ioctl,
- .open = wdt_open,
- .release = wdt_release,
-};
-
-static struct miscdevice wdt_miscdev = {
- .minor = WATCHDOG_MINOR,
- .name = "watchdog",
- .fops = &wdt_fops,
-};
-
-static char banner[] __initdata = KERN_INFO NAME ": Watchdog Timer version " VERSION "\n";
-
-static int __init watchdog_init(void)
-{
- int ret;
-
- ret = misc_register(&wdt_miscdev);
-
- if (ret)
- return ret;
-
- wdt_disable();
- printk(banner);
-
- return 0;
-}
-
-static void __exit watchdog_exit(void)
-{
- misc_deregister(&wdt_miscdev);
-}
-
-module_init(watchdog_init);
-module_exit(watchdog_exit);
+++ /dev/null
-#
-# Copyright (C) 2006-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
-
-LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
-JFFS2BLOCK := $(KDIR)/jffs2.block
-JFFS2MARK := $(KDIR)/jffs2.mark
-
-define imgname
-$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(1))
-endef
-
-VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
-fs_squash:=squashfs-only
-fs_all:=all
-fs_4k:=4k
-fs_64k:=64k
-fs_128k:=128k
-
-define Build/Clean
- $(LOADER_MAKE) clean
-endef
-
-define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
- rm -f $(JFFS2BLOCK)
- touch $(JFFS2BLOCK)
- $(call prepare_generic_squashfs,$(JFFS2BLOCK))
- rm -f $(JFFS2MARK)
- touch $(JFFS2MARK)
- $(call add_jffs2_mark,$(JFFS2MARK))
-endef
-
-define Image/Build/Loader
- $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \
- LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
- CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
- compile loader.$(2)
-endef
-
-define Image/Build/LZMAKernel
- $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
- LOADER=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-ramfs.$(2) \
- LOADER_DATA=$(KDIR)/vmlinux.lzma \
- LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
- CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
- compile loader.$(2)
-endef
-
-define Image/Build/LZMAKernel/Generic
- $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0)
-endef
-
-define Image/Build/LZMAKernel/Admboot
- $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1))
-endef
-
-define Image/Build/LZMAKernel/Cellvision
- $(call Image/Build/LZMAKernel,$(1),$(3),0x80500000,0x6D8,y,$(2))
-endef
-
-define Image/Build/LZMAKernel/KArgs
- $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
-endef
-
-define trxalign/jffs2-128k
--a 0x20000 -f $(KDIR)/root.jffs2-128k
-endef
-
-define trxalign/jffs2-64k
--a 0x10000 -f $(KDIR)/root.jffs2-64k
-endef
-
-define trxalign/squashfs
--a 1024 -f $(KDIR)/root.squashfs -a 0x10000 -A $(JFFS2BLOCK)
-endef
-
-define Image/Build/TRX
- $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
- $(call trxalign/$(2))
-endef
-
-define Image/Build/TRXNoloader
- $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
- $(call trxalign/$(2))
-endef
-
-include $(SUBTARGET).mk
-
-define Image/Build
- $(call Image/Build/Profile/$(PROFILE),$(1))
-endef
-
-define Image/Build/Initramfs
- $(call Image/Build/Profile/$(PROFILE),Initramfs)
-endef
-
-define Image/BuildKernel
- cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
- cp $(KDIR)/vmlinux $(VMLINUX).bin
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
- cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
- cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin
-endif
-endef
-
-$(eval $(call BuildImage))
+++ /dev/null
-#
-# Copyright (C) 2006 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-LOADER := loader.bin
-LOADER_NAME := $(basename $(notdir $(LOADER)))
-LOADER_DATA :=
-TARGET_DIR :=
-
-ifeq ($(TARGET_DIR),)
-TARGET_DIR := $(KDIR)
-endif
-
-LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin
-LOADER_GZ := $(TARGET_DIR)/$(LOADER_NAME).gz
-LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf
-
-LZMA_STARTUP_ORG:= 0
-LZMA_TEXT_START := 0x80300000
-
-PKG_NAME := lzma-loader
-PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME)
-
-.PHONY : loader-compile loader.bin loader.elf loader.gz
-
-$(PKG_BUILD_DIR)/.prepared:
- mkdir $(PKG_BUILD_DIR)
- $(CP) ./src/* $(PKG_BUILD_DIR)/
- touch $@
-
-loader-compile: $(PKG_BUILD_DIR)/.prepared
- $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \
- LZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG) \
- LZMA_TEXT_START=$(LZMA_TEXT_START) \
- LOADER_DATA=$(LOADER_DATA) \
- CONFIG_BOARD=$(CONFIG_BOARD) \
- CONFIG_PASS_KARGS=$(CONFIG_PASS_KARGS) \
- clean all
-
-loader.gz: $(PKG_BUILD_DIR)/loader.bin
- gzip -nc9 $< > $(LOADER_GZ)
-
-loader.elf: $(PKG_BUILD_DIR)/loader.elf
- $(CP) $< $(LOADER_ELF)
-
-loader.bin: $(PKG_BUILD_DIR)/loader.bin
- $(CP) $< $(LOADER_BIN)
-
-download:
-prepare: $(PKG_BUILD_DIR)/.prepared
-compile: loader-compile
-
-install:
-
-clean:
- rm -rf $(PKG_BUILD_DIR)
-
+++ /dev/null
-/*
- LzmaDecode.c
- LZMA Decoder (optimized for Speed version)
-
- LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
- 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"
-
-#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
-
-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;
-}
-
-#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;
-}
+++ /dev/null
-/*
- LzmaDecode.h
- LZMA Decoder interface
-
- LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
- 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
-
-#include "LzmaTypes.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 */
-
-#ifdef _LZMA_PROB32
-#define CProb UInt32
-#else
-#define CProb UInt16
-#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
+++ /dev/null
-/*
-LzmaTypes.h
-
-Types for LZMA Decoder
-
-This file written and distributed to public domain by Igor Pavlov.
-This file is part of LZMA SDK 4.40 (2006-05-01)
-*/
-
-#ifndef __LZMATYPES_H
-#define __LZMATYPES_H
-
-#ifndef _7ZIP_BYTE_DEFINED
-#define _7ZIP_BYTE_DEFINED
-typedef unsigned char Byte;
-#endif
-
-#ifndef _7ZIP_UINT16_DEFINED
-#define _7ZIP_UINT16_DEFINED
-typedef unsigned short UInt16;
-#endif
-
-#ifndef _7ZIP_UINT32_DEFINED
-#define _7ZIP_UINT32_DEFINED
-#ifdef _LZMA_UINT32_IS_ULONG
-typedef unsigned long UInt32;
-#else
-typedef unsigned int UInt32;
-#endif
-#endif
-
-/* #define _LZMA_NO_SYSTEM_SIZE_T */
-/* You can use it, if you don't want <stddef.h> */
-
-#ifndef _7ZIP_SIZET_DEFINED
-#define _7ZIP_SIZET_DEFINED
-#ifdef _LZMA_NO_SYSTEM_SIZE_T
-typedef UInt32 SizeT;
-#else
-#include <stddef.h>
-typedef size_t SizeT;
-#endif
-#endif
-
-#endif
+++ /dev/null
-#
-# Makefile for Broadcom BCM947XX boards
-#
-# Copyright 2001-2003, 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.
-#
-# Copyright 2004 Manuel Novoa III <mjn3@codepoet.org>
-# Modified to support bzip'd kernels.
-# Of course, it would be better to integrate bunzip capability into CFE.
-#
-# Copyright 2005 Oleg I. Vdovikin <oleg@cs.msu.su>
-# Cleaned up, modified for lzma support, removed from kernel
-#
-# Copyright 2007 Gabor Juhos <juhosg at openwrt.org>
-# Modified to support user defined entry point address.
-# Added support for make targets with different names
-#
-
-LOADADDR := 0x80001000
-LZMA_TEXT_START := 0x80500000
-LZMA_STARTUP_ORG:= 0
-LOADER_DATA :=
-CONFIG_PASS_KARGS :=
-CONFIG_BOARD :=
-
-CC := $(CROSS_COMPILE)gcc
-LD := $(CROSS_COMPILE)ld
-OBJCOPY := $(CROSS_COMPILE)objcopy
-OBJDUMP := $(CROSS_COMPILE)objdump
-
-BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
-
-CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
- -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
- -ffunction-sections -pipe -mlong-calls -fno-common -ffreestanding \
- -fhonour-copts \
- -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
-CFLAGS += -DLOADADDR=$(LOADADDR) -D_LZMA_PROB32
-
-ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DLZMA_STARTUP_ORG=$(LZMA_STARTUP_ORG)
-
-LDFLAGS = -static --gc-sections -no-warn-mismatch
-LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START)
-
-O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32)
-
-OBJECTS := head.o decompress.o board.o printf.o LzmaDecode.o
-
-ifneq ($(strip $(LOADER_DATA)),)
-OBJECTS += data.o
-CFLAGS += -DLZMA_WRAPPER=1
-else
-CFLAGS += -D_LZMA_IN_CB
-endif
-
-ifneq ($(strip $(CONFIG_PASS_KARGS)),)
-CFLAGS += -DCONFIG_PASS_KARGS
-endif
-
-BOARD_DEF := $(strip $(CONFIG_BOARD))
-BOARD_DEF := $(shell echo $(BOARD_DEF) | tr a-z A-Z | tr -d -)
-ifneq ($(BOARD_DEF),)
-CFLAGS += -DCONFIG_BOARD_$(BOARD_DEF)
-endif
-
-all: loader.bin
-
-# Don't build dependencies, this may die if $(CC) isn't gcc
-dep:
-
-install:
-
-%.o : %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-%.o : %.S
- $(CC) $(ASFLAGS) -c -o $@ $<
-
-data.o: $(LOADER_DATA)
- $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $<
-
-loader.bin: loader.elf
- $(OBJCOPY) $(BIN_FLAGS) $< $@
-
-loader.elf: $(OBJECTS)
- $(LD) $(LDFLAGS) -o $@ $(OBJECTS)
-
-mrproper: clean
-
-clean:
- rm -f *.elf *.bin *.o
-
-
-
+++ /dev/null
-/*
- * 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
- *
- */
-
-The code is intended to decompress kernel, being compressed using lzma utility
-build using 7zip LZMA SDK. This utility is located in the LZMA_Alone directory
-
-decompressor code expects that your .trx file consist of three partitions:
-
-1) decompressor itself (this is gziped code which pmon/cfe will extract and run
-on boot-up instead of real kernel)
-2) LZMA compressed kernel (both streamed and regular modes are supported now)
-3) Root filesystem
-
-Please be sure to apply the following patch for use this new trx layout (it will
-allow using both new and old trx files for root filesystem lookup code)
-
---- linuz/arch/mips/brcm-boards/bcm947xx/setup.c 2005-01-23 19:24:27.503322896 +0300
-+++ linux/arch/mips/brcm-boards/bcm947xx/setup.c 2005-01-23 19:29:05.237100944 +0300
-@@ -221,7 +221,9 @@
- /* Try looking at TRX header for rootfs offset */
- if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
- bcm947xx_parts[1].offset = off;
-- if (le32_to_cpu(trx->offsets[1]) > off)
-+ if (le32_to_cpu(trx->offsets[2]) > off)
-+ off = le32_to_cpu(trx->offsets[2]);
-+ else if (le32_to_cpu(trx->offsets[1]) > off)
- off = le32_to_cpu(trx->offsets[1]);
- continue;
- }
-
-
-Revision history:
- 0.02 Initial release
- 0.03 Added Mineharu Takahara <mtakahar@yahoo.com> patch to pass actual
- output size to decoder (stream mode compressed input is not
- a requirement anymore)
- 0.04 Reordered functions using lds script
+++ /dev/null
-/*
- * ADM5120 specific board support for LZMA decompressor
- *
- * Copyright (C) 2007-2008 OpenWrt.org
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License 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
- */
-
-#include "config.h"
-#include <stddef.h>
-
-#define READREG(r) *(volatile unsigned int *)(r)
-#define WRITEREG(r,v) *(volatile unsigned int *)(r) = v
-
-/*
- * INTC definitions
- */
-#define INTC_BASE 0xB2200000
-
-/* INTC registers */
-#define INTC_REG_IRQ_DISABLE 0x0C
-
-/*
- * UART definitions
- */
-#define UART0_BASE 0xB2600000
-#define UART1_BASE 0xB2800000
-/* UART registers */
-#define UART_REG_DATA 0x00 /* Data register */
-#define UART_REG_ECR 0x04 /* Error Clear register */
-#define UART_REG_LCRH 0x08 /* Line Control High register */
-#define UART_REG_LCRM 0x0C /* Line Control Middle register */
-#define UART_REG_LCRL 0x10 /* Line Control Low register */
-#define UART_REG_CTRL 0x14 /* Control register */
-#define UART_REG_FLAG 0x18 /* Flag register */
-
-/* Control register bits */
-#define UART_CTRL_EN ( 1 << 0 ) /* UART enable */
-
-/* Line Control High register bits */
-#define UART_LCRH_FEN ( 1 << 4 ) /* FIFO enable */
-
-/* Flag register bits */
-#define UART_FLAG_CTS ( 1 << 0 )
-#define UART_FLAG_DSR ( 1 << 1 )
-#define UART_FLAG_DCD ( 1 << 2 )
-#define UART_FLAG_BUSY ( 1 << 3 )
-#define UART_FLAG_RXFE ( 1 << 4 ) /* RX FIFO empty */
-#define UART_FLAG_TXFF ( 1 << 5 ) /* TX FIFO full */
-#define UART_FLAG_RXFF ( 1 << 6 ) /* RX FIFO full */
-#define UART_FLAG_TXFE ( 1 << 7 ) /* TX FIFO empty */
-
-/*
- * SWITCH definitions
- */
-#define SWITCH_BASE 0xB2000000
-
-#define SWITCH_REG_CPUP_CONF 0x0024
-#define SWITCH_REG_PORT_CONF0 0x0028
-
-#define SWITCH_REG_GPIO_CONF0 0x00B8
-#define SWITCH_REG_GPIO_CONF2 0x00BC
-
-#define SWITCH_REG_PORT0_LED 0x0100
-#define SWITCH_REG_PORT1_LED 0x0104
-#define SWITCH_REG_PORT2_LED 0x0108
-#define SWITCH_REG_PORT3_LED 0x010C
-#define SWITCH_REG_PORT4_LED 0x0110
-
-#define SWITCH_PORTS_HW 0x3F /* Hardware Ports */
-
-/* CPUP_CONF register bits */
-#define CPUP_CONF_DCPUP ( 1 << 0 ) /* Disable CPU port */
-
-/* PORT_CONF0 register bits */
-#define PORT_CONF0_DP_SHIFT 0 /* disable port shift*/
-
-
-/*
- * UART routines
- */
-
-#if defined(CONFIG_USE_UART0)
-# define UART_READ(r) READREG(UART0_BASE+(r))
-# define UART_WRITE(r,v) WRITEREG(UART0_BASE+(r),(v))
-#else
-# define UART_READ(r) READREG(UART1_BASE+(r))
-# define UART_WRITE(r,v) WRITEREG(UART1_BASE+(r),(v))
-#endif
-
-static void uart_init(void)
-{
-#if 0
- unsigned int t;
-
- /* disable uart */
- UART_WRITE(UART_REG_CTRL, 0);
-
- /* keep current baud rate */
- t = UART_READ(UART_REG_LCRM);
- UART_WRITE(UART_REG_LCRM, t);
- t = UART_READ(UART_REG_LCRL);
- UART_WRITE(UART_REG_LCRL, t);
-
- /* keep data, stop, and parity bits, but disable FIFO */
- t = UART_READ(UART_REG_LCRH);
- t &= ~(UART_LCRH_FEN);
- UART_WRITE(UART_REG_LCRH, t );
-
- /* clear error bits */
- UART_WRITE(UART_REG_ECR, 0xFF);
-
- /* enable uart, and disable interrupts */
- UART_WRITE(UART_REG_CTRL, UART_CTRL_EN);
-#endif
-}
-
-/*
- * INTC routines
- */
-
-#define INTC_READ(r) READREG(INTC_BASE+(r))
-#define INTC_WRITE(r,v) WRITEREG(INTC_BASE+(r),v)
-
-static void intc_init(void)
-{
- INTC_WRITE(INTC_REG_IRQ_DISABLE, 0xFFFFFFFF);
-}
-
-/*
- * SWITCH routines
- */
-
-#define SWITCH_READ(r) READREG(SWITCH_BASE+(r))
-#define SWITCH_WRITE(r,v) WRITEREG(SWITCH_BASE+(r),v)
-
-static void switch_init(void)
-{
- /* disable PHYS ports */
- SWITCH_WRITE(SWITCH_REG_PORT_CONF0,
- (SWITCH_PORTS_HW << PORT_CONF0_DP_SHIFT));
-
- /* disable CPU port */
- SWITCH_WRITE(SWITCH_REG_CPUP_CONF, CPUP_CONF_DCPUP);
-
- /* disable GPIO lines */
- SWITCH_WRITE(SWITCH_REG_GPIO_CONF0, 0);
- SWITCH_WRITE(SWITCH_REG_GPIO_CONF2, 0);
-
- /* disable LED lines */
- SWITCH_WRITE(SWITCH_REG_PORT0_LED, 0);
- SWITCH_WRITE(SWITCH_REG_PORT1_LED, 0);
- SWITCH_WRITE(SWITCH_REG_PORT2_LED, 0);
- SWITCH_WRITE(SWITCH_REG_PORT3_LED, 0);
- SWITCH_WRITE(SWITCH_REG_PORT4_LED, 0);
-}
-
-void board_putc(int ch)
-{
- while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0);
-
- UART_WRITE(UART_REG_DATA, ch);
-
- while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0);
-}
-
-void board_init(void)
-{
- intc_init();
- switch_init();
- uart_init();
-}
+++ /dev/null
-#ifndef _CONFIG_H_
-#define _CONFIG_H_
-
-#define FLASH_2M (2<<20)
-#define FLASH_4M (4<<20)
-
-/*
- * Cellvision/SparkLAN boards
- */
-
-#if defined(CONFIG_BOARD_CAS630)
-# define CONFIG_BOARD_NAME "CAS-630"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_CAS670)
-# define CONFIG_BOARD_NAME "CAS-670"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_CAS700)
-# define CONFIG_BOARD_NAME "CAS-700"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_CAS790)
-# define CONFIG_BOARD_NAME "CAS-790"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_CAS771)
-# define CONFIG_BOARD_NAME "CAS-771"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_CAS861)
-# define CONFIG_BOARD_NAME "CAS-861"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_NFS101U)
-# define CONFIG_BOARD_NAME "NFS-101U"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_NFS202U)
-# define CONFIG_BOARD_NAME "NFS-202U"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-/*
- * Compex boards
- */
-#if defined(CONFIG_BOARD_WP54GWRT)
-# define CONFIG_BOARD_NAME "WP54G-WRT"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-/*
- * Edimax boards
- */
-#if defined(CONFIG_BOARD_BR6104K)
-# define CONFIG_BOARD_NAME "BR-6104K"
-# define CONFIG_FLASH_SIZE FLASH_2M
-#endif
-
-#if defined(CONFIG_BOARD_BR6104KP)
-# define CONFIG_BOARD_NAME "BR-6104KP"
-# define CONFIG_FLASH_SIZE FLASH_2M
-#endif
-
-#if defined(CONFIG_BOARD_BR6104WG)
-# define CONFIG_BOARD_NAME "BR-6104WG"
-# define CONFIG_FLASH_SIZE FLASH_2M
-#endif
-
-/*
- * Infineon boards
- */
-#if defined(CONFIG_BOARD_EASY5120PATA)
-# define CONFIG_BOARD_NAME "EASY 5120P-ATA"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_EASY5120RT)
-# define CONFIG_BOARD_NAME "EASY 5120-RT"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_EASY5120WVOIP)
-# define CONFIG_BOARD_NAME "EASY 5120-WVOIP"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_EASY83000)
-# define CONFIG_BOARD_NAME "EASY 83000"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-/*
- * Motorola boards
- */
-#if defined(CONFIG_BOARD_POWERLINEMUGW)
-# define CONFIG_BOARD_NAME "Powerline MU Gateway"
-# define CONFIG_USE_UART1 1
-#endif
-
-/*
- * OSBRiDGE boards
- */
-#if defined(CONFIG_BOARD_5GXI)
-# define CONFIG_BOARD_NAME "OSBRiDGE 5GXi"
-#endif
-
-/*
- * ZyXEL boards
- */
-#if defined(CONFIG_BOARD_P334WT)
-# define CONFIG_BOARD_NAME "P-334WT"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-#if defined(CONFIG_BOARD_P335)
-# define CONFIG_BOARD_NAME "P-335"
-# define CONFIG_FLASH_SIZE FLASH_4M
-#endif
-
-/*
- * Default values
- */
-#ifndef CONFIG_BOARD_NAME
-# define CONFIG_BOARD_NAME "ADM5120"
-#endif
-
-#ifndef CONFIG_FLASH_SIZE
-# define CONFIG_FLASH_SIZE FLASH_2M
-#endif
-
-#if !defined(CONFIG_USE_UART0) && !defined(CONFIG_USE_UART1)
-# define CONFIG_USE_UART0
-#endif
-
-#endif /* _CONFIG_H_ */
+++ /dev/null
-/*
- *
- * LZMA compressed kernel decompressor for ADM5120 boards
- *
- * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
- * Copyright (C) 2007-2008 OpenWrt.org
- * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License 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
- *
- * 24-Mar-2007 Gabor Juhos
- * pass original values of the a0,a1,a2,a3 registers to the kernel
- *
- * 19-May-2007 Gabor Juhos
- * endiannes related cleanups
- * add support for decompressing an embedded kernel
- *
- */
-
-#include <stddef.h>
-
-#include "config.h"
-#include "printf.h"
-#include "LzmaDecode.h"
-
-#define ADM5120_FLASH_START 0x1fc00000 /* Flash start */
-#define ADM5120_FLASH_END 0x1fe00000 /* Flash end */
-
-#define KSEG0 0x80000000
-#define KSEG1 0xa0000000
-
-#define KSEG1ADDR(a) ((((unsigned)(a)) & 0x1fffffffU) | KSEG1)
-
-#define Index_Invalidate_I 0x00
-#define Index_Writeback_Inv_D 0x01
-
-#define cache_unroll(base,op) \
- __asm__ __volatile__( \
- ".set noreorder;\n" \
- ".set mips3;\n" \
- "cache %1, (%0);\n" \
- ".set mips0;\n" \
- ".set reorder\n" \
- : \
- : "r" (base), \
- "i" (op));
-
-#ifdef LZMA_DEBUG
-# define DBG(f, a...) printf(f, ## a)
-#else
-# define DBG(f, a...) do {} while (0)
-#endif
-
-static __inline__ void blast_icache(unsigned long size, unsigned long lsize)
-{
- unsigned long start = KSEG0;
- unsigned long end = (start + size);
-
- while(start < end) {
- cache_unroll(start,Index_Invalidate_I);
- start += lsize;
- }
-}
-
-static __inline__ void blast_dcache(unsigned long size, unsigned long lsize)
-{
- unsigned long start = KSEG0;
- unsigned long end = (start + size);
-
- while(start < end) {
- cache_unroll(start,Index_Writeback_Inv_D);
- start += lsize;
- }
-}
-
-#define TRX_MAGIC 0x30524448 /* "HDR0" */
-#define TRX_ALIGN 0x1000
-
-struct trx_header {
- unsigned int magic; /* "HDR0" */
- unsigned int len; /* Length of file including header */
- unsigned int crc32; /* 32-bit CRC from flag_version to end of file */
- unsigned int flag_version; /* 0:15 flags, 16:31 version */
- unsigned int offsets[3]; /* Offsets of partitions from start of header */
-};
-
-struct env_var {
- char *name;
- char *value;
-};
-
-/* beyound the image end, size not known in advance */
-extern unsigned char workspace[];
-extern void board_init(void);
-
-static CLzmaDecoderState lzma_state;
-
-typedef void (*kernel_entry)(unsigned long reg_a0, unsigned long reg_a1,
- unsigned long reg_a2, unsigned long reg_a3);
-
-static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream,
- UInt32 outSize);
-
-#ifdef CONFIG_PASS_KARGS
-#define ENVV(n,v) {.name = (n), .value = (v)}
-struct env_var env_vars[] = {
- ENVV("board_name", CONFIG_BOARD_NAME),
- ENVV(NULL, NULL)
-};
-#endif
-
-static void halt(void)
-{
- printf("\nSystem halted!\n");
- for(;;);
-}
-
-#if (LZMA_WRAPPER)
-extern unsigned char _lzma_data_start[];
-extern unsigned char _lzma_data_end[];
-
-unsigned char *data;
-unsigned long datalen;
-
-static __inline__ unsigned char get_byte(void)
-{
- datalen--;
- return *data++;
-}
-
-static void decompress_init(void)
-{
- data = _lzma_data_start;
- datalen = _lzma_data_end - _lzma_data_start;
-}
-
-static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream,
- SizeT outSize)
-{
- SizeT ip, op;
-
- return LzmaDecode(vs, data, datalen, &ip, outStream, outSize, &op);
-}
-#endif /* LZMA_WRAPPER */
-
-#if !(LZMA_WRAPPER)
-
-#define FLASH_BANK_SIZE (2<<20)
-
-static unsigned char *flash_base = (unsigned char *) KSEG1ADDR(ADM5120_FLASH_START);
-static unsigned long flash_ofs = 0;
-static unsigned long flash_max = 0;
-static unsigned long flash_ofs_mask = (FLASH_BANK_SIZE-1);
-
-static __inline__ unsigned char get_byte(void)
-{
- return *(flash_base+flash_ofs++);
-}
-
-static int lzma_read_byte(void *object, const unsigned char **buffer,
- SizeT *bufferSize)
-{
- unsigned long len;
-
- if (flash_ofs >= flash_max)
- return LZMA_RESULT_DATA_ERROR;
-
- len = flash_max-flash_ofs;
-
-#if (CONFIG_FLASH_SIZE > FLASH_BANK_SIZE)
- if (flash_ofs < FLASH_BANK_SIZE) {
- /* switch to bank 0 */
- DBG("lzma_read_byte: switch to bank 0\n");
-
- if (len > FLASH_BANK_SIZE-flash_ofs)
- len = FLASH_BANK_SIZE-flash_ofs;
- } else {
- /* switch to bank 1 */
- DBG("lzma_read_byte: switch to bank 1\n");
- }
-#endif
- DBG("lzma_read_byte: ofs=%08X, len=%08X\n", flash_ofs, len);
-
- *buffer = flash_base+(flash_ofs & flash_ofs_mask);
- *bufferSize = len;
- flash_ofs += len;
-
- return LZMA_RESULT_OK;
-}
-
-static ILzmaInCallback lzma_callback = {
- .Read = lzma_read_byte,
-};
-
-static __inline__ unsigned int read_le32(void *buf)
-{
- unsigned char *p = buf;
-
- return ((unsigned int)p[0] + ((unsigned int)p[1] << 8) +
- ((unsigned int)p[2] << 16) +((unsigned int)p[3] << 24));
-}
-
-static void decompress_init(void)
-{
- struct trx_header *hdr = NULL;
- unsigned long kofs,klen;
-
- printf("Looking for TRX header... ");
- /* look for trx header, 32-bit data access */
- for (flash_ofs = 0; flash_ofs < FLASH_BANK_SIZE; flash_ofs += TRX_ALIGN) {
- if (read_le32(&flash_base[flash_ofs]) == TRX_MAGIC) {
- hdr = (struct trx_header *)&flash_base[flash_ofs];
- break;
- }
- }
-
- if (hdr == NULL) {
- printf("not found!\n");
- /* no compressed kernel found, halting */
- halt();
- }
-
- /* compressed kernel is in the partition 0 or 1 */
- kofs = read_le32(&hdr->offsets[1]);
- if (kofs == 0 || kofs > 65536) {
- klen = kofs-read_le32(&hdr->offsets[0]);
- kofs = read_le32(&hdr->offsets[0]);
- } else {
- klen = read_le32(&hdr->offsets[2]);
- if (klen > kofs)
- klen -= kofs;
- else
- klen = read_le32(&hdr->len)-kofs;
- }
-
- printf("found at %08X, kernel:%08X len:%08X\n", flash_ofs,
- kofs, klen);
-
- flash_ofs += kofs;
- flash_max = flash_ofs+klen;
-}
-
-static int decompress_data(CLzmaDecoderState *vs, unsigned char *outStream,
- SizeT outSize)
-{
- SizeT op;
-
-#if 0
- vs->Buffer = data;
- vs->BufferLim = datalen;
-#endif
-
- return LzmaDecode(vs, &lzma_callback, outStream, outSize, &op);
-}
-#endif /* !(LZMA_WRAPPER) */
-
-/* should be the first function */
-void decompress_entry(unsigned long reg_a0, unsigned long reg_a1,
- unsigned long reg_a2, unsigned long reg_a3,
- unsigned long icache_size, unsigned long icache_lsize,
- unsigned long dcache_size, unsigned long dcache_lsize)
-{
- unsigned char props[LZMA_PROPERTIES_SIZE];
- unsigned int i; /* temp value */
- SizeT osize; /* uncompressed size */
- int res;
-
- board_init();
-
- printf("\n\nLZMA loader for " CONFIG_BOARD_NAME
- ", Copyright (C) 2007-2008 OpenWrt.org\n\n");
-
- decompress_init();
-
- /* lzma args */
- for (i = 0; i < LZMA_PROPERTIES_SIZE; i++)
- props[i] = get_byte();
-
- /* skip rest of the LZMA coder property */
- /* read the lower half of uncompressed size in the header */
- osize = ((SizeT)get_byte()) +
- ((SizeT)get_byte() << 8) +
- ((SizeT)get_byte() << 16) +
- ((SizeT)get_byte() << 24);
-
- /* skip rest of the header (upper half of uncompressed size) */
- for (i = 0; i < 4; i++)
- get_byte();
-
- res = LzmaDecodeProperties(&lzma_state.Properties, props,
- LZMA_PROPERTIES_SIZE);
- if (res != LZMA_RESULT_OK) {
- printf("Incorrect LZMA stream properties!\n");
- halt();
- }
-
- printf("decompressing kernel... ");
-
- lzma_state.Probs = (CProb *)workspace;
- res = decompress_data(&lzma_state, (unsigned char *)LOADADDR, osize);
-
- if (res != LZMA_RESULT_OK) {
- printf("failed, ");
- switch (res) {
- case LZMA_RESULT_DATA_ERROR:
- printf("data error!\n");
- break;
- default:
- printf("unknown error %d!\n", res);
- }
- halt();
- } else
- printf("done!\n");
-
- blast_dcache(dcache_size, dcache_lsize);
- blast_icache(icache_size, icache_lsize);
-
- printf("launching kernel...\n\n");
-
-#ifdef CONFIG_PASS_KARGS
- reg_a0 = 0;
- reg_a1 = 0;
- reg_a2 = (unsigned long)env_vars;
- reg_a3 = 0;
-#endif
- /* Jump to load address */
- ((kernel_entry) LOADADDR)(reg_a0, reg_a1, reg_a2, reg_a3);
-}
+++ /dev/null
-/* Copyright 2007 Gabor Juhos <juhosg@freemail.hu> */
-/* keep original values of the a0,a1,a2,a3 registers */
-/* modifed to support user defined entry point address */
-/* Copyright 2005 Oleg I. Vdovikin (oleg@cs.msu.su) */
-/* cache manipulation adapted from Broadcom code */
-/* idea taken from original bunzip2 decompressor code */
-/* Copyright 2004 Manuel Novoa III (mjn3@codepoet.org) */
-/* Licensed under the linux kernel's version of the GPL.*/
-
-#include <asm/asm.h>
-#include <asm/regdef.h>
-
-#define KSEG0 0x80000000
-
-#define C0_STATUS $12
-#define C0_CAUSE $13
-#define C0_CONFIG $16
-#define C0_WATCHLO $18
-#define C0_WATCHHI $19
-#define C0_TAGLO $28
-#define C0_TAGHI $29
-
-#define CONF1_DA_SHIFT 7 /* D$ associativity */
-#define CONF1_DA_MASK 0x00000380
-#define CONF1_DA_BASE 1
-#define CONF1_DL_SHIFT 10 /* D$ line size */
-#define CONF1_DL_MASK 0x00001c00
-#define CONF1_DL_BASE 2
-#define CONF1_DS_SHIFT 13 /* D$ sets/way */
-#define CONF1_DS_MASK 0x0000e000
-#define CONF1_DS_BASE 64
-#define CONF1_IA_SHIFT 16 /* I$ associativity */
-#define CONF1_IA_MASK 0x00070000
-#define CONF1_IA_BASE 1
-#define CONF1_IL_SHIFT 19 /* I$ line size */
-#define CONF1_IL_MASK 0x00380000
-#define CONF1_IL_BASE 2
-#define CONF1_IS_SHIFT 22 /* Instruction cache sets/way */
-#define CONF1_IS_MASK 0x01c00000
-#define CONF1_IS_BASE 64
-
-#define Index_Invalidate_I 0x00
-#define Index_Writeback_Inv_D 0x01
-
- .text
-
-#if (LZMA_STARTUP_ORG)
- .set noreorder
-
- b startup
- nop
-
- .org LZMA_STARTUP_ORG
-#endif
-
-LEAF(startup)
- .set noreorder
- .set mips32
-
- mtc0 zero, C0_WATCHLO # clear watch registers
- mtc0 zero, C0_WATCHHI
-
- mtc0 zero, C0_CAUSE # clear before writing status register
-
- mfc0 t0, C0_STATUS # get status register
- li t1, ~(0xFF01)
- and t0, t1 # mask interrupts
- mtc0 t0, C0_STATUS # set up status register
-
- move t1, ra # save return address
- la t0, __reloc_label # get linked address of label
- bal __reloc_label # branch and link to label to
- nop # get actual address
-__reloc_label:
- subu t0, ra, t0 # get reloc_delta
- move ra, t1 # restore return address
-
- beqz t0, __reloc_end # if delta is 0 we are in the right place
- nop
-
- /* Copy our code to the right place */
- la t1, _code_start # get linked address of _code_start
- la t2, _code_end # get linked address of _code_end
- addu t0, t0, t1 # calculate actual address of _code_start
-
-__reloc_copy:
- lw t3, 0(t0)
- sw t3, 0(t1)
- add t1, 4
- blt t1, t2, __reloc_copy
- add t0, 4
-
-__reloc_end:
-
- /* At this point we need to invalidate dcache and */
- /* icache before jumping to new code */
-
-1: /* Get cache sizes */
- .set mips32
- mfc0 s0,C0_CONFIG,1
- .set mips0
-
- li s1,CONF1_DL_MASK
- and s1,s0
- beq s1,zero,nodc
- nop
-
- srl s1,CONF1_DL_SHIFT
- li t0,CONF1_DL_BASE
- sll s1,t0,s1 /* s1 has D$ cache line size */
-
- li s2,CONF1_DA_MASK
- and s2,s0
- srl s2,CONF1_DA_SHIFT
- addiu s2,CONF1_DA_BASE /* s2 now has D$ associativity */
-
- li t0,CONF1_DS_MASK
- and t0,s0
- srl t0,CONF1_DS_SHIFT
- li s3,CONF1_DS_BASE
- sll s3,s3,t0 /* s3 has D$ sets per way */
-
- multu s2,s3 /* sets/way * associativity */
- mflo t0 /* total cache lines */
-
- multu s1,t0 /* D$ linesize * lines */
- mflo s2 /* s2 is now D$ size in bytes */
-
- /* Initilize the D$: */
- mtc0 zero,C0_TAGLO
- mtc0 zero,C0_TAGHI
-
- li t0,KSEG0 /* Just an address for the first $ line */
- addu t1,t0,s2 /* + size of cache == end */
-
- .set mips3
-1: cache Index_Writeback_Inv_D,0(t0)
- .set mips0
- bne t0,t1,1b
- addu t0,s1
-
-nodc:
- /* Now we get to do it all again for the I$ */
-
- move s3,zero /* just in case there is no icache */
- move s4,zero
-
- li t0,CONF1_IL_MASK
- and t0,s0
- beq t0,zero,noic
- nop
-
- srl t0,CONF1_IL_SHIFT
- li s3,CONF1_IL_BASE
- sll s3,t0 /* s3 has I$ cache line size */
-
- li t0,CONF1_IA_MASK
- and t0,s0
- srl t0,CONF1_IA_SHIFT
- addiu s4,t0,CONF1_IA_BASE /* s4 now has I$ associativity */
-
- li t0,CONF1_IS_MASK
- and t0,s0
- srl t0,CONF1_IS_SHIFT
- li s5,CONF1_IS_BASE
- sll s5,t0 /* s5 has I$ sets per way */
-
- multu s4,s5 /* sets/way * associativity */
- mflo t0 /* s4 is now total cache lines */
-
- multu s3,t0 /* I$ linesize * lines */
- mflo s4 /* s4 is cache size in bytes */
-
- /* Initilize the I$: */
- mtc0 zero,C0_TAGLO
- mtc0 zero,C0_TAGHI
-
- li t0,KSEG0 /* Just an address for the first $ line */
- addu t1,t0,s4 /* + size of cache == end */
-
- .set mips3
-1: cache Index_Invalidate_I,0(t0)
- .set mips0
- bne t0,t1,1b
- addu t0,s3
-
-noic:
- /* Setup new "C" stack */
- la sp, _stack
-
- addiu sp, -32 /* reserve stack for parameters */
-#if 0
- sw a0, 0(sp)
- sw a1, 4(sp)
- sw a2, 8(sp)
- sw a3, 12(sp)
-#endif
- sw s4, 16(sp) /* icache size */
- sw s3, 20(sp) /* icache line size */
- sw s2, 24(sp) /* dcache size */
- sw s1, 28(sp) /* dcache line size */
-
- /* jump to the decompressor routine */
- la t0, decompress_entry
- jr t0
- nop
-
- .set reorder
-END(startup)
+++ /dev/null
-OUTPUT_ARCH(mips)
-SECTIONS {
- .text : {
- _code_start = .;
- *(.text)
- *(.text.*)
- *(.rodata)
- *(.rodata.*)
- . = ALIGN(16);
- *(.data.lzma)
- }
-
- .data : {
- *(.data)
- *(.data.*)
- }
- _code_end = .;
-
- .bss : {
- *(.bss)
- *(.bss.*)
- }
-
- . = ALIGN(16);
- . = . + 8192;
- _stack = .;
-
- workspace = .;
-}
+++ /dev/null
-OUTPUT_ARCH(mips)
-SECTIONS {
- .data.lzma : {
- _lzma_data_start = .;
- *(.data)
- _lzma_data_end = .;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * 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.
- *
- */
-
-#include "printf.h"
-
-extern void board_putc(int ch);
-
-/* this is the maximum width for a variable */
-#define LP_MAX_BUF 256
-
-/* macros */
-#define IsDigit(x) ( ((x) >= '0') && ((x) <= '9') )
-#define Ctod(x) ( (x) - '0')
-
-/* forward declaration */
-static int PrintChar(char *, char, int, int);
-static int PrintString(char *, char *, int, int);
-static int PrintNum(char *, unsigned long, int, int, int, int, char, int);
-
-/* private variable */
-static const char theFatalMsg[] = "fatal error in lp_Print!";
-
-/* -*-
- * A low level printf() function.
- */
-static void
-lp_Print(void (*output)(void *, char *, int),
- void * arg,
- char *fmt,
- va_list ap)
-{
-
-#define OUTPUT(arg, s, l) \
- { if (((l) < 0) || ((l) > LP_MAX_BUF)) { \
- (*output)(arg, (char*)theFatalMsg, sizeof(theFatalMsg)-1); for(;;); \
- } else { \
- (*output)(arg, s, l); \
- } \
- }
-
- char buf[LP_MAX_BUF];
-
- char c;
- char *s;
- long int num;
-
- int longFlag;
- int negFlag;
- int width;
- int prec;
- int ladjust;
- char padc;
-
- int length;
-
- for(;;) {
- {
- /* scan for the next '%' */
- char *fmtStart = fmt;
- while ( (*fmt != '\0') && (*fmt != '%')) {
- fmt ++;
- }
-
- /* flush the string found so far */
- OUTPUT(arg, fmtStart, fmt-fmtStart);
-
- /* are we hitting the end? */
- if (*fmt == '\0') break;
- }
-
- /* we found a '%' */
- fmt ++;
-
- /* check for long */
- if (*fmt == 'l') {
- longFlag = 1;
- fmt ++;
- } else {
- longFlag = 0;
- }
-
- /* check for other prefixes */
- width = 0;
- prec = -1;
- ladjust = 0;
- padc = ' ';
-
- if (*fmt == '-') {
- ladjust = 1;
- fmt ++;
- }
-
- if (*fmt == '0') {
- padc = '0';
- fmt++;
- }
-
- if (IsDigit(*fmt)) {
- while (IsDigit(*fmt)) {
- width = 10 * width + Ctod(*fmt++);
- }
- }
-
- if (*fmt == '.') {
- fmt ++;
- if (IsDigit(*fmt)) {
- prec = 0;
- while (IsDigit(*fmt)) {
- prec = prec*10 + Ctod(*fmt++);
- }
- }
- }
-
-
- /* check format flag */
- negFlag = 0;
- switch (*fmt) {
- case 'b':
- if (longFlag) {
- num = va_arg(ap, long int);
- } else {
- num = va_arg(ap, int);
- }
- length = PrintNum(buf, num, 2, 0, width, ladjust, padc, 0);
- OUTPUT(arg, buf, length);
- break;
-
- case 'd':
- case 'D':
- if (longFlag) {
- num = va_arg(ap, long int);
- } else {
- num = va_arg(ap, int);
- }
- if (num < 0) {
- num = - num;
- negFlag = 1;
- }
- length = PrintNum(buf, num, 10, negFlag, width, ladjust, padc, 0);
- OUTPUT(arg, buf, length);
- break;
-
- case 'o':
- case 'O':
- if (longFlag) {
- num = va_arg(ap, long int);
- } else {
- num = va_arg(ap, int);
- }
- length = PrintNum(buf, num, 8, 0, width, ladjust, padc, 0);
- OUTPUT(arg, buf, length);
- break;
-
- case 'u':
- case 'U':
- if (longFlag) {
- num = va_arg(ap, long int);
- } else {
- num = va_arg(ap, int);
- }
- length = PrintNum(buf, num, 10, 0, width, ladjust, padc, 0);
- OUTPUT(arg, buf, length);
- break;
-
- case 'x':
- if (longFlag) {
- num = va_arg(ap, long int);
- } else {
- num = va_arg(ap, int);
- }
- length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 0);
- OUTPUT(arg, buf, length);
- break;
-
- case 'X':
- if (longFlag) {
- num = va_arg(ap, long int);
- } else {
- num = va_arg(ap, int);
- }
- length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 1);
- OUTPUT(arg, buf, length);
- break;
-
- case 'c':
- c = (char)va_arg(ap, int);
- length = PrintChar(buf, c, width, ladjust);
- OUTPUT(arg, buf, length);
- break;
-
- case 's':
- s = (char*)va_arg(ap, char *);
- length = PrintString(buf, s, width, ladjust);
- OUTPUT(arg, buf, length);
- break;
-
- case '\0':
- fmt --;
- break;
-
- default:
- /* output this char as it is */
- OUTPUT(arg, fmt, 1);
- } /* switch (*fmt) */
-
- fmt ++;
- } /* for(;;) */
-
- /* special termination call */
- OUTPUT(arg, "\0", 1);
-}
-
-
-/* --------------- local help functions --------------------- */
-static int
-PrintChar(char * buf, char c, int length, int ladjust)
-{
- int i;
-
- if (length < 1) length = 1;
- if (ladjust) {
- *buf = c;
- for (i=1; i< length; i++) buf[i] = ' ';
- } else {
- for (i=0; i< length-1; i++) buf[i] = ' ';
- buf[length - 1] = c;
- }
- return length;
-}
-
-static int
-PrintString(char * buf, char* s, int length, int ladjust)
-{
- int i;
- int len=0;
- char* s1 = s;
- while (*s1++) len++;
- if (length < len) length = len;
-
- if (ladjust) {
- for (i=0; i< len; i++) buf[i] = s[i];
- for (i=len; i< length; i++) buf[i] = ' ';
- } else {
- for (i=0; i< length-len; i++) buf[i] = ' ';
- for (i=length-len; i < length; i++) buf[i] = s[i-length+len];
- }
- return length;
-}
-
-static int
-PrintNum(char * buf, unsigned long u, int base, int negFlag,
- int length, int ladjust, char padc, int upcase)
-{
- /* algorithm :
- * 1. prints the number from left to right in reverse form.
- * 2. fill the remaining spaces with padc if length is longer than
- * the actual length
- * TRICKY : if left adjusted, no "0" padding.
- * if negtive, insert "0" padding between "0" and number.
- * 3. if (!ladjust) we reverse the whole string including paddings
- * 4. otherwise we only reverse the actual string representing the num.
- */
-
- int actualLength =0;
- char *p = buf;
- int i;
-
- do {
- int tmp = u %base;
- if (tmp <= 9) {
- *p++ = '0' + tmp;
- } else if (upcase) {
- *p++ = 'A' + tmp - 10;
- } else {
- *p++ = 'a' + tmp - 10;
- }
- u /= base;
- } while (u != 0);
-
- if (negFlag) {
- *p++ = '-';
- }
-
- /* figure out actual length and adjust the maximum length */
- actualLength = p - buf;
- if (length < actualLength) length = actualLength;
-
- /* add padding */
- if (ladjust) {
- padc = ' ';
- }
- if (negFlag && !ladjust && (padc == '0')) {
- for (i = actualLength-1; i< length-1; i++) buf[i] = padc;
- buf[length -1] = '-';
- } else {
- for (i = actualLength; i< length; i++) buf[i] = padc;
- }
-
-
- /* prepare to reverse the string */
- {
- int begin = 0;
- int end;
- if (ladjust) {
- end = actualLength - 1;
- } else {
- end = length -1;
- }
-
- while (end > begin) {
- char tmp = buf[begin];
- buf[begin] = buf[end];
- buf[end] = tmp;
- begin ++;
- end --;
- }
- }
-
- /* adjust the string pointer */
- return length;
-}
-
-static void printf_output(void *arg, char *s, int l)
-{
- int i;
-
- // special termination call
- if ((l==1) && (s[0] == '\0')) return;
-
- for (i=0; i< l; i++) {
- board_putc(s[i]);
- if (s[i] == '\n') board_putc('\r');
- }
-}
-
-void printf(char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- lp_Print(printf_output, 0, fmt, ap);
- va_end(ap);
-}
+++ /dev/null
-/*
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * 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.
- *
- */
-
-#ifndef _printf_h_
-#define _printf_h_
-
-#include <stdarg.h>
-void printf(char *fmt, ...);
-
-#endif /* _printf_h_ */
+++ /dev/null
-#
-# Copyright (C) 2007,2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-
-define Image/cmdline/yaffs2
- root=/dev/mtdblock3 rootfstype=yaffs2
-endef
-
-define Image/BuildKernel/RouterBoard
- $(CP) $(KDIR)/vmlinux-initramfs.elf $(call imgname,kernel-initramfs,rb1xx)
- $(STAGING_DIR_HOST)/bin/patch-cmdline $(call imgname,kernel-initramfs,rb1xx) \
- '$(strip $(call Image/cmdline/yaffs2))'
-endef
-
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
- define Image/BuildKernel
- $(call Image/BuildKernel/RouterBoard)
- endef
-endif
-
+++ /dev/null
-#
-# Copyright (C) 2007,2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Image/Build/ZyXEL
- $(call Image/Build/Loader,$(2),bin,0x80500000,0,y,$(2))
- $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
- $(STAGING_DIR_HOST)/bin/mkzynfw -B $(2) \
- -b $(KDIR)/loader-$(2).bin \
- -r $(call imgname,$(1),$(2)).trx:0x10000 \
- -o $(call imgname,$(1),$(2))-webui.bin
-endef
-
-define Image/Build/Template/ZyXEL
- $(call Image/Build/ZyXEL,$(1),$(2))
-endef
-
-define Image/Build/Template/ZyXEL/squashfs
- $(call Image/Build/Template/ZyXEL,squashfs,$(1))
-endef
-
-define Image/Build/Template/ZyXEL/jffs2
- $(call Image/Build/Template/ZyXEL,jffs2,$(1))
-endef
-
-define Image/Build/Template/ZyXEL/Initramfs
- $(call Image/Build/LZMAKernel/KArgs,$(1),bin)
-endef
-
-#
-# Profiles
-#
-define Image/Build/Profile/P334WT
- $(call Image/Build/Template/ZyXEL/$(1),p-334wt)
-endef
-
-define Image/Build/Profile/P335WT
- $(call Image/Build/Template/ZyXEL/$(1),p-335wt)
-endef
-
-define Image/Build/Profile/Generic
- $(call Image/Build/Profile/P334WT,$(1))
- $(call Image/Build/Profile/P335WT,$(1))
-endef
-
+++ /dev/null
-#
-# Copyright (C) 2007-2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define trxedimax/jffs2-128k
--a 0x20000 -f $(KDIR)/root.jffs2-128k
-endef
-
-define trxedimax/jffs2-64k
--a 0x10000 -f $(KDIR)/root.jffs2-64k
-endef
-
-define trxedimax/squashfs
--a 1024 -f $(KDIR)/root.squashfs
-endef
-
-define Image/Build/TRXEdimax
- $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
- $(call trxedimax/$(2))
-endef
-
-define Image/Build/Compex
- $(call Image/Build/Loader,$(2),gz,0x80500000,0,y,$(2))
- $(call Image/Build/TRX,$(call imgname,$(1),$(2)).trx,$(1),$(KDIR)/loader-$(2).gz)
-endef
-
-define Image/Build/Edimax
- $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
- $(call Image/Build/TRXEdimax,$(call imgname,$(1),$(2)).trx,$(1))
- $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d -w \
- -r $(KDIR)/loader-$(2).gz::0x1000 \
- -x $(call imgname,$(1),$(2)).trx:0x10000 \
- -x $(JFFS2MARK):0x10000 \
- $(call imgname,$(1),$(2))-webui.bin
- $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \
- -r $(KDIR)/loader-$(2).gz::0x1000 \
- -x $(call imgname,$(1),$(2)).trx:0x10000 \
- -x $(JFFS2MARK):0x10000 \
- $(call imgname,$(1),$(2))-xmodem.bin
- rm -f $(call imgname,$(1),$(2)).trx
-endef
-
-define Image/Build/Osbridge
- $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
- $(call Image/Build/TRXEdimax,$(call imgname,$(1),$(2)).trx,$(1))
- $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \
- -r $(KDIR)/loader-$(2).gz::0x1000 \
- -x $(call imgname,$(1),$(2)).trx:0x10000 \
- -x $(JFFS2MARK):0x10000 \
- $(call imgname,$(1),$(2))-firmware.bin
- $(STAGING_DIR_HOST)/bin/osbridge-crc \
- -i $(call imgname,$(1),$(2))-firmware.bin \
- -o $(call imgname,$(1),$(2))-temp.bin
- $(STAGING_DIR_HOST)/bin/pc1crypt \
- -i $(call imgname,$(1),$(2))-temp.bin \
- -o $(call imgname,$(1),$(2))-webui.bin
- rm -f $(call imgname,$(1),$(2))-temp.bin
- rm -f $(call imgname,$(1),$(2)).trx
-endef
-
-define Image/Build/Infineon
- $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
- $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
- dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).img bs=64k conv=sync
- cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).img
-endef
-
-define Image/Build/Cellvision
- $(call Image/Build/Loader,$(2),bin,0x80500000,0x6D8,y,$(3))
- mkdir -p $(BIN_DIR)/tmp
- cp $(KDIR)/loader-$(2).bin $(BIN_DIR)/tmp/vmlinux.bin
- gzip -9n $(BIN_DIR)/tmp/vmlinux.bin
- dd if=$(BIN_DIR)/tmp/vmlinux.bin.gz of=$(call imgname,$(1),$(2))-xmodem.bin bs=64k conv=sync
- rm -rf $(BIN_DIR)/tmp
- $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
- cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2))-xmodem.bin
- $(STAGING_DIR_HOST)/bin/mkcasfw -B $(2) -d \
- -K $(call imgname,$(1),$(2))-xmodem.bin \
- $(call imgname,$(1),$(2))-webui.bin
-endef
-
-define Image/Build/Cellvision2
- # only for CAS-700/771/790/861
- $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(3))
- $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
- dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).bin bs=64k conv=sync
- cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).bin
- echo -ne '\x14\x07\x24\x06$(2)' | dd bs=14 count=1 conv=sync >> $(call imgname,$(1),$(2)).bin
- echo -ne 'OpenWrt\x00\x00\x00' >> $(call imgname,$(1),$(2)).bin
-endef
-
-define Image/Build/MyLoader
- $(call Image/Build/Loader,$(2),gz,0x80500000,0)
- $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
- $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) \
- -p0x20000:0x10000:ahp:0x80001000 \
- -p0x30000:0 \
- -b0x20000:0x10000:h:$(KDIR)/loader-$(2).gz \
- -b0x30000:0::$(call imgname,$(1),$(2)).trx \
- $(call imgname,$(1),$(2)).bin
-endef
-
-#
-# Cellvision CAS-630/630W, CAS-670/670W, NFS-101U/101WU, NFS-202U/202WU
-#
-define Image/Build/Template/Cellvision
- $(call Image/Build/Cellvision,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/Cellvision/squashfs
- $(call Image/Build/Template/Cellvision,squashfs,$(1),$(2))
-endef
-
-define Image/Build/Template/Cellvision/jffs2-64k
- $(call Image/Build/Template/Cellvision,jffs2-64k,$(1),$(2))
-endef
-
-#
-# Cellvision CAS-700/700W, CAS-771/771W, CAS-790, CAS-861/861W
-#
-define Image/Build/Template/Cellvision2
- $(call Image/Build/Cellvision2,$(1),$(2),$(3))
-endef
-
-define Image/Build/Template/Cellvision2/squashfs
- $(call Image/Build/Template/Cellvision2,squashfs,$(1),$(2))
-endef
-
-define Image/Build/Template/Cellvision2/jffs2-64k
- $(call Image/Build/Template/Cellvision2,jffs2-64k,$(1),$(2))
-endef
-
-define Image/Build/Template/Cellvision2/Initramfs
- $(call Image/Build/LZMAKernel/Cellvision,$(1),$(2),gz)
-endef
-
-#
-# Compex NP27G, NP28G, WP54G, WP54AG, WPP54G, WPP54AG
-#
-define Image/Build/Template/Compex
- $(call Image/Build/MyLoader,$(1),$(2))
-endef
-
-define Image/Build/Template/Compex/squashfs
- $(call Image/Build/Template/Compex,squashfs,$(1))
-endef
-
-define Image/Build/Template/Compex/jffs2-64k
- $(call Image/Build/Template/Compex,jffs2-64k,$(1))
-endef
-
-define Image/Build/Template/Compex/Initramfs
- $(call Image/Build/LZMAKernel/Generic,$(1),bin)
-endef
-
-#
-# Compex WP54G-WRT
-#
-define Image/Build/Template/WP54GWRT
- $(call Image/Build/Compex,$(1),wp54g-wrt)
-endef
-
-define Image/Build/Template/WP54GWRT/squashfs
- $(call Image/Build/Template/WP54GWRT,squashfs)
-endef
-
-define Image/Build/Template/WP54GWRT/jffs2-64k
- $(call Image/Build/Template/WP54GWRT,jffs2-64k)
-endef
-
-define Image/Build/Template/WP54GWRT/Initramfs
- $(call Image/Build/LZMAKernel/KArgs,wp54g-wrt,bin)
-endef
-
-#
-# Edimax BR-6104K, BR-6104KP, BR-6104Wg, BR-6114WG
-#
-define Image/Build/Template/Edimax
- $(call Image/Build/Edimax,$(1),$(2))
-endef
-
-define Image/Build/Template/Edimax/squashfs
- $(call Image/Build/Template/Edimax,squashfs,$(1))
-endef
-
-define Image/Build/Template/Edimax/Initramfs
- $(call Image/Build/LZMAKernel/Admboot,$(1),gz)
-endef
-
-#
-# Infineon EASY 5120, EASY 83000
-#
-define Image/Build/Template/Infineon
- $(call Image/Build/Infineon,$(1),$(2))
-endef
-
-define Image/Build/Template/Infineon/squashfs
- $(call Image/Build/Template/Infineon,squashfs,$(1))
-endef
-
-define Image/Build/Template/Infineon/jffs2-64k
- $(call Image/Build/Template/Infineon,jffs2-64k,$(1))
-endef
-
-define Image/Build/Template/Infineon/Initramfs
- $(call Image/Build/LZMAKernel/Admboot,$(1),gz)
-endef
-
-#
-# Generic EB-214A
-#
-define Image/Build/Template/Edimax/Initramfs
- $(call Image/Build/LZMAKernel/Admboot,eb-214a,bin)
-endef
-
-
-#
-# Mikrotik RouterBOARD 1xx
-#
-define Image/Build/Template/Mikrotik/Initramfs
- $(CP) $(KDIR)/vmlinux.elf $(call imgname,netboot,rb1xx)
-endef
-
-#
-# OSBRiDGE 5GXi/5XLi
-#
-define Image/Build/Template/Osbridge
- $(call Image/Build/Osbridge,$(1),$(2))
-endef
-
-define Image/Build/Template/Osbridge/squashfs
- $(call Image/Build/Template/Osbridge,squashfs,$(1))
-endef
-
-define Image/Build/Template/Osbridge/Initramfs
- $(call Image/Build/LZMAKernel/Admboot,$(1),gz)
-endef
-
-#
-# Profiles
-#
-define Image/Build/Profile/CAS630
- $(call Image/Build/Template/Cellvision/$(1),cas-630,cas-630)
-endef
-
-define Image/Build/Profile/CAS630W
- $(call Image/Build/Template/Cellvision/$(1),cas-630w,cas-630)
-endef
-
-define Image/Build/Profile/CAS670
- $(call Image/Build/Template/Cellvision/$(1),cas-670,cas-670)
-endef
-
-define Image/Build/Profile/CAS670W
- $(call Image/Build/Template/Cellvision/$(1),cas-670w,cas-670)
-endef
-
-define Image/Build/Profile/NFS101U
- $(call Image/Build/Template/Cellvision/$(1),nfs-101u,nfs-101u)
- $(call Image/Build/Template/Cellvision/$(1),dn-7013,nfs-101u)
- $(call Image/Build/Template/Cellvision/$(1),dns-120,nfs-101u)
- $(call Image/Build/Template/Cellvision/$(1),mu-5000fs,nfs-101u)
- $(call Image/Build/Template/Cellvision/$(1),tn-u100,nfs-101u)
- $(call Image/Build/Template/Cellvision/$(1),cg-nsadp,nfs-101u)
-endef
-
-define Image/Build/Profile/NFS101WU
- $(call Image/Build/Template/Cellvision/$(1),nfs-101wu,nfs-101u)
- $(call Image/Build/Template/Cellvision/$(1),dns-g120,nfs-101u)
-endef
-
-define Image/Build/Profile/CAS700
- $(call Image/Build/Template/Cellvision2/$(1),cas-700,cas-700)
-endef
-
-define Image/Build/Profile/CAS700W
- $(call Image/Build/Template/Cellvision2/$(1),cas-700w,cas-700)
-endef
-
-define Image/Build/Profile/CAS771
- $(call Image/Build/Template/Cellvision2/$(1),cas-771,cas-771)
-endef
-
-define Image/Build/Profile/CAS771W
- $(call Image/Build/Template/Cellvision2/$(1),cas-771w,cas-771)
-endef
-
-define Image/Build/Profile/CAS790
- $(call Image/Build/Template/Cellvision2/$(1),cas-790,cas-790)
-endef
-
-define Image/Build/Profile/CAS861
- $(call Image/Build/Template/Cellvision2/$(1),cas-861,cas-861)
-endef
-
-define Image/Build/Profile/CAS861W
- $(call Image/Build/Template/Cellvision2/$(1),cas-861w,cas-861)
-endef
-
-define Image/Build/Profile/NP27G
- $(call Image/Build/Template/Compex/$(1),np27g)
-endef
-
-define Image/Build/Profile/NP28G
- $(call Image/Build/Template/Compex/$(1),np28g)
-endef
-
-define Image/Build/Profile/WP54
- $(call Image/Build/Template/Compex/$(1),wp54g)
- $(call Image/Build/Template/Compex/$(1),wp54ag)
- $(call Image/Build/Template/Compex/$(1),wpp54g)
- $(call Image/Build/Template/Compex/$(1),wpp54ag)
- $(call Image/Build/Template/WP54GWRT/$(1))
-endef
-
-define Image/Build/Profile/BR6104K
- $(call Image/Build/Template/Edimax/$(1),br-6104k)
-endef
-
-define Image/Build/Profile/BR6104KP
- $(call Image/Build/Template/Edimax/$(1),br-6104kp)
-endef
-
-define Image/Build/Profile/BR6104WG
- $(call Image/Build/Template/Edimax/$(1),br-6104wg)
-endef
-
-define Image/Build/Profile/BR6114WG
- $(call Image/Build/Template/Edimax/$(1),br-6114wg)
-endef
-
-define Image/Build/Profile/EASY83000
- $(call Image/Build/Template/Infineon/$(1),easy-83000)
-endef
-
-define Image/Build/Profile/EASY5120RT
- $(call Image/Build/Template/Infineon/$(1),easy-5120-rt)
-endef
-
-define Image/Build/Profile/EASY5120PATA
- $(call Image/Build/Template/Infineon/$(1),easy-5120p-ata)
-endef
-
-define Image/Build/Profile/PMUGW
- $(call Image/Build/Template/Infineon/$(1),powerline-mugw)
-endef
-
-define Image/Build/Profile/5GXI
- $(call Image/Build/Template/Osbridge/$(1),5gxi)
-endef
-
-define Image/Build/Profile/RouterBoard
- $(call Image/Build/Template/Mikrotik/$(1))
-endef
-
-ifeq ($(CONFIG_BROKEN),y)
- define Image/Build/Experimental
- # Cellvison
- $(call Image/Build/Profile/CAS630,$(1))
- $(call Image/Build/Profile/CAS630W,$(1))
- $(call Image/Build/Profile/CAS670,$(1))
- $(call Image/Build/Profile/CAS670W,$(1))
- $(call Image/Build/Profile/CAS700,$(1))
- $(call Image/Build/Profile/CAS700W,$(1))
- $(call Image/Build/Profile/CAS771,$(1))
- $(call Image/Build/Profile/CAS771W,$(1))
- $(call Image/Build/Profile/CAS861,$(1))
- $(call Image/Build/Profile/CAS861W,$(1))
- # Motorola
- $(call Image/Build/Profile/PMUGW,$(1))
- # OSBRiDGE
- $(call Image/Build/Profile/5GXI,$(1))
- endef
-endif
-
-define Image/Build/Profile/Generic
- # Cellvision
- $(call Image/Build/Profile/NFS101U,$(1))
- $(call Image/Build/Profile/NFS101WU,$(1))
- # Compex
- $(call Image/Build/Profile/WP54,$(1))
- $(call Image/Build/Profile/NP27G,$(1))
- $(call Image/Build/Profile/NP28G,$(1))
- # Edimax
- $(call Image/Build/Profile/BR6104K,$(1))
- $(call Image/Build/Profile/BR6104KP,$(1))
- $(call Image/Build/Profile/BR6104WG,$(1))
- $(call Image/Build/Profile/BR6114WG,$(1))
- $(call Image/Build/Profile/EB214A,$(1))
- # Infineon
- $(call Image/Build/Profile/EASY83000,$(1))
- $(call Image/Build/Profile/EASY5120RT,$(1))
- $(call Image/Build/Profile/EASY5120PATA,$(1))
- # Mikrotik
- $(call Image/Build/Profile/RB1xx/$(1))
-
- $(call Image/Build/Experimental,$(1))
-endef
+++ /dev/null
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define KernelPackage/ledtrig-adm5120-switch
- SUBMENU:=$(OTHER_MENU)
- TITLE:=LED ADM5120 Switch Port Status Trigger
- DEPENDS:=@TARGET_adm5120
- KCONFIG:=CONFIG_LEDS_TRIGGER_ADM5120_SWITCH
- FILES:=$(LINUX_DIR)/drivers/leds/ledtrig-adm5120-switch.ko
- AUTOLOAD:=$(call AutoLoad,50,ledtrig-adm5120-switch)
-endef
-
-define KernelPackage/ledtrig-adm5120-switch/description
- Kernel module to allow LEDs to be controlled by the port states
- of the ADM5120 built-in ethernet switch.
-endef
-
-$(eval $(call KernelPackage,ledtrig-adm5120-switch))
-
-
-define KernelPackage/pata-rb153-cf
- SUBMENU:=$(BLOCK_MENU)
- TITLE:=RouterBOARD 153 CF Slot support
- DEPENDS:=@TARGET_adm5120_rb1xx
- KCONFIG:=CONFIG_PATA_RB153_CF
- FILES:=$(LINUX_DIR)/drivers/ata/pata_rb153_cf.ko
- AUTOLOAD:=$(call AutoLoad,30,pata_rb153_cf,1)
- $(call AddDepends/ata)
-endef
-
-define KernelPackage/pata-rb153-cf/description
- Kernel support for the RouterBoard 153 CF slot.
-endef
-
-$(eval $(call KernelPackage,pata-rb153-cf,1))
-
-
-define KernelPackage/usb-adm5120
- SUBMENU:=$(USB_MENU)
- TITLE:=Support for the ADM5120 HCD controller
- DEPENDS:=@TARGET_adm5120
- KCONFIG:=CONFIG_USB_ADM5120_HCD
- FILES:=$(LINUX_DIR)/drivers/usb/host/adm5120-hcd.ko
- AUTOLOAD:=$(call AutoLoad,50,adm5120-hcd,1)
- $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-adm5120/description
- Kernel support for the ADM5120 HCD USB controller
-endef
-
-$(eval $(call KernelPackage,usb-adm5120))
+++ /dev/null
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -60,6 +60,24 @@ choice
- prompt "System type"
- default SGI_IP22
-
-+config ADM5120
-+ bool "Infineon/ADMtek ADM5120 SoC based machines"
-+ select BOOT_RAW
-+ select NO_EXCEPT_FILL
-+ select CEVT_R4K
-+ select CSRC_R4K
-+ select SYS_HAS_CPU_MIPS32_R1
-+ select SYS_HAS_EARLY_PRINTK
-+ select DMA_NONCOHERENT
-+ select IRQ_CPU
-+ select SYS_SUPPORTS_LITTLE_ENDIAN
-+ select SYS_SUPPORTS_BIG_ENDIAN
-+ select SYS_SUPPORTS_32BIT_KERNEL
-+ select ARCH_REQUIRE_GPIOLIB
-+ select SWAP_IO_SPACE if CPU_BIG_ENDIAN
-+ select MIPS_MACHINE
-+ select HAVE_CLK
-+
- config MIPS_ALCHEMY
- bool "Alchemy processor based machines"
- select 64BIT_PHYS_ADDR
-@@ -834,6 +852,7 @@ config MIPS_PARAVIRT
-
- endchoice
-
-+source "arch/mips/adm5120/Kconfig"
- source "arch/mips/alchemy/Kconfig"
- source "arch/mips/ath79/Kconfig"
- source "arch/mips/bcm47xx/Kconfig"
---- a/arch/mips/Kbuild.platforms
-+++ b/arch/mips/Kbuild.platforms
-@@ -1,5 +1,6 @@
- # All platforms listed in alphabetic order
-
-+platforms += adm5120
- platforms += alchemy
- platforms += ar7
- platforms += ath79
+++ /dev/null
---- a/drivers/mtd/maps/Kconfig
-+++ b/drivers/mtd/maps/Kconfig
-@@ -399,4 +399,8 @@ config MTD_LATCH_ADDR
-
- If compiled as a module, it will be called latch-addr-flash.
-
-+config MTD_ADM5120
-+ tristate "Map driver for ADM5120 based boards"
-+ depends on ADM5120
-+
- endmenu
---- a/drivers/mtd/maps/Makefile
-+++ b/drivers/mtd/maps/Makefile
-@@ -30,6 +30,7 @@ obj-$(CONFIG_MTD_SUN_UFLASH) += sun_ufla
- obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o
- obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
- obj-$(CONFIG_MTD_PCI) += pci.o
-+obj-$(CONFIG_MTD_ADM5120) += adm5120-flash.o
- obj-$(CONFIG_MTD_IMPA7) += impa7.o
- obj-$(CONFIG_MTD_UCLINUX) += uclinux.o
- obj-$(CONFIG_MTD_NETtel) += nettel.o
+++ /dev/null
---- a/drivers/net/Kconfig
-+++ b/drivers/net/Kconfig
-@@ -263,6 +263,10 @@ source "drivers/net/dsa/Kconfig"
-
- source "drivers/net/ethernet/Kconfig"
-
-+config ADM5120_ENET
-+ tristate "ADM5120 Ethernet switch support"
-+ depends on ADM5120
-+
- source "drivers/net/fddi/Kconfig"
-
- source "drivers/net/hippi/Kconfig"
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -34,6 +34,7 @@ obj-$(CONFIG_CAN) += can/
- obj-$(CONFIG_ETRAX_ETHERNET) += cris/
- obj-$(CONFIG_NET_DSA) += dsa/
- obj-$(CONFIG_ETHERNET) += ethernet/
-+obj-$(CONFIG_ADM5120_ENET) += adm5120sw.o
- obj-$(CONFIG_FDDI) += fddi/
- obj-$(CONFIG_HIPPI) += hippi/
- obj-$(CONFIG_HAMRADIO) += hamradio/
+++ /dev/null
---- a/drivers/usb/Makefile
-+++ b/drivers/usb/Makefile
-@@ -12,6 +12,7 @@ obj-$(CONFIG_USB_DWC2) += dwc2/
- obj-$(CONFIG_USB_MON) += mon/
-
- obj-$(CONFIG_PCI) += host/
-+obj-$(CONFIG_USB_ADM5120_HCD) += host/
- obj-$(CONFIG_USB_EHCI_HCD) += host/
- obj-$(CONFIG_USB_ISP116X_HCD) += host/
- obj-$(CONFIG_USB_OHCI_HCD) += host/
---- a/drivers/usb/host/Kconfig
-+++ b/drivers/usb/host/Kconfig
-@@ -3,6 +3,10 @@
- #
- comment "USB Host Controller Drivers"
-
-+config USB_ADM5120_HCD
-+ tristate "ADM5120 HCD support (EXPERIMENTAL)"
-+ depends on USB && ADM5120 && EXPERIMENTAL
-+
- config USB_C67X00_HCD
- tristate "Cypress C67x00 HCD support"
- help
---- a/drivers/usb/host/Makefile
-+++ b/drivers/usb/host/Makefile
-@@ -31,6 +31,7 @@ obj-$(CONFIG_PCI) += pci-quirks.o
- obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
- obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o
-
-+obj-$(CONFIG_USB_ADM5120_HCD) += adm5120-hcd.o
- obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
- obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
- obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o
+++ /dev/null
---- a/arch/mips/pci/Makefile
-+++ b/arch/mips/pci/Makefile
-@@ -18,6 +18,7 @@ obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
- obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
- obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \
- ops-bcm63xx.o
-+obj-$(CONFIG_ADM5120) += pci-adm5120.o
- obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o
- obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o
- obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o
---- a/include/linux/pci_ids.h
-+++ b/include/linux/pci_ids.h
-@@ -1820,6 +1820,9 @@
-
- #define PCI_VENDOR_ID_CB 0x1307 /* Measurement Computing */
-
-+#define PCI_VENDOR_ID_ADMTEK 0x1317
-+#define PCI_DEVICE_ID_ADMTEK_ADM5120 0x5120
-+
- #define PCI_VENDOR_ID_SIIG 0x131f
- #define PCI_SUBVENDOR_ID_SIIG 0x131f
- #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000
+++ /dev/null
---- a/drivers/leds/Kconfig
-+++ b/drivers/leds/Kconfig
-@@ -508,4 +508,12 @@ config LEDS_VERSATILE
- comment "LED Triggers"
- source "drivers/leds/trigger/Kconfig"
-
-+config LEDS_TRIGGER_ADM5120_SWITCH
-+ tristate "LED ADM5120 Switch Port Status Trigger"
-+ depends on LEDS_TRIGGERS && ADM5120
-+ help
-+ This allows LEDs to be controlled by the port states of
-+ the ADM5120 built-in Ethernet Switch
-+ If unsure, say N.
-+
- endif # NEW_LEDS
---- a/drivers/leds/Makefile
-+++ b/drivers/leds/Makefile
-@@ -63,3 +63,4 @@ obj-$(CONFIG_LEDS_DAC124S085) += leds-d
- # LED Triggers
- obj-$(CONFIG_LEDS_TRIGGERS) += trigger/
- obj-$(CONFIG_LEDS_TRIGGER_NETDEV) += ledtrig-netdev.o
-+obj-$(CONFIG_LEDS_TRIGGER_ADM5120_SWITCH) += ledtrig-adm5120-switch.o
+++ /dev/null
---- a/drivers/mtd/mtdpart.c
-+++ b/drivers/mtd/mtdpart.c
-@@ -30,11 +30,9 @@
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/partitions.h>
- #include <linux/of.h>
--#include <linux/magic.h>
- #include <linux/err.h>
-
- #include "mtdcore.h"
--#include "mtdsplit/mtdsplit.h"
-
- #define MTD_ERASE_PARTIAL 0x8000 /* partition only covers parts of an erase block */
-
-@@ -50,14 +48,13 @@ struct mtd_part {
- struct list_head list;
- };
-
--static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part);
--
- /*
- * Given a pointer to the MTD object in the mtd_part structure, we can retrieve
- * the pointer to that structure with this macro.
- */
- #define PART(x) ((struct mtd_part *)(x))
-
-+
- /*
- * MTD methods which simply translate the effective address and pass through
- * to the _real_ device.
-@@ -521,12 +518,14 @@ static struct mtd_part *allocate_partiti
- if (slave->offset == MTDPART_OFS_APPEND)
- slave->offset = cur_offset;
- if (slave->offset == MTDPART_OFS_NXTBLK) {
-- /* Round up to next erasesize */
-- slave->offset = mtd_roundup_to_eb(cur_offset, master);
-- if (slave->offset != cur_offset)
-+ slave->offset = cur_offset;
-+ if (mtd_mod_by_eb(cur_offset, master) != 0) {
-+ /* Round up to next erasesize */
-+ slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize;
- printk(KERN_NOTICE "Moving partition %d: "
- "0x%012llx -> 0x%012llx\n", partno,
- (unsigned long long)cur_offset, (unsigned long long)slave->offset);
-+ }
- }
- if (slave->offset == MTDPART_OFS_RETAIN) {
- slave->offset = cur_offset;
-@@ -627,10 +626,8 @@ out_register:
- return slave;
- }
-
--
--static int
--__mtd_add_partition(struct mtd_info *master, const char *name,
-- long long offset, long long length, bool dup_check)
-+int mtd_add_partition(struct mtd_info *master, const char *name,
-+ long long offset, long long length)
- {
- struct mtd_partition part;
- struct mtd_part *p, *new;
-@@ -662,24 +659,21 @@ __mtd_add_partition(struct mtd_info *mas
- end = offset + length;
-
- mutex_lock(&mtd_partitions_mutex);
-- if (dup_check) {
-- list_for_each_entry(p, &mtd_partitions, list)
-- if (p->master == master) {
-- if ((start >= p->offset) &&
-- (start < (p->offset + p->mtd.size)))
-- goto err_inv;
--
-- if ((end >= p->offset) &&
-- (end < (p->offset + p->mtd.size)))
-- goto err_inv;
-- }
-- }
-+ list_for_each_entry(p, &mtd_partitions, list)
-+ if (p->master == master) {
-+ if ((start >= p->offset) &&
-+ (start < (p->offset + p->mtd.size)))
-+ goto err_inv;
-+
-+ if ((end >= p->offset) &&
-+ (end < (p->offset + p->mtd.size)))
-+ goto err_inv;
-+ }
-
- list_add(&new->list, &mtd_partitions);
- mutex_unlock(&mtd_partitions_mutex);
-
- add_mtd_device(&new->mtd);
-- mtd_partition_split(master, new);
-
- return ret;
- err_inv:
-@@ -689,12 +683,6 @@ err_inv:
- }
- EXPORT_SYMBOL_GPL(mtd_add_partition);
-
--int mtd_add_partition(struct mtd_info *master, const char *name,
-- long long offset, long long length)
--{
-- return __mtd_add_partition(master, name, offset, length, true);
--}
--
- int mtd_del_partition(struct mtd_info *master, int partno)
- {
- struct mtd_part *slave, *next;
-@@ -718,166 +706,6 @@ int mtd_del_partition(struct mtd_info *m
- }
- EXPORT_SYMBOL_GPL(mtd_del_partition);
-
--static int
--run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type)
--{
-- struct mtd_partition *parts;
-- int nr_parts;
-- int i;
--
-- nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, &parts,
-- NULL);
-- if (nr_parts <= 0)
-- return nr_parts;
--
-- if (WARN_ON(!parts))
-- return 0;
--
-- for (i = 0; i < nr_parts; i++) {
-- /* adjust partition offsets */
-- parts[i].offset += slave->offset;
--
-- __mtd_add_partition(slave->master,
-- parts[i].name,
-- parts[i].offset,
-- parts[i].size,
-- false);
-- }
--
-- kfree(parts);
--
-- return nr_parts;
--}
--
--static inline unsigned long
--mtd_pad_erasesize(struct mtd_info *mtd, int offset, int len)
--{
-- unsigned long mask = mtd->erasesize - 1;
--
-- len += offset & mask;
-- len = (len + mask) & ~mask;
-- len -= offset & mask;
-- return len;
--}
--
--static int split_squashfs(struct mtd_info *master, int offset, int *split_offset)
--{
-- size_t squashfs_len;
-- int len, ret;
--
-- ret = mtd_get_squashfs_len(master, offset, &squashfs_len);
-- if (ret)
-- return ret;
--
-- len = mtd_pad_erasesize(master, offset, squashfs_len);
-- *split_offset = offset + len;
--
-- return 0;
--}
--
--static void split_rootfs_data(struct mtd_info *master, struct mtd_part *part)
--{
-- unsigned int split_offset = 0;
-- unsigned int split_size;
-- int ret;
--
-- ret = split_squashfs(master, part->offset, &split_offset);
-- if (ret)
-- return;
--
-- if (split_offset <= 0)
-- return;
--
-- if (config_enabled(CONFIG_MTD_SPLIT_SQUASHFS_ROOT))
-- pr_err("Dedicated partitioner didn't create \"rootfs_data\" partition, please fill a bug report!\n");
-- else
-- pr_warn("Support for built-in \"rootfs_data\" splitter will be removed, please use CONFIG_MTD_SPLIT_SQUASHFS_ROOT\n");
--
-- split_size = part->mtd.size - (split_offset - part->offset);
-- printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=0x%x, len=0x%x\n",
-- ROOTFS_SPLIT_NAME, split_offset, split_size);
--
-- __mtd_add_partition(master, ROOTFS_SPLIT_NAME, split_offset,
-- split_size, false);
--}
--
--#define UBOOT_MAGIC 0x27051956
--
--static void split_uimage(struct mtd_info *master, struct mtd_part *part)
--{
-- struct {
-- __be32 magic;
-- __be32 pad[2];
-- __be32 size;
-- } hdr;
-- size_t len;
--
-- if (mtd_read(master, part->offset, sizeof(hdr), &len, (void *) &hdr))
-- return;
--
-- if (len != sizeof(hdr) || hdr.magic != cpu_to_be32(UBOOT_MAGIC))
-- return;
--
-- len = be32_to_cpu(hdr.size) + 0x40;
-- len = mtd_pad_erasesize(master, part->offset, len);
-- if (len + master->erasesize > part->mtd.size)
-- return;
--
-- if (config_enabled(CONFIG_MTD_SPLIT_UIMAGE_FW))
-- pr_err("Dedicated partitioner didn't split firmware partition, please fill a bug report!\n");
-- else
-- pr_warn("Support for built-in firmware splitter will be removed, please use CONFIG_MTD_SPLIT_UIMAGE_FW\n");
--
-- __mtd_add_partition(master, "rootfs", part->offset + len,
-- part->mtd.size - len, false);
--}
--
--#ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
--#define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME
--#else
--#define SPLIT_FIRMWARE_NAME "unused"
--#endif
--
--static void split_firmware(struct mtd_info *master, struct mtd_part *part)
--{
-- int ret;
--
-- ret = run_parsers_by_type(part, MTD_PARSER_TYPE_FIRMWARE);
-- if (ret > 0)
-- return;
--
-- if (config_enabled(CONFIG_MTD_UIMAGE_SPLIT))
-- split_uimage(master, part);
--}
--
--void __weak arch_split_mtd_part(struct mtd_info *master, const char *name,
-- int offset, int size)
--{
--}
--
--static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part)
--{
-- static int rootfs_found = 0;
--
-- if (rootfs_found)
-- return;
--
-- if (!strcmp(part->mtd.name, "rootfs")) {
-- int num = run_parsers_by_type(part, MTD_PARSER_TYPE_ROOTFS);
--
-- if (num <= 0 && config_enabled(CONFIG_MTD_ROOTFS_SPLIT))
-- split_rootfs_data(master, part);
--
-- rootfs_found = 1;
-- }
--
-- if (!strcmp(part->mtd.name, SPLIT_FIRMWARE_NAME) &&
-- config_enabled(CONFIG_MTD_SPLIT_FIRMWARE))
-- split_firmware(master, part);
--
-- arch_split_mtd_part(master, part->mtd.name, part->offset,
-- part->mtd.size);
--}
- /*
- * This function, given a master MTD object and a partition table, creates
- * and registers slave MTD objects which are bound to the master according to
-@@ -907,7 +735,6 @@ int add_mtd_partitions(struct mtd_info *
- mutex_unlock(&mtd_partitions_mutex);
-
- add_mtd_device(&slave->mtd);
-- mtd_partition_split(master, slave);
-
- cur_offset = slave->offset + slave->mtd.size;
- }
-@@ -937,30 +764,6 @@ static struct mtd_part_parser *get_parti
-
- #define put_partition_parser(p) do { module_put((p)->owner); } while (0)
-
--static struct mtd_part_parser *
--get_partition_parser_by_type(enum mtd_parser_type type,
-- struct mtd_part_parser *start)
--{
-- struct mtd_part_parser *p, *ret = NULL;
--
-- spin_lock(&part_parser_lock);
--
-- p = list_prepare_entry(start, &part_parsers, list);
-- if (start)
-- put_partition_parser(start);
--
-- list_for_each_entry_continue(p, &part_parsers, list) {
-- if (p->type == type && try_module_get(p->owner)) {
-- ret = p;
-- break;
-- }
-- }
--
-- spin_unlock(&part_parser_lock);
--
-- return ret;
--}
--
- void register_mtd_parser(struct mtd_part_parser *p)
- {
- spin_lock(&part_parser_lock);
-@@ -1076,38 +879,6 @@ int parse_mtd_partitions(struct mtd_info
- return ret;
- }
-
--int parse_mtd_partitions_by_type(struct mtd_info *master,
-- enum mtd_parser_type type,
-- struct mtd_partition **pparts,
-- struct mtd_part_parser_data *data)
--{
-- struct mtd_part_parser *prev = NULL;
-- int ret = 0;
--
-- while (1) {
-- struct mtd_part_parser *parser;
--
-- parser = get_partition_parser_by_type(type, prev);
-- if (!parser)
-- break;
--
-- ret = (*parser->parse_fn)(master, pparts, data);
--
-- if (ret > 0) {
-- put_partition_parser(parser);
-- printk(KERN_NOTICE
-- "%d %s partitions found on MTD device %s\n",
-- ret, parser->name, master->name);
-- break;
-- }
--
-- prev = parser;
-- }
--
-- return ret;
--}
--EXPORT_SYMBOL_GPL(parse_mtd_partitions_by_type);
--
- int mtd_is_partition(const struct mtd_info *mtd)
- {
- struct mtd_part *part;
+++ /dev/null
---- a/drivers/mtd/Kconfig
-+++ b/drivers/mtd/Kconfig
-@@ -52,6 +52,14 @@ config MTD_TESTS
- WARNING: some of the tests will ERASE entire MTD device which they
- test. Do not use these tests unless you really know what you do.
-
-+config MTD_ROOTFS_ROOT_DEV
-+ bool "Automatically set 'rootfs' partition to be root filesystem"
-+ default y
-+
-+config MTD_ROOTFS_SPLIT
-+ bool "Automatically split 'rootfs' partition for squashfs"
-+ default y
-+
- config MTD_REDBOOT_PARTS
- tristate "RedBoot partition table parsing"
- ---help---
---- a/drivers/mtd/mtdpart.c
-+++ b/drivers/mtd/mtdpart.c
-@@ -30,6 +30,8 @@
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/partitions.h>
- #include <linux/of.h>
-+#include <linux/root_dev.h>
-+#include <linux/magic.h>
- #include <linux/err.h>
-
- #include "mtdcore.h"
-@@ -53,7 +55,7 @@ struct mtd_part {
- * the pointer to that structure with this macro.
- */
- #define PART(x) ((struct mtd_part *)(x))
--
-+#define IS_PART(mtd) (mtd->_read == part_read)
-
- /*
- * MTD methods which simply translate the effective address and pass through
-@@ -706,6 +708,144 @@ int mtd_del_partition(struct mtd_info *m
- }
- EXPORT_SYMBOL_GPL(mtd_del_partition);
-
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+#define ROOTFS_SPLIT_NAME "rootfs_data"
-+#define ROOTFS_REMOVED_NAME "<removed>"
-+
-+struct squashfs_super_block {
-+ __le32 s_magic;
-+ __le32 pad0[9];
-+ __le64 bytes_used;
-+};
-+
-+
-+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset)
-+{
-+ struct squashfs_super_block sb;
-+ int len, ret;
-+
-+ ret = mtd_read(master, offset, sizeof(sb), &len, (void *) &sb);
-+ if (ret || (len != sizeof(sb))) {
-+ printk(KERN_ALERT "split_squashfs: error occured while reading "
-+ "from \"%s\"\n", master->name);
-+ return -EINVAL;
-+ }
-+
-+ if (SQUASHFS_MAGIC != le32_to_cpu(sb.s_magic) ) {
-+ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n",
-+ master->name);
-+ *split_offset = 0;
-+ return 0;
-+ }
-+
-+ if (le64_to_cpu((sb.bytes_used)) <= 0) {
-+ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n",
-+ master->name);
-+ *split_offset = 0;
-+ return 0;
-+ }
-+
-+ len = (u32) le64_to_cpu(sb.bytes_used);
-+ len += (offset & 0x000fffff);
-+ len += (master->erasesize - 1);
-+ len &= ~(master->erasesize - 1);
-+ len -= (offset & 0x000fffff);
-+ *split_offset = offset + len;
-+
-+ return 0;
-+}
-+
-+static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, const struct mtd_partition *part)
-+{
-+ struct mtd_partition dpart;
-+ struct mtd_part *slave = NULL;
-+ struct mtd_part *spart;
-+ int ret, split_offset = 0;
-+
-+ spart = PART(rpart);
-+ ret = split_squashfs(master, spart->offset, &split_offset);
-+ if (ret)
-+ return ret;
-+
-+ if (split_offset <= 0)
-+ return 0;
-+
-+ memcpy(&dpart, part, sizeof(dpart));
-+ dpart.name = ROOTFS_SPLIT_NAME;
-+
-+ dpart.size = rpart->size - (split_offset - spart->offset);
-+ dpart.offset = split_offset;
-+
-+ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%llX, len=%llX \n",
-+ ROOTFS_SPLIT_NAME, dpart.offset, dpart.size);
-+
-+ slave = allocate_partition(master, &dpart, 0, split_offset);
-+ if (IS_ERR(slave))
-+ return PTR_ERR(slave);
-+ mutex_lock(&mtd_partitions_mutex);
-+ list_add(&slave->list, &mtd_partitions);
-+ mutex_unlock(&mtd_partitions_mutex);
-+
-+ add_mtd_device(&slave->mtd);
-+
-+ rpart->split = &slave->mtd;
-+
-+ return 0;
-+}
-+
-+static int refresh_rootfs_split(struct mtd_info *mtd)
-+{
-+ struct mtd_partition tpart;
-+ struct mtd_part *part;
-+ char *name;
-+ //int index = 0;
-+ int offset, size;
-+ int ret;
-+
-+ part = PART(mtd);
-+
-+ /* check for the new squashfs offset first */
-+ ret = split_squashfs(part->master, part->offset, &offset);
-+ if (ret)
-+ return ret;
-+
-+ if ((offset > 0) && !mtd->split) {
-+ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name);
-+ /* if we don't have a rootfs split partition, create a new one */
-+ tpart.name = (char *) mtd->name;
-+ tpart.size = mtd->size;
-+ tpart.offset = part->offset;
-+
-+ return split_rootfs_data(part->master, &part->mtd, &tpart);
-+ } else if ((offset > 0) && mtd->split) {
-+ /* update the offsets of the existing partition */
-+ size = mtd->size + part->offset - offset;
-+
-+ part = PART(mtd->split);
-+ part->offset = offset;
-+ part->mtd.size = size;
-+ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n",
-+ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"),
-+ (u32) part->offset, (u32) part->mtd.size);
-+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
-+ strcpy(name, ROOTFS_SPLIT_NAME);
-+ part->mtd.name = name;
-+ } else if ((offset <= 0) && mtd->split) {
-+ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name);
-+
-+ /* mark existing partition as removed */
-+ part = PART(mtd->split);
-+ name = kmalloc(sizeof(ROOTFS_SPLIT_NAME) + 1, GFP_KERNEL);
-+ strcpy(name, ROOTFS_REMOVED_NAME);
-+ part->mtd.name = name;
-+ part->offset = 0;
-+ part->mtd.size = 0;
-+ }
-+
-+ return 0;
-+}
-+#endif /* CONFIG_MTD_ROOTFS_SPLIT */
-+
- /*
- * This function, given a master MTD object and a partition table, creates
- * and registers slave MTD objects which are bound to the master according to
-@@ -722,6 +862,9 @@ int add_mtd_partitions(struct mtd_info *
- struct mtd_part *slave;
- uint64_t cur_offset = 0;
- int i;
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+ int ret;
-+#endif
-
- printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
-
-@@ -736,12 +879,53 @@ int add_mtd_partitions(struct mtd_info *
-
- add_mtd_device(&slave->mtd);
-
-+ if (!strcmp(parts[i].name, "rootfs")) {
-+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
-+ if (ROOT_DEV == 0) {
-+ printk(KERN_NOTICE "mtd: partition \"rootfs\" "
-+ "set to be root filesystem\n");
-+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index);
-+ }
-+#endif
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+ ret = split_rootfs_data(master, &slave->mtd, &parts[i]);
-+ /* if (ret == 0)
-+ * j++; */
-+#endif
-+ }
-+
- cur_offset = slave->offset + slave->mtd.size;
- }
-
- return 0;
- }
-
-+int mtd_device_refresh(struct mtd_info *mtd)
-+{
-+ int ret = 0;
-+
-+ if (IS_PART(mtd)) {
-+ struct mtd_part *part;
-+ struct mtd_info *master;
-+
-+ part = PART(mtd);
-+ master = part->master;
-+ if (master->refresh_device)
-+ ret = master->refresh_device(master);
-+ }
-+
-+ if (!ret && mtd->refresh_device)
-+ ret = mtd->refresh_device(mtd);
-+
-+#ifdef CONFIG_MTD_ROOTFS_SPLIT
-+ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs"))
-+ refresh_rootfs_split(mtd);
-+#endif
-+
-+ return 0;
-+}
-+EXPORT_SYMBOL_GPL(mtd_device_refresh);
-+
- static DEFINE_SPINLOCK(part_parser_lock);
- static LIST_HEAD(part_parsers);
-
---- a/drivers/mtd/mtdchar.c
-+++ b/drivers/mtd/mtdchar.c
-@@ -1008,6 +1008,12 @@ static int mtdchar_ioctl(struct file *fi
- break;
- }
-
-+ case MTDREFRESH:
-+ {
-+ ret = mtd_device_refresh(mtd);
-+ break;
-+ }
-+
- default:
- ret = -ENOTTY;
- }
---- a/include/linux/mtd/mtd.h
-+++ b/include/linux/mtd/mtd.h
-@@ -115,6 +115,7 @@ struct nand_ecclayout {
-
- struct module; /* only needed for owner field in mtd_info */
-
-+struct mtd_info;
- struct mtd_info {
- u_char type;
- uint32_t flags;
-@@ -231,6 +232,9 @@ struct mtd_info {
- int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
- int (*_suspend) (struct mtd_info *mtd);
- void (*_resume) (struct mtd_info *mtd);
-+ int (*refresh_device)(struct mtd_info *mtd);
-+ struct mtd_info *split;
-+
- /*
- * If the driver is something smart, like UBI, it may need to maintain
- * its own reference counting. The below functions are only for driver.
-@@ -397,6 +401,7 @@ extern int mtd_device_parse_register(str
- int defnr_parts);
- #define mtd_device_register(master, parts, nr_parts) \
- mtd_device_parse_register(master, NULL, NULL, parts, nr_parts)
-+extern int mtd_device_refresh(struct mtd_info *master);
- extern int mtd_device_unregister(struct mtd_info *master);
- extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
- extern int __get_mtd_device(struct mtd_info *mtd);
---- a/include/linux/mtd/partitions.h
-+++ b/include/linux/mtd/partitions.h
-@@ -37,12 +37,14 @@
- */
- struct mtd_info;
-
-+struct mtd_partition;
- struct mtd_partition {
- const char *name; /* identifier string */
- uint64_t size; /* partition size */
- uint64_t offset; /* offset within the master MTD space */
- uint32_t mask_flags; /* master MTD flags to mask out for this partition */
- struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only) */
-+ int (*refresh_partition)(struct mtd_info *);
- };
-
- #define MTDPART_OFS_RETAIN (-3)
---- a/include/uapi/mtd/mtd-abi.h
-+++ b/include/uapi/mtd/mtd-abi.h
-@@ -203,6 +203,7 @@ struct otp_info {
- * without OOB, e.g., NOR flash.
- */
- #define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
-+#define MTDREFRESH _IO('M', 50)
-
- /*
- * Obsolete legacy interface. Keep it in order not to break userspace
+++ /dev/null
---- a/drivers/mtd/chips/cfi_cmdset_0002.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -49,6 +49,12 @@
- #define SST49LF008A 0x005a
- #define AT49BV6416 0x00d6
-
-+/* Macronix */
-+#define MX29LV160B 0x2249 /* MX29LV160 Bottom-boot chip */
-+#define MX29LV160T 0x22C4 /* MX29LV160 Top-boot chip */
-+#define MX29LV320B 0x22A8 /* MX29LV320 Bottom-boot chip */
-+#define MX29LV320T 0x22A7 /* MX29LV320 Top-boot chip */
-+
- static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
- static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
- static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
-@@ -374,6 +380,41 @@ static struct cfi_fixup cfi_nopri_fixup_
- { 0, 0, NULL }
- };
-
-+#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
-+/*
-+ * Some Macronix chips has no/bad bootblock information in the CFI table
-+ */
-+static void fixup_macronix_bootloc(struct mtd_info *mtd)
-+{
-+ struct map_info *map = mtd->priv;
-+ struct cfi_private *cfi = map->fldrv_priv;
-+ struct cfi_pri_amdstd *extp = cfi->cmdset_priv;
-+ __u8 t;
-+
-+ switch (cfi->id) {
-+ /* TODO: put affected chip ids here */
-+ case MX29LV160B:
-+ case MX29LV320B:
-+ t = 2; /* Bottom boot */
-+ break;
-+ case MX29LV160T:
-+ case MX29LV320T:
-+ t = 3; /* Top boot */
-+ break;
-+ default:
-+ return;
-+ }
-+
-+ if (extp->TopBottom == t)
-+ /* boot location detected by the CFI layer is correct */
-+ return;
-+
-+ extp->TopBottom = t;
-+ printk("%s: Macronix chip detected, id:0x%04X, boot location forced "
-+ "to %s\n", map->name, cfi->id, (t == 2) ? "bottom" : "top");
-+}
-+#endif /* CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC */
-+
- static struct cfi_fixup cfi_fixup_table[] = {
- { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri },
- #ifdef AMD_BOOTLOC_BUG
-@@ -416,6 +457,9 @@ static struct cfi_fixup fixup_table[] =
- */
- { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_erase_chip },
- { CFI_MFR_ATMEL, AT49BV6416, fixup_use_atmel_lock },
-+#ifdef CONFIG_MTD_CFI_FIXUP_MACRONIX_BOOTLOC
-+ { CFI_MFR_MACRONIX, CFI_ID_ANY, fixup_macronix_bootloc },
-+#endif
- { 0, 0, NULL }
- };
-
---- a/drivers/mtd/chips/Kconfig
-+++ b/drivers/mtd/chips/Kconfig
-@@ -188,6 +188,14 @@ config MTD_CFI_AMDSTD
- provides support for command set 0002, used on chips including
- the AMD Am29LV320.
-
-+config MTD_CFI_FIXUP_MACRONIX_BOOTLOC
-+ bool "Fix boot-block location for Macronix flash chips"
-+ depends on MTD_CFI_AMDSTD
-+ help
-+ Some Macronix flash chips have no/wrong boot-block location in the
-+ CFI table, and the driver may detect the type incorrectly. Select
-+ this if your board has such chip.
-+
- config MTD_CFI_STAA
- tristate "Support for CFI command set 0020 (ST (Advanced Architecture) chips)"
- depends on MTD_GEN_PROBE
+++ /dev/null
---- a/drivers/mtd/chips/jedec_probe.c
-+++ b/drivers/mtd/chips/jedec_probe.c
-@@ -115,6 +115,10 @@
- #define UPD29F064115 0x221C
-
- /* PMC */
-+#define PM39LV512 0x001B
-+#define PM39LV010 0x001C
-+#define PM39LV020 0x003D
-+#define PM39LV040 0x003E
- #define PM49FL002 0x006D
- #define PM49FL004 0x006E
- #define PM49FL008 0x006A
-@@ -1259,6 +1263,54 @@ static const struct amd_flash_info jedec
- ERASEINFO(0x02000,2),
- ERASEINFO(0x04000,1),
- }
-+ }, {
-+ .mfr_id = CFI_MFR_PMC,
-+ .dev_id = PM39LV512,
-+ .name = "PMC Pm39LV512",
-+ .devtypes = CFI_DEVICETYPE_X8,
-+ .uaddr = MTD_UADDR_0x0555_0x02AA,
-+ .dev_size = SIZE_64KiB,
-+ .cmd_set = P_ID_AMD_STD,
-+ .nr_regions = 1,
-+ .regions = {
-+ ERASEINFO(0x01000,16),
-+ }
-+ }, {
-+ .mfr_id = CFI_MFR_PMC,
-+ .dev_id = PM39LV010,
-+ .name = "PMC Pm39LV010",
-+ .devtypes = CFI_DEVICETYPE_X8,
-+ .uaddr = MTD_UADDR_0x0555_0x02AA,
-+ .dev_size = SIZE_128KiB,
-+ .cmd_set = P_ID_AMD_STD,
-+ .nr_regions = 1,
-+ .regions = {
-+ ERASEINFO(0x01000,32),
-+ }
-+ }, {
-+ .mfr_id = CFI_MFR_PMC,
-+ .dev_id = PM39LV020,
-+ .name = "PMC Pm39LV020",
-+ .devtypes = CFI_DEVICETYPE_X8,
-+ .uaddr = MTD_UADDR_0x0555_0x02AA,
-+ .dev_size = SIZE_256KiB,
-+ .cmd_set = P_ID_AMD_STD,
-+ .nr_regions = 1,
-+ .regions = {
-+ ERASEINFO(0x01000,64),
-+ }
-+ }, {
-+ .mfr_id = CFI_MFR_PMC,
-+ .dev_id = PM39LV040,
-+ .name = "PMC Pm39LV040",
-+ .devtypes = CFI_DEVICETYPE_X8,
-+ .uaddr = MTD_UADDR_0x0555_0x02AA,
-+ .dev_size = SIZE_512KiB,
-+ .cmd_set = P_ID_AMD_STD,
-+ .nr_regions = 1,
-+ .regions = {
-+ ERASEINFO(0x01000,128),
-+ }
- }, {
- .mfr_id = CFI_MFR_PMC,
- .dev_id = PM49FL002,
+++ /dev/null
---- a/drivers/mtd/Kconfig
-+++ b/drivers/mtd/Kconfig
-@@ -60,6 +60,10 @@ config MTD_ROOTFS_SPLIT
- bool "Automatically split 'rootfs' partition for squashfs"
- default y
-
-+config MTD_TRXSPLIT
-+ bool "Automatically find and split TRX partitions"
-+ default n
-+
- config MTD_REDBOOT_PARTS
- tristate "RedBoot partition table parsing"
- ---help---
---- a/drivers/mtd/Makefile
-+++ b/drivers/mtd/Makefile
-@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o
- obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o
- obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o
- obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
-+obj-$(CONFIG_MTD_TRXSPLIT) += trxsplit.o
-
- # 'Users' - code which presents functionality to userspace.
- obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o
+++ /dev/null
---- a/drivers/ata/Makefile
-+++ b/drivers/ata/Makefile
-@@ -98,6 +98,7 @@ obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia
- obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o
- obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o
- obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o
-+obj-$(CONFIG_PATA_RB153_CF) += pata_rb153_cf.o
- obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o
- obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o
- obj-$(CONFIG_PATA_SAMSUNG_CF) += pata_samsung_cf.o
---- a/drivers/ata/Kconfig
-+++ b/drivers/ata/Kconfig
-@@ -955,6 +955,15 @@ config PATA_QDI
- help
- Support for QDI 6500 and 6580 PATA controllers on VESA local bus.
-
-+config PATA_RB153_CF
-+ tristate "RouterBOARD 153 Compact Flash support"
-+ depends on ADM5120_MACH_RB_153
-+ help
-+ This option enables support for a Compact Flash connected on
-+ the RouterBOARD 153.
-+
-+ If unsure, say N.
-+
- config PATA_RB532
- tristate "RouterBoard 532 PATA CompactFlash support"
- depends on MIKROTIK_RB532
+++ /dev/null
---- a/drivers/tty/serial/amba-pl010.c
-+++ b/drivers/tty/serial/amba-pl010.c
-@@ -48,11 +48,9 @@
- #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 AMBA_ISR_PASS_LIMIT 256
-
-@@ -78,9 +76,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 +86,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 +96,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 +106,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 +126,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 +158,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 +171,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 +183,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 +201,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 +231,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 +244,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 +258,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 +268,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 +294,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 +327,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 +355,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 +380,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 +443,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 +543,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 +553,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 +570,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 +580,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 +592,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 +609,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 +629,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)
-@@ -673,7 +671,7 @@ static struct uart_driver amba_reg = {
- .dev_name = "ttyAM",
- .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,18 @@ 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_CONSOLE
- bool "Support for console on AMBA serial port"
- depends on SERIAL_AMBA_PL010=y
+++ /dev/null
---- a/drivers/leds/leds-gpio.c
-+++ b/drivers/leds/leds-gpio.c
-@@ -55,13 +55,17 @@ static void gpio_led_set(struct led_clas
- container_of(led_cdev, struct gpio_led_data, cdev);
- int level;
-
-- if (value == LED_OFF)
-- level = 0;
-- else
-- level = 1;
--
-- if (led_dat->active_low)
-- level = !level;
-+ switch (value) {
-+ case LED_OFF:
-+ level = led_dat->active_low ? 1 : 0;
-+ break;
-+ case LED_FULL:
-+ level = led_dat->active_low ? 0 : 1;
-+ break;
-+ default:
-+ level = value;
-+ break;
-+ }
-
- /* Setting GPIOs with I2C/etc requires a task context, and we don't
- * seem to have a reliable way to know if we're already in one; so
+++ /dev/null
---- a/drivers/watchdog/Kconfig
-+++ b/drivers/watchdog/Kconfig
-@@ -1116,6 +1116,18 @@ config RC32434_WDT
- To compile this driver as a module, choose M here: the
- module will be called rc32434_wdt.
-
-+config ADM5120_WDT
-+ tristate "Infineon ADM5120 SoC hardware watchdog"
-+ depends on WATCHDOG && ADM5120
-+ help
-+ This is a driver for hardware watchdog integrated in Infineon
-+ ADM5120 SoC. This watchdog simply watches your kernel to make sure
-+ it doesn't freeze, and if it does, it reboots your computer after a
-+ certain amount of time.
-+
-+ To compile this driver as a module, choose M here: the module will be
-+ called adm5120_wdt.
-+
- config INDYDOG
- tristate "Indy/I2 Hardware Watchdog"
- depends on SGI_HAS_INDYDOG
---- a/drivers/watchdog/Makefile
-+++ b/drivers/watchdog/Makefile
-@@ -131,6 +131,7 @@ obj-$(CONFIG_ATH79_WDT) += ath79_wdt.o
- obj-$(CONFIG_BCM47XX_WDT) += bcm47xx_wdt.o
- obj-$(CONFIG_BCM63XX_WDT) += bcm63xx_wdt.o
- obj-$(CONFIG_RC32434_WDT) += rc32434_wdt.o
-+obj-$(CONFIG_ADM5120_WDT) += adm5120_wdt.o
- obj-$(CONFIG_INDYDOG) += indydog.o
- obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o
- obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
+++ /dev/null
-#!/bin/sh
-# wget2nand
-# This script can be used to download a TGZ file from your build system which
-# contains the files to be installed on the NAND flash on your RB1xx card.
-# The one parameter is the URL of the TGZ file to be downloaded.
-# Licence GPL V2
-# Author david.goodenough@linkchoose.co.uk
-# Based on cf2nand from RB532 support
-. /lib/functions.sh
-
-[ -d /tmp/wget2nand-rootfs ] && {
- echo "/tmp/wget2nand-rootfs already exists"
- exit 1
-}
-
-[ -d /tmp/wget2nand-kernel ] && {
- echo "/tmp/wget2nand-kernel already exists"
- exit 1
-}
-
-# need to find the wget server from the command line
-url=$1
-[ -z "$url" ] && {
- echo "No URL specified for image TGZ"
- echo "Usage : $0 URL"
- exit 1
-}
-
-# first get an address for br-lan using udhcpc
-killall udhcpc
-/sbin/udhcpc -i br-lan
-
-mtd_kernel="$(find_mtd_part 'kernel')"
-mtd_rootfs="$(find_mtd_part 'rootfs')"
-[ -z "$mtd_kernel" -o -z "$mtd_rootfs" ] && {
- echo "Cannot find NAND Flash partitions"
- exit 1
-}
-
-echo "Erasing filesystem..."
-mtd erase kernel 2>/dev/null >/dev/null
-mtd erase rootfs 2>/dev/null >/dev/null
-
-echo "Mounting $mtd_rootfs as new root and $mtd_kernel as kernel partition"
-
-mkdir /tmp/wget2nand-rootfs
-mkdir /tmp/wget2nand-kernel
-mount -t yaffs2 "$mtd_rootfs" /tmp/wget2nand-rootfs
-mount -t yaffs2 "$mtd_kernel" /tmp/wget2nand-kernel
-
-echo "Erasing existing files..."
-rm -rf /tmp/wget2nand-rootfs/*
-
-echo "Copying filesystem..."
-( wget -O - $url/openwrt-adm5120-rb1xx-rootfs.tar.gz) | ( cd /tmp/wget2nand-rootfs/; tar xvz )
-# RouterBOOT is looking for a kernel named "kernel"
-wget -O /tmp/wget2nand-kernel/kernel $url/openwrt-adm5120-rb1xx-vmlinux.elf
-
-chmod +x /tmp/wget2nand-kernel/kernel
-
-# make sure everything is written before we unmount the partitions
-echo "chmod ugo+x /" > /tmp/wget2nand-rootfs/etc/uci-defaults/set_root_permission
-sync
-ls /tmp/wget2nand-kernel/
-ls /tmp/wget2nand-rootfs/
-# use kexec if present
-[ -x /usr/sbin/kexec ] && {
- kexec -l /tmp/wget2nand-kernel/kernel --command-line="$(cat /proc/cmdline) rootfstype=yaffs2 root=$mtd_kernel"
- kexec -e
-}
-# unmount the partitions and remove the directories into which they were mounted
-umount /tmp/wget2nand-kernel
-umount /tmp/wget2nand-rootfs
-rmdir /tmp/wget2nand-kernel
-rmdir /tmp/wget2nand-rootfs
-
-# all done
-echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand"
+++ /dev/null
-# CONFIG_ADM5120_MACH_5GXI is not set
-# CONFIG_ADM5120_MACH_BR_6104K is not set
-# CONFIG_ADM5120_MACH_BR_6104KP is not set
-# CONFIG_ADM5120_MACH_BR_61X4WG is not set
-# CONFIG_ADM5120_MACH_CAS_771 is not set
-# CONFIG_ADM5120_MACH_EASY5120P_ATA is not set
-# CONFIG_ADM5120_MACH_EASY5120_RT is not set
-# CONFIG_ADM5120_MACH_EASY5120_WVOIP is not set
-# CONFIG_ADM5120_MACH_EASY83000 is not set
-# CONFIG_ADM5120_MACH_EB_214A is not set
-# CONFIG_ADM5120_MACH_NFS_101 is not set
-# CONFIG_ADM5120_MACH_NP27G is not set
-# CONFIG_ADM5120_MACH_NP28G is not set
-# CONFIG_ADM5120_MACH_PMUGW is not set
-CONFIG_ADM5120_MACH_RB_11X=y
-CONFIG_ADM5120_MACH_RB_133=y
-CONFIG_ADM5120_MACH_RB_133C=y
-CONFIG_ADM5120_MACH_RB_150=y
-CONFIG_ADM5120_MACH_RB_153=y
-CONFIG_ADM5120_MACH_RB_192=y
-# CONFIG_ADM5120_MACH_WP54 is not set
-# CONFIG_ADM5120_OEM_CELLVISION is not set
-# CONFIG_ADM5120_OEM_COMPEX is not set
-# CONFIG_ADM5120_OEM_EDIMAX is not set
-# CONFIG_ADM5120_OEM_GENERIC is not set
-# CONFIG_ADM5120_OEM_INFINEON is not set
-CONFIG_ADM5120_OEM_MIKROTIK=y
-# CONFIG_ADM5120_OEM_MOTOROLA is not set
-# CONFIG_ADM5120_OEM_OSBRIDGE is not set
-CONFIG_CMDLINE="console=ttyAM0,115200 rootfstype=yaffs2"
-# CONFIG_JFFS2_FS is not set
-# CONFIG_MTD_MYLOADER_PARTS is not set
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_ECC=y
-CONFIG_MTD_NAND_PLATFORM=y
-# CONFIG_MTD_ROOTFS_SPLIT is not set
-# CONFIG_MTD_SM_COMMON is not set
-# CONFIG_MTD_TRXSPLIT is not set
-# CONFIG_OVERLAYFS_FS is not set
-# CONFIG_PATA_RB153_CF is not set
-# CONFIG_SQUASHFS is not set
-CONFIG_YAFFS_9BYTE_TAGS=y
-# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
-CONFIG_YAFFS_AUTO_YAFFS2=y
-# CONFIG_YAFFS_DISABLE_BACKGROUND is not set
-# CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING is not set
-CONFIG_YAFFS_DISABLE_TAGS_ECC=y
-# CONFIG_YAFFS_EMPTY_LOST_AND_FOUND is not set
-CONFIG_YAFFS_FS=y
-CONFIG_YAFFS_XATTR=y
-CONFIG_YAFFS_YAFFS1=y
-CONFIG_YAFFS_YAFFS2=y
+++ /dev/null
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/RouterBoard
- NAME:=Mikrotik RouterBoard 1xx family
- PACKAGES:=kmod-ath5k kmod-pata-rb153-cf
-endef
-
-define Profile/RouterBoard/Description
- Package set compatible with the RouterBoard RB1xx devices. Contains RouterOS to OpenWrt\\\
- installation scripts.
-endef
-
-$(eval $(call Profile,RouterBoard))
+++ /dev/null
-ARCH:=mipsel
-SUBTARGET:=rb1xx
-BOARDNAME:=MikroTik RB-1xx boards
-FEATURES+=tgz broken
-
-define Target/Description
- Build firmware images for Mikrotik RB-1xx series.
-endef
+++ /dev/null
-CONFIG_ADM5120_MACH_P_334WT=y
-CONFIG_ADM5120_MACH_P_335=y
-# CONFIG_ADM5120_OEM_CELLVISION is not set
-# CONFIG_ADM5120_OEM_COMPEX is not set
-# CONFIG_ADM5120_OEM_EDIMAX is not set
-# CONFIG_ADM5120_OEM_GENERIC is not set
-# CONFIG_ADM5120_OEM_INFINEON is not set
-# CONFIG_ADM5120_OEM_MOTOROLA is not set
-# CONFIG_ADM5120_OEM_OSBRIDGE is not set
-CONFIG_ADM5120_OEM_ZYXEL=y
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-CONFIG_SWAP_IO_SPACE=y
+++ /dev/null
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/Generic
- NAME:=Generic (default)
- PACKAGES:=
-endef
-
-define Profile/Generic/Description
- Generic package set compatible with most boards.
-endef
-$(eval $(call Profile,Generic))
-
+++ /dev/null
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/P334WT
- NAME:=ZyXEL Prestige 334WT
- PACKAGES:=kmod-acx-mac80211
-endef
-
-define Profile/P334WT/Description
- Package set optimized for the ZyXEL Prestige 334WT board.
-endef
-
-define Profile/P335WT
- NAME:=ZyXEL Prestige 335WT
- PACKAGES:=kmod-acx-mac80211 kmod-usb-core kmod-usb-adm5120
-endef
-
-define Profile/P335WT/Description
- Package set optimized for the ZyXEL Prestige 335WT board.
-endef
-
-$(eval $(call Profile,P334WT))
-$(eval $(call Profile,P335WT))
+++ /dev/null
-ARCH:=mips
-SUBTARGET:=router_be
-BOARDNAME:=Big Endian
-FEATURES+=squashfs
-
-define Target/Description
- Build firmware images for Infineon/ADMTek ADM5120 based boards
- running in big-endian mode (e.g : ZyXEL Prestige 335WT ...)
-endef
-
+++ /dev/null
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/Generic
- NAME:=Generic (default)
- PACKAGES:=
-endef
-
-define Profile/Generic/Description
- Generic package set compatible with most boards.
-endef
-
-define Profile/EB-214A
- NAME:=Generic EB-214A
- PACKAGES:=-wpad-mini -admswconfig -kmod-usb-adm5120 -kmod-ledtrig-adm5120-switch -dnsmasq kmod-usb-uhci kmod-usb2
-endef
-
-define Profile/EB-214A/Description
- Package set optimized for generic EB-214A boards.
-endef
-
-$(eval $(call Profile,Generic))
-$(eval $(call Profile,EB-214A))
-
+++ /dev/null
-#
-# Copyright (C) 2007-2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/CAS630
- NAME:=Cellvision CAS-630 IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS630/Description
- Package set optimized for the Cellvision CAS-630 device.
-endef
-
-define Profile/CAS630W
- NAME:=Cellvision CAS-630W IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS630W/Description
- Package set optimized for the Cellvision CAS-630W device.
-endef
-
-define Profile/CAS670
- NAME:=Cellvision CAS-670 IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS670/Description
- Package set optimized for the Cellvision CAS-670 device.
-endef
-
-define Profile/CAS670W
- NAME:=Cellvision CAS-670W IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS670W/Description
- Package set optimized for the Cellvision CAS-670 device.
-endef
-
-define Profile/CAS700
- NAME:=Cellvision CAS-700 IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS700/Description
- Package set optimized for the Cellvision CAS-700 device.
-endef
-
-define Profile/CAS700W
- NAME:=Cellvision CAS-700W IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS700W/Description
- Package set optimized for the Cellvision CAS-700W device.
-endef
-
-define Profile/CAS771
- NAME:=Cellvision CAS-771 IP camera (Experimental)
- PACKAGES:=-wpad-mini kmod-video-cpia2 kmod-usb-ohci kmod-usb2 kmod-usb-audio
-endef
-
-define Profile/CAS771/Description
- Package set optimized for the Cellvision CAS-771 device.
-endef
-
-define Profile/CAS771W
- NAME:=Cellvision CAS-771W IP camera (Experimental)
- PACKAGES:=-wpad-mini kmod-video-cpia2 kmod-usb-ohci kmod-usb2 kmod-usb-audio kmod-rt2500-pci
-endef
-
-define Profile/CAS771W/Description
- Package set optimized for the Cellvision CAS-771W device.
-endef
-
-define Profile/CAS790
- NAME:=Cellvision CAS-790 IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS790/Description
- Package set optimized for the Cellvision CAS-790 device.
-endef
-
-define Profile/CAS861
- NAME:=Cellvision CAS-861 IP camera (Experimental)
- # TODO: add default packages
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/CAS861/Description
- Package set optimized for the Cellvision CAS-861 device.
-endef
-
-define Profile/CAS861W
- NAME:=Cellvision CAS-861W IP camera (Experimental)
- PACKAGES:=kmod-rt2500-pci
-endef
-
-define Profile/CAS861W/Description
- Package set optimized for the Cellvision CAS-861W device.
-endef
-
-define Profile/NFS101U
- NAME:=Cellvision NFS-101U Network File Server (Experimental)
- PACKAGES:=-wpad-mini kmod-usb-ohci kmod-usb2
-endef
-
-define Profile/NFS101U/Description
- Package set optimized for the Cellvision NFS-101U device.
-endef
-
-define Profile/NFS101WU
- NAME:=Cellvision NFS-101WU Network File Server (Experimental)
- PACKAGES:=-wpad-mini kmod-usb-ohci kmod-usb2
-endef
-
-define Profile/NFS101WU/Description
- Package set optimized for the Cellvision NFS-101WU device.
-endef
-
-$(eval $(call Profile,CAS630))
-$(eval $(call Profile,CAS630W))
-$(eval $(call Profile,CAS670))
-$(eval $(call Profile,CAS670W))
-$(eval $(call Profile,CAS700))
-$(eval $(call Profile,CAS700W))
-$(eval $(call Profile,CAS771))
-$(eval $(call Profile,CAS771W))
-$(eval $(call Profile,CAS790))
-$(eval $(call Profile,CAS861))
-$(eval $(call Profile,CAS861W))
-$(eval $(call Profile,NFS101U))
-$(eval $(call Profile,NFS101WU))
-
+++ /dev/null
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/NP27G
- NAME:=Compex NP27G
- PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-adm5120
-endef
-
-define Profile/NP27G/Description
- Package set optimized for the Compex NP27G.
-endef
-
-define Profile/NP28G
- NAME:=Compex NP28G
- PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-uhci kmod-usb2
-endef
-
-define Profile/NP28G/Description
- Package set optimized for the Compex NP28G.
-endef
-
-define Profile/WP54
- NAME:=Compex WP54 family
- PACKAGES:=kmod-ath5k
-endef
-
-define Profile/WP54/Description
- Package set optimized for the Compex WP54 family.
-endef
-
-$(eval $(call Profile,NP27G))
-$(eval $(call Profile,NP28G))
-$(eval $(call Profile,WP54))
+++ /dev/null
-#
-# Copyright (C) 2007,2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/BR6104K
- NAME:=Edimax BR-6104K (Unofficial)
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/BR6104K/Description
- Package set optimized for the Edimax BR-6104K
-endef
-
-define Profile/BR6104KP
- NAME:=Edimax BR-6104KP (Unofficial)
- PACKAGES:=-wpad-mini kmod-usb-core kmod-usb-adm5120
-endef
-
-define Profile/BR6104KP/Description
- Package set optimized for the Edimax BR-6104KP
-endef
-
-define Profile/BR6104WG
- NAME:=Edimax BR-6104Wg (Unofficial, No WiFi)
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/BR6104WG/Description
- Package set optimized for the Edimax BR-6104Wg
-endef
-
-define Profile/BR6114WG
- NAME:=Edimax BR-6114WG (Unofficial, No WiFi)
- PACKAGES:=-wpad-mini
-endef
-
-define Profile/BR6114WG/Description
- Package set optimized for the Edimax BR-6114WG
-endef
-
-$(eval $(call Profile,BR6104K))
-$(eval $(call Profile,BR6104KP))
-$(eval $(call Profile,BR6104WG))
-$(eval $(call Profile,BR6114WG))
+++ /dev/null
-#
-# Copyright (C) 2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/EASY5120RT
- NAME:=Infineon EASY 5120-RT Reference Board
- PACKAGES:=kmod-usb-core kmod-usb-adm5120
-endef
-
-define Profile/EASY5120RT/Description
- Package set optimized for the Infineon EASY 5120-RT Reference Board
-endef
-
-$(eval $(call Profile,EASY5120RT))
-
-define Profile/EASY5120PATA
- NAME:=Infineon EASY 5120P-ATA Reference Board
-endef
-
-define Profile/EASY5120RT/Description
- Package set optimized for the Infineon EASY 5120P-ATA Reference Board
-endef
-
-$(eval $(call Profile,EASY5120PATA))
+++ /dev/null
-#
-# Copyright (C) 2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/PMUGW
- NAME:=Motorola Powerline MU Gateway (EXPERIMENTAL)
-endef
-
-define Profile/PMUGW/Description
- Package set optimized for the Motorola Powerline MU Gateway board
-endef
-
-$(eval $(call Profile,PMUGW))
+++ /dev/null
-#
-# Copyright (C) 2007-2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/5GXI
- NAME:=Osbridge 5GXi/5XLi (Unofficial)
-endef
-
-define Profile/5GXI/Description
- Package set optimized for the OSBRiDGE 5GXi/5XLi boards.
-endef
-
-$(eval $(call Profile,5GXI))
+++ /dev/null
-ARCH:=mipsel
-SUBTARGET:=router_le
-BOARDNAME:=Little Endian
-FEATURES+=squashfs tgz
-
-define Target/Description
- Build firmware images for Infineon/ADMtek ADM5120 based boards
- running in little-endian mode (e.g: RouterBoard RB1xx, Compex WP54x ...)
-endef
-
+++ /dev/null
-#
-# 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
-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))
+++ /dev/null
-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
+++ /dev/null
-#!/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
-}
+++ /dev/null
-#!/bin/sh
-
-init_hotplug_failsafe() {
- echo '/sbin/hotplug.failsafe' > /proc/sys/kernel/hotplug
-}
-
-boot_hook_add preinit_main init_hotplug_failsafe
-
-
+++ /dev/null
-#!/bin/sh
-
-set_preinit_ifname() {
- ifname=eth0
-}
-
-boot_hook_add preinit_main set_preinit_ifname
-
-
+++ /dev/null
-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()
+++ /dev/null
-#!/bin/sh
-case "$1" in
- button) kill -USR1 1;;
-esac
+++ /dev/null
-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
+++ /dev/null
-config ARM_AMBA
- def_bool y
+++ /dev/null
-#
-# something witty --neutronscott
-#
-
-obj-y := irq.o prom.o platform.o gpio.o \
- setup.o clock.o time.o early_printk.o \
+++ /dev/null
-#
-# Infineon ADM8668 WildPass
-#
-platform-$(CONFIG_ADM8668) += adm8668/
-cflags-$(CONFIG_ADM8668) += -I$(srctree)/arch/mips/include/asm/mach-adm8668
-load-$(CONFIG_ADM8668) += 0xffffffff80002000
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-#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)
- ;
-}
+++ /dev/null
-/*
- * 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);
+++ /dev/null
-/*
- * 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();
-}
+++ /dev/null
-/*
- * 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);
+++ /dev/null
-/*
- * 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);
-}
+++ /dev/null
-#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;
-}
-
+++ /dev/null
-#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;
-}
-
+++ /dev/null
-/*
- * (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_ */
+++ /dev/null
-/************************************************************************
- *
- * 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__ */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-#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
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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 */
+++ /dev/null
-/*
- * 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);
+++ /dev/null
-/*
- * 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");
+++ /dev/null
-#
-# 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))
+++ /dev/null
-#
-# 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
+++ /dev/null
-/*
- 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;
-}
+++ /dev/null
-/*
- 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
+++ /dev/null
-#
-# 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
+++ /dev/null
-/*
- * 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");
-}
+++ /dev/null
-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 */
+++ /dev/null
-/*
- * (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 */
+++ /dev/null
-/*
- * (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_ */
+++ /dev/null
-/*
- * (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_ */
+++ /dev/null
-#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__ */
+++ /dev/null
-/*
- * (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__ */
+++ /dev/null
-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)
- }
-}
+++ /dev/null
-#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
+++ /dev/null
-#!/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
+++ /dev/null
---- 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
-@@ -834,6 +855,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"
+++ /dev/null
---- 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
-@@ -1820,6 +1820,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
+++ /dev/null
---- 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
+++ /dev/null
---- a/drivers/net/ethernet/dec/tulip/tulip_core.c
-+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
-@@ -207,6 +207,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 },
-@@ -250,7 +251,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] =
-@@ -268,11 +269,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)
- {
-@@ -289,7 +293,7 @@ static void tulip_set_power_state (struc
- }
-
- }
--
-+#endif
-
- static void tulip_up(struct net_device *dev)
- {
-@@ -303,6 +307,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);
-
-@@ -310,6 +315,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))
-@@ -317,18 +323,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);
-@@ -362,9 +372,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;
-
-@@ -520,7 +532,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;
-@@ -644,8 +656,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);
-@@ -678,8 +692,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);
-
-@@ -730,16 +746,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);
-@@ -790,7 +809,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)
-@@ -811,8 +832,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);
- }
- }
-@@ -821,8 +844,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;
-@@ -843,7 +868,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);
-
-@@ -874,7 +899,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
- }
-
-
-@@ -887,7 +914,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;
- }
-
-@@ -1165,9 +1194,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. */
-@@ -1264,19 +1295,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,
-@@ -1294,6 +1328,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) },
-@@ -1471,6 +1506,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;
-@@ -1801,6 +1838,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)
- {
-@@ -1829,6 +1867,7 @@ static void tulip_set_wolopts (struct pc
- iowrite32(tmp, ioaddr + CSR13);
- }
- }
-+#endif
-
- #ifdef CONFIG_PM
-
-@@ -1943,6 +1982,7 @@ static void tulip_remove_one(struct pci_
-
- /* pci_power_off (pdev, -1); */
- }
-+#endif /* CONFIG_TULIP_PCI */
-
- #ifdef CONFIG_NET_POLL_CONTROLLER
- /*
-@@ -1964,7 +2004,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,
-@@ -1974,10 +2015,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
-@@ -1987,13 +2030,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;
+++ /dev/null
---- 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>
-@@ -204,6 +206,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, },
-+
- };
-
-
-@@ -377,6 +382,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;
-
-@@ -396,6 +406,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);
-@@ -489,6 +500,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
-@@ -660,6 +675,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);
-@@ -696,6 +715,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);
-
-@@ -752,6 +776,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
-@@ -759,6 +790,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);
-@@ -836,6 +872,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);
- }
- }
-@@ -848,6 +888,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;
-@@ -902,6 +946,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
- }
-
-
-@@ -917,6 +964,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;
- }
-
-@@ -1192,13 +1242,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. */
-@@ -1218,6 +1275,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);
- }
-
-@@ -1984,6 +2044,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
-@@ -2017,6 +2197,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)
- {
-@@ -2033,6 +2224,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;
- }
-
-@@ -2042,6 +2236,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
+++ /dev/null
---- 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
+++ /dev/null
---- 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 *
+++ /dev/null
-#
-# 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-mini
-endef
-
-define Profile/WRTU54G-TM/Description
- Package set compatible with the Linksys WRTU54G T-Mobile
-endef
-$(eval $(call Profile,WRTU54G-TM))
-
+++ /dev/null
-#
-# Copyright (C) 2006-2011 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:=au1000
-BOARDNAME:=RMI/AMD AU1x00
-FEATURES:=squashfs usb pci
-SUBTARGETS:=au1500 au1550
-MAINTAINER:=Florian Fainelli <florian@openwrt.org>
-
-KERNEL_PATCHVER:=3.18
-
-define Target/Description
- Build firmware for RMI/AMD Alchemy 1500,1550 boards
- (e.g. 4G-Systems Mesh/Access Cube, DBAu1550 ...)
-endef
-
-include $(INCLUDE_DIR)/target.mk
-DEFAULT_PACKAGES += wpad-mini yamonenv
-
-define Kernel/BuildImage
- $(call Kernel/BuildImage/Default)
- $(CP) $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.flash.srec $(LINUX_DIR)/zImage.flash.srec
- $(CP) $(LINUX_DIR)/arch/mips/boot/compressed/images/zImage.srec $(LINUX_DIR)/zImage.srec
-endef
-
-$(eval $(call BuildTarget))
+++ /dev/null
-CONFIG_DMA_NONCOHERENT=y
-# CONFIG_MIPS_DB1550 is not set
-CONFIG_MIPS_MTX1=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_WDT_MTX1=y
+++ /dev/null
-#
-# Copyright (C) 2006 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/Atheros
- NAME:=Atheros WiFi (default)
- PACKAGES:=kmod-ath5k
-endef
-$(eval $(call Profile,Atheros))
-
+++ /dev/null
-#
-# Copyright (C) 2007-2008 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/InternetBox
- NAME:=T-Mobile "InternetBox"
- PACKAGES:=kmod-ath5k kmod-usb-core kmod-usb-ohci kmod-usb-serial kmod-usb-serial-option \
- comgt
-endef
-
-define Profile/InternetBox/Description
- Package set for the T-Mobile "InternetBox" (TMD SB1-S)
-endef
-
-$(eval $(call Profile,InternetBox))
+++ /dev/null
-#
-# Copyright (C) 2007-2009 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/MeshCube
- NAME:=MeshCube MTX-1
- PACKAGES:=kmod-ath5k kmod-net-prism54 \
- kmod-usb-core kmod-usb-ohci kmod-usb-storage kmod-fs-ext4 kmod-fs-vfat
-endef
-
-define Profile/MeshCube/Description
- Package set for the 4G MeshCube (MTX-1)
-endef
-
-$(eval $(call Profile,MeshCube))
+++ /dev/null
-BOARDNAME:=Au1500
-
-DEFAULT_PACKAGES+= wpad-mini
-
-define Target/Description
- Build firmware images for Au1500 based boards
-endef
+++ /dev/null
-CONFIG_DMA_COHERENT=y
-CONFIG_MIPS_DB1550=y
-CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
-# CONFIG_MIPS_MTX1 is not set
+++ /dev/null
-#
-# Copyright (C) 2009-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/DBAu1550
- NAME:=AMD DBAu1550 Development Kit
- PACKAGES:=kmod-pcmcia-au1000 kmod-usb-ohci kmod-usb2-pci
-endef
-
-$(eval $(call Profile,DBAu1550))
+++ /dev/null
-BOARDNAME:=Au1550
-FEATURES += pcmcia
-
-DEFAULT_PACKAGES+= wpad-mini
-
-define Target/Description
- Build firmware images for Au1550 based boards
-endef
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2007-2013 OpenWrt.org
-
-. /lib/functions/leds.sh
-
-set_state() {
- case "$1" in
- preinit)
- led_off "mtx1:green"
- led_on "mtx1:red"
- ;;
- failsafe)
- led_on "mtx1:green"
- led_on "mtx1:red"
- ;;
- done)
- led_on "mtx1:green"
- led_off "mtx1:red"
- ;;
- esac
-}
+++ /dev/null
-KERNEL_IMG="openwrt-au1000-au1500-vmlinux.bin"
-ROOTFS_IMG="openwrt-au1000-au1500-root.fs"
-
-platform_check_image() {
- [ "$#" -gt 1 ] && return 1
- case "$(get_magic_word "$1")" in
- 6f70)
- ( get_image "$1" | tar -tf - $KERNEL_IMG >/dev/null && \
- get_image "$1" | tar -tf - $ROOTFS_IMG >/dev/null) || {
- echo "Invalid image contents"
- return 1
- }
- return 0;;
- *)
- echo "Invalid image type"
- return 1;;
- esac
-}
-
-platform_do_upgrade() {
- sync
- local conf=""
- [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && conf="-j $CONF_TAR"
- get_image "$1" | tar -Oxvf - $KERNEL_IMG | mtd write - "kernel"
- get_image "$1" | tar -Oxvf - $ROOTFS_IMG | mtd $conf write - "rootfs"
-}
+++ /dev/null
-CONFIG_64BIT_PHYS_ADDR=y
-CONFIG_ALCHEMY_GPIOINT_AU1000=y
-CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
-CONFIG_ARCH_DISCARD_MEMBLOCK=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CEVT_R4K=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock0 rootfstype=squashfs,jffs2"
-CONFIG_CMDLINE_BOOL=y
-# CONFIG_CMDLINE_OVERRIDE is not set
-# CONFIG_CPU_BIG_ENDIAN is not set
-CONFIG_CPU_GENERIC_DUMP_TLB=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_R4K_CACHE_TLB=y
-CONFIG_CPU_R4K_FPU=y
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-CONFIG_CRC16=y
-CONFIG_CSRC_R4K=y
-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_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_HARDWARE_WATCHPOINTS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=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_IDE=y
-CONFIG_HAVE_KERNEL_BZIP2=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZ4=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HW_HAS_PCI=y
-CONFIG_HW_RANDOM=y
-CONFIG_HZ=250
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IRQ_CPU=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_KEXEC=y
-CONFIG_LEDS_GPIO=y
-CONFIG_MAGIC_SYSRQ=y
-CONFIG_MDIO_BOARDINFO=y
-CONFIG_MIPS=y
-CONFIG_MIPS_ALCHEMY=y
-CONFIG_MIPS_AU1X00_ENET=y
-CONFIG_MIPS_DB1000=y
-# CONFIG_MIPS_DB1XXX is not set
-# CONFIG_MIPS_DB1235 is not set
-# CONFIG_MIPS_GPR is not set
-# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_MIPS_MACHINE is not set
-# CONFIG_MIPS_MTX1 is not set
-CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_XXS1500 is not set
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-# CONFIG_MTD_CFI_INTELEXT is not set
-# CONFIG_MTD_COMPLEX_MAPPINGS is not set
-CONFIG_MTD_PHYSMAP=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_PER_CPU_KM=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_PHYLIB=y
-CONFIG_PHYS_ADDR_T_64BIT=y
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_PREVENT_FIRMWARE_BUILD is not set
-# CONFIG_RCU_STALL_COMMON is not set
-# CONFIG_SCSI_DMA is not set
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
-# CONFIG_STANDALONE is not set
-CONFIG_SYS_HAS_CPU_MIPS32_R1=y
-CONFIG_SYS_HAS_EARLY_PRINTK=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
-CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_SYS_SUPPORTS_ZBOOT=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_USB_SUPPORT=y
-CONFIG_WATCHDOG_CORE=y
-CONFIG_ZONE_DMA_FLAG=0
+++ /dev/null
-#
-# Copyright (C) 2006-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-JFFS2_BLOCKSIZE = 128k
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-LOADADDR = 0x81000000 # RAM start + 16M
-KERNEL_ENTRY = 0x80100000
-RAMSIZE = 0x00100000 # 1MB
-
-FLASH_KERNEL := 0xBFD00000
-FLASH_FS := 0xBE000000
-
-LOADER_MAKEOPTS= \
- KDIR=$(KDIR) \
- LOADADDR=$(LOADADDR) \
- KERNEL_ENTRY=$(KERNEL_ENTRY) \
- RAMSIZE=$(RAMSIZE)
-
-define Build/Clean
- $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
-endef
-
-DROP_SECTIONS := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
-OBJCOPY_SREC := $(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
-OBJCOPY_BIN := $(TARGET_CROSS)objcopy -S -O binary $(addprefix --remove-section=,$(DROP_SECTIONS))
-
-define Image/Prepare
- cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
-
- # Build RAM image
- $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
- $(LOADER_MAKEOPTS) \
- clean compile
- $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/kernel.ram.srec
-
- # Build Flash image
- $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
- $(LOADER_MAKEOPTS) \
- IMAGE_COPY=1 \
- LOADER_ENTRY=$(FLASH_KERNEL) \
- LOADER_TYPE=_flash \
- clean compile
- $(OBJCOPY_SREC) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.srec
- $(OBJCOPY_BIN) $(KDIR)/loader_flash.elf $(KDIR)/kernel.flash.bin
-endef
-
-define Image/Build/Initramfs
- $(OBJCOPY_SREC) $(KDIR)/vmlinux-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs.srec
-endef
-
-define Image/Build
- $(SCRIPT_DIR)/srecimage.pl $(KDIR)/root.$(1) $(KDIR)/root.$(1).srec $(FLASH_FS)
- grep -v S7 $(KDIR)/root.$(1).srec > $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec
- grep -v S0 $(KDIR)/kernel.flash.srec >> $(BIN_DIR)/$(IMG_PREFIX)-$(1).srec
- $(INSTALL_BIN) $(KDIR)/kernel.flash.bin $(BIN_DIR)/$(IMG_PREFIX)-vmlinux.bin
- $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs
- $(CP) $(KDIR)/kernel.flash.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-flash.srec
- $(CP) $(KDIR)/kernel.ram.srec $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-ram.srec
- $(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).fs $(TMP_DIR)/$(IMG_PREFIX)-root.fs
- tar -C $(BIN_DIR) -cvzf $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.bin \
- $(IMG_PREFIX)-vmlinux.bin -C $(TMP_DIR) $(IMG_PREFIX)-root.fs
-ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
- $(call Image/Build/Initramfs)
-endif
-endef
-
-$(eval $(call BuildImage))
+++ /dev/null
-#
-# Copyright (C) 2010-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define KernelPackage/pcmcia-au1000
- SUBMENU:=$(PCMCIA_MENU)
- TITLE:=RMI/AMD Au1000 PCMCIA support
- DEPENDS:=@TARGET_au1000 +kmod-pcmcia-core +kmod-pcmcia-rsrc
- FILES:=$(LINUX_DIR)/drivers/pcmcia/db1xxx_ss.ko
- KCONFIG:=CONFIG_PCMCIA_ALCHEMY_DEVBOARD
- AUTOLOAD:=$(call AutoLoad,41,db1xxx_ss)
-endef
-
-$(eval $(call KernelPackage,pcmcia-au1000))
+++ /dev/null
---- a/arch/mips/alchemy/board-mtx1.c
-+++ b/arch/mips/alchemy/board-mtx1.c
-@@ -169,7 +169,7 @@ static struct platform_device mtx1_gpio_
-
- static struct mtd_partition mtx1_mtd_partitions[] = {
- {
-- .name = "filesystem",
-+ .name = "rootfs",
- .size = 0x01C00000,
- .offset = 0,
- },
+++ /dev/null
---- a/drivers/net/ethernet/amd/au1000_eth.c
-+++ b/drivers/net/ethernet/amd/au1000_eth.c
-@@ -1113,10 +1113,14 @@ static void au1000_multicast_list(struct
- writel(reg, &aup->mac->control);
- }
-
-+#define AU1000_KNOWN_PHY_IOCTLS (SIOCGMIIPHY & 0xfff0)
- static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
- {
- struct au1000_private *aup = netdev_priv(dev);
-
-+ if((cmd & AU1000_KNOWN_PHY_IOCTLS) != AU1000_KNOWN_PHY_IOCTLS)
-+ return -EINVAL;
-+
- if (!netif_running(dev))
- return -EINVAL;
-
+++ /dev/null
---- a/arch/mips/alchemy/board-mtx1.c
-+++ b/arch/mips/alchemy/board-mtx1.c
-@@ -98,6 +98,9 @@ void __init board_setup(void)
- alchemy_gpio_direction_output(211, 1); /* green on */
- alchemy_gpio_direction_output(212, 0); /* red off */
-
-+ /* Set watchdog pin low */
-+ alchemy_gpio_direction_output(215, 0);
-+
- pm_power_off = mtx1_power_off;
- _machine_halt = mtx1_power_off;
- _machine_restart = mtx1_reset;
+++ /dev/null
---- a/arch/mips/alchemy/devboards/db1300.c
-+++ b/arch/mips/alchemy/devboards/db1300.c
-@@ -712,6 +712,7 @@ static struct platform_device db1300_lcd
-
- /**********************************************************************/
-
-+#ifdef CONFIG_TOUCHSCREEN_WM97XX
- static void db1300_wm97xx_irqen(struct wm97xx *wm, int enable)
- {
- if (enable)
-@@ -744,6 +745,15 @@ static int db1300_wm97xx_probe(struct pl
- return wm97xx_register_mach_ops(wm, &db1300_wm97xx_ops);
- }
-
-+#else
-+
-+static int db1300_wm97xx_probe(struct platform_device *pdev)
-+{
-+ return -1;
-+}
-+
-+#endif
-+
- static struct platform_driver db1300_wm97xx_driver = {
- .driver.name = "wm97xx-touch",
- .driver.owner = THIS_MODULE,
+++ /dev/null
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=arm
-BOARD:=mcs814x
-BOARDNAME:=Moschip MCS814x
-FEATURES:=usb squashfs low_mem
-CPU_TYPE:=arm926ej-s
-MAINTAINER:=Florian Fainelli <florian@openwrt.org>
-
-KERNEL_PATCHVER:=3.18
-
-DEVICE_TYPE:=other
-
-include $(INCLUDE_DIR)/target.mk
-
-DEFAULT_PACKAGES := $(filter-out ppp%,$(DEFAULT_PACKAGES)) \
- kmod-usb-core kmod-usb2 kmod-usb-ohci \
- kmod-usb-storage kmod-fs-vfat \
- kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-iso8859-15 \
- kmod-nls-utf8 \
- kmod-mcs814x-wdt kmod-usb-ledtrig-usbport
-
-KERNELNAME:=zImage dtbs
-
-$(eval $(call BuildTarget))
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (C) 2012-2015 OpenWrt.org
-#
-
-. /lib/functions/uci-defaults.sh
-
-board_config_update
-
-board=$(board_name)
-
-case "$board" in
-dlan-usb-extender)
- ucidef_set_led_usbdev "usb" "USB" "dlan-usb-extender:green:usb" "2-1"
- ;;
-rbt-832)
- ucidef_set_led_usbdev "usb1" "USB1" "rbt-832:red:usb0" "1-1"
- ucidef_set_led_usbdev "usb2" "USB2" "rbt-832:red:usb1" "1-2"
- ucidef_set_led_usbdev "usb3" "USB3" "rbt-832:red:usb2" "1-3"
- ucidef_set_led_usbdev "usb4" "USB4" "rbt-832:red:usb3" "1-4"
- ucidef_set_led_netdev "eth" "eth" "rbt-832:red:ethernet" "eth0"
- ;;
-esac
-
-board_config_flush
-
-exit 0
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (C) 2015 OpenWrt.org
-#
-
-. /lib/functions/uci-defaults.sh
-
-board_config_update
-ucidef_set_interface_lan "eth0"
-board_config_flush
-
-exit 0
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-
-MCS814X_BOARD_NAME=
-MCS814X_MODEL=
-
-mcs814x_board_detect() {
- local machine
- local name
-
- machine=$(cat /proc/device-tree/model)
-
- case "$machine" in
- *"Devolo dLAN USB Extender")
- name="dlan-usb-extender"
- ;;
- *"Tigal RBT-832")
- name="rbt-832"
- ;;
- esac
-
- [ -z "$name" ] && name="unknown"
-
- [ -z "$MCS814X_BOARD_NAME" ] && MCS814X_BOARD_NAME="$name"
- [ -z "$MCS814X_MODEL" ] && MCS814X_MODEL="$machine"
-
- [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
-
- echo "$MCS814X_BOARD_NAME" > /tmp/sysinfo/board_name
- echo "$MCS814X_MODEL" > /tmp/sysinfo/model
-}
+++ /dev/null
-#!/bin/sh
-
-do_mcs814x() {
- . /lib/mcs814x.sh
-
- mcs814x_board_detect
-}
-
-boot_hook_add preinit_main do_mcs814x
+++ /dev/null
-CONFIG_ALIGNMENT_TRAP=y
-CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-# CONFIG_ARCH_HAS_SG_CHAIN is not set
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MCS814X=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_NR_GPIO=0
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USES_GETTIMEOFFSET=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARM=y
-CONFIG_ARM_APPENDED_DTB=y
-# CONFIG_ARM_ATAG_DTB_COMPAT is not set
-# CONFIG_ARM_CPU_SUSPEND is not set
-CONFIG_ARM_L1_CACHE_SHIFT=5
-# CONFIG_ARM_THUMB is not set
-CONFIG_BINFMT_MISC=y
-# CONFIG_CACHE_L2X0 is not set
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="earlyprintk"
-CONFIG_CPU_32v5=y
-CONFIG_CPU_ABRT_EV5TJ=y
-CONFIG_CPU_ARM926T=y
-# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
-CONFIG_CPU_CACHE_VIVT=y
-CONFIG_CPU_COPY_V4WB=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
-# CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_PABRT_LEGACY=y
-CONFIG_CPU_TLB_V4WBI=y
-CONFIG_CPU_USE_DOMAINS=y
-CONFIG_CRC_CCITT=y
-CONFIG_CRC_ITU_T=y
-CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
-CONFIG_DEBUG_LL=y
-CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
-CONFIG_DEBUG_LL_UART_NONE=y
-CONFIG_DEBUG_UART_8250=y
-# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set
-CONFIG_DEBUG_UART_8250_SHIFT=2
-# CONFIG_DEBUG_UART_8250_WORD is not set
-CONFIG_DEBUG_UART_PHYS=0x400dc000
-# CONFIG_DEBUG_UART_PL01X is not set
-CONFIG_DEBUG_UART_VIRT=0xf00dc000
-# CONFIG_DEBUG_USER is not set
-CONFIG_DTC=y
-CONFIG_EARLY_PRINTK=y
-# CONFIG_ENABLE_WARN_DEPRECATED is not set
-CONFIG_FIQ=y
-CONFIG_FRAME_POINTER=y
-CONFIG_GENERIC_ALLOCATOR=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_CHIP=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_MCS814X=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=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_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZ4=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PERF_REGS=y
-CONFIG_HAVE_PERF_USER_STACK_DUMP=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HW_RANDOM=y
-CONFIG_HW_RANDOM_MCS814X=y
-CONFIG_HZ_FIXED=0
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_IOMMU_HELPER=y
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-# CONFIG_ISDN is not set
-CONFIG_JFFS2_LZO=y
-CONFIG_JFFS2_RUBIN=y
-# CONFIG_JFFS2_SUMMARY is not set
-CONFIG_JFFS2_ZLIB=y
-CONFIG_KALLSYMS=y
-CONFIG_LEDS_GPIO=y
-# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
-# CONFIG_LEDS_TRIGGER_NETDEV is not set
-# CONFIG_LEDS_TRIGGER_TIMER is not set
-CONFIG_LIBCRC32C=y
-CONFIG_LIBFDT=y
-CONFIG_LZO_COMPRESS=y
-CONFIG_LZO_DECOMPRESS=y
-CONFIG_MACH_DLAN_USB_EXT=y
-CONFIG_MACH_RBT_832=y
-CONFIG_MCS8140=y
-CONFIG_MCS814X_PHY=y
-# CONFIG_MCS814X_WATCHDOG is not set
-CONFIG_MDIO_BOARDINFO=y
-CONFIG_MODULES_USE_ELF_REL=y
-# CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_IMPA7 is not set
-CONFIG_MTD_JEDECPROBE=y
-CONFIG_MTD_PHYSMAP=y
-# CONFIG_MTD_ROOTFS_SPLIT is not set
-CONFIG_MTD_SPLIT_FIRMWARE=y
-CONFIG_MTD_SPLIT_FIRMWARE_NAME="linux"
-CONFIG_MTD_SPLIT_UIMAGE_FW=y
-CONFIG_MULTI_IRQ_HANDLER=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_KUSER_HELPERS=y
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NET_KEY=y
-# CONFIG_NET_VENDOR_BROADCOM is not set
-# CONFIG_NET_VENDOR_FARADAY is not set
-# CONFIG_NET_VENDOR_INTEL is not set
-# CONFIG_NET_VENDOR_MARVELL is not set
-# CONFIG_NET_VENDOR_MICREL is not set
-# CONFIG_NET_VENDOR_NATSEMI is not set
-# CONFIG_NET_VENDOR_SEEQ is not set
-# CONFIG_NET_VENDOR_SMSC is not set
-# CONFIG_NET_VENDOR_STMICRO is not set
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="iso8859-15"
-CONFIG_NO_BOOTMEM=y
-CONFIG_NUPORT_ETHERNET_DRIVER=y
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MDIO=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xC0000000
-# CONFIG_PARTITION_ADVANCED is not set
-# CONFIG_PCI_SYSCALL is not set
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PHYLIB=y
-CONFIG_PHYS_OFFSET=0x00000000
-# CONFIG_PREEMPT_RCU is not set
-# CONFIG_PREVENT_FIRMWARE_BUILD is not set
-# CONFIG_RCU_STALL_COMMON is not set
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-# CONFIG_SCHED_HRTICK is not set
-# CONFIG_SCSI_DMA is not set
-CONFIG_SERIAL_OF_PLATFORM=y
-CONFIG_SPLIT_PTLOCK_CPUS=999999
-# CONFIG_SWAP is not set
-CONFIG_SWIOTLB=y
-# CONFIG_SYN_COOKIES is not set
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_UID16=y
-CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h"
-CONFIG_USB_SUPPORT=y
-CONFIG_USE_OF=y
-CONFIG_VECTORS_BASE=0xffff0000
-# CONFIG_VFP is not set
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_WATCHDOG_CORE=y
-CONFIG_WATCHDOG_NOWAYOUT=y
-# CONFIG_WEXT_PRIV is not set
-# CONFIG_WEXT_SPY is not set
-# CONFIG_WIRELESS_EXT is not set
-CONFIG_XFRM_ALGO=y
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_ZBOOT_ROM_BSS=0
-CONFIG_ZBOOT_ROM_TEXT=0
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZONE_DMA_FLAG=0
+++ /dev/null
-/*
- * dlan-usb-extender.dts - Device Tree file for Devolo dLAN USB Extender
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under GPLv2
- */
-
-/dts-v1/;
-#include "mcs8140.dtsi"
-
-/ {
- model = "Devolo dLAN USB Extender";
- compatible = "devolo,dlan-usb-extender", "moschip,mcs8140", "moschip,mcs814x";
-
- chosen {
- bootargs = "mem=16M console=ttyS0,57600 earlyprintk";
- };
-
- ahb {
- vci {
- eth0: ethernet@40084000 {
- phy = <&phy0>;
- phy-mode = "mii";
-
- phy0: ethernet-phy@0 {
- reg = <8>;
- };
- };
-
- adc {
- sdram: memory@0,0 {
- reg = <0 0 0x1000000>;
- };
-
- nor: flash@7,0 {
-
- partition@0 {
- label = "ArmBoot";
- reg = <0 0x30000>;
- };
- partition@30000 {
- label = "Config1";
- reg = <0x30000 0x10000>;
- };
- partition@40000 {
- label = "Config2";
- reg = <0x40000 0x10000>;
- };
- partition@50000 {
- label = "linux";
- reg = <0x50000 0x4C0000>;
- };
- };
- };
-
- leds {
- compatible = "gpio-leds";
-
- usb {
- label = "dlan-usb-extender:green:usb";
- gpios = <&gpio 19 0>; // gpio 19 active high
- };
- };
- };
- };
-};
-
+++ /dev/null
-/*
- * mcs8140.dtsi - Device Tree Include file for Moschip MCS8140 family SoC
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under GPLv2.
- */
-
-#include "skeleton.dtsi"
-
-/ {
- model = "Moschip MCS8140 family SoC";
- compatible = "moschip,mcs8140";
- interrupt-parent = <&intc>;
-
- aliases {
- serial0 = &uart0;
- eth0 = ð0;
- };
-
- cpus {
- cpu@0 {
- compatible = "arm,arm926ejs";
- };
- };
-
- ahb {
- compatible = "simple-bus";
- #address-cells = <1>;
- #size-cells = <1>;
- ranges;
-
- vci {
- compatible = "simple-bus";
- #address-cells = <1>;
- #size-cells = <1>;
- ranges;
-
- eth0: ethernet@40084000 {
- #address-cells = <1>;
- #size-cells = <0>;
-
- compatible = "moschip,nuport-mac";
- reg = <0x40084000 0xd8 // mac
- 0x40080000 0x58>; // dma channels
- interrupts = <4 5 29>; /* tx, rx, link */
- nuport-mac,buffer-shifting;
- nuport-mac,link-activity = <0>;
- };
-
- tso@40088000 {
- reg = <0x40088000 0x1c>;
- interrupts = <7>;
- };
-
- i2s@4008c000 {
- compatible = "moschip,mcs814x-i2s";
- reg = <0x4008c000 0x18>;
- interrupts = <8>;
- };
-
- ipsec@40094000 {
- compatible = "moschip,mcs814x-ipsec";
- reg = <0x40094000 0x1d8>;
- interrupts = <16>;
- };
-
- rng@4009c000 {
- compatible = "moschip,mcs814x-rng";
- reg = <0x4009c000 0x8>;
- };
-
- memc@400a8000 {
- reg = <0x400a8000 0x58>;
- };
-
- list-proc@400ac0c0 {
- reg = <0x400ac0c0 0x38>;
- interrupts = <19 27>; // done, error
- };
-
- gpio: gpio@400d0000 {
- compatible = "moschip,mcs814x-gpio";
- reg = <0x400d0000 0x670>;
- interrupts = <10>;
- #gpio-cells = <2>;
- gpio-controller;
- num-gpios = <20>;
- };
-
- eepio: gpio@400d4000 {
- compatible = "moschip,mcs814x-gpio";
- reg = <0x400d4000 0x470>;
- #gpio-cells = <2>;
- gpio-controller;
- num-gpios = <4>;
- };
-
- uart0: serial@400dc000 {
- compatible = "ns16550";
- reg = <0x400dc000 0x20>;
- clock-frequency = <50000000>;
- reg-shift = <2>;
- interrupts = <21>;
- status = "okay";
- };
-
- intc: interrupt-controller@400e4000 {
- #interrupt-cells = <1>;
- compatible = "moschip,mcs814x-intc";
- interrupt-controller;
- interrupt-parent;
- reg = <0x400e4000 0x48>;
- };
-
- m2m@400e8000 {
- reg = <0x400e8000 0x24>;
- interrupts = <17>;
- };
-
- eth-filters@400ec000 {
- reg = <0x400ec000 0x80>;
- };
-
- timer: timer@400f800c {
- compatible = "moschip,mcs814x-timer";
- interrupts = <0>;
- reg = <0x400f800c 0x8>;
- };
-
- watchdog@400f8014 {
- compatible = "moschip,mcs814x-wdt";
- reg = <0x400f8014 0x8>;
- };
-
- adc {
- compatible = "simple-bus";
- #address-cells = <2>;
- #size-cells = <1>;
- // 8 64MB chip-selects
- ranges = <0 0 0x00000000 0x4000000 // sdram
- 1 0 0x04000000 0x4000000 // sdram
- 2 0 0x08000000 0x4000000 // reserved
- 3 0 0x0c000000 0x4000000 // flash/localbus
- 4 0 0x10000000 0x4000000 // flash/localbus
- 5 0 0x14000000 0x4000000 // flash/localbus
- 6 0 0x18000000 0x4000000 // flash/localbus
- 7 0 0x1c000000 0x4000000>; // flash/localbus
-
- sdram: memory@0,0 {
- reg = <0 0 0>;
- };
-
- nor: flash@7,0 {
- reg = <7 0 0x4000000>;
- compatible = "cfi-flash";
- bank-width = <1>; // 8-bit external flash
- #address-cells = <1>;
- #size-cells = <1>;
- };
- };
-
- usb0: ehci@400fc000 {
- compatible = "moschip,mcs814x-ehci", "usb-ehci";
- reg = <0x400fc000 0x74>;
- interrupts = <2>;
- };
-
- usb1: ohci@400fd000 {
- compatible = "moschip,mcs814x-ohci", "ohci-le";
- reg = <0x400fd000 0x74>;
- interrupts = <11>;
- };
-
- usb2: ohci@400fe000 {
- compatible = "moschip,mcs814x-ohci", "ohci-le";
- reg = <0x400fe000 0x74>;
- interrupts = <12>;
- };
-
- usb3: otg@400ff000 {
- compatible = "moschip,msc814x-otg", "usb-otg";
- reg = <0x400ff000 0x1000>;
- interrupts = <13>;
- };
- };
-
- };
-};
+++ /dev/null
-/*
- * rbt-832.dts - Device Tree file for Tigal RBT-832
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under GPLv2
- */
-
-/dts-v1/;
-#include "mcs8140.dtsi"
-
-/ {
- model = "Tigal RBT-832";
- compatible = "tigal,rbt-832", "moschip,mcs8140", "moschip,mcs814x";
-
- chosen {
- bootargs = "mem=32M console=ttyS0,115200 earlyprintk";
- };
-
- ahb {
- vci {
- eth0: ethernet@40084000 {
- nuport-mac,link-activity = <0x01>;
- phy = <&phy0>;
- phy-mode = "mii";
-
- phy0: ethernet-phy@0 {
- reg = <1>;
- };
- };
-
- adc {
- sdram: memory@0,0 {
- reg = <0 0 0x2000000>;
- };
-
- nor: flash@7,0 {
-
- partition@0 {
- label = "ArmBoot";
- reg = <0 0x40000>;
- };
- partition@30000 {
- label = "Enviroment";
- reg = <0x40000 0x20000>;
- };
- partition@50000 {
- label = "bZimage";
- reg = <0x60000 0x1a0000>;
- };
- partition@150000 {
- label = "UserFS";
- reg = <0x200000 0x600000>;
- };
- };
- };
-
- leds {
- compatible = "gpio-leds";
-
- ethernet {
- label = "rbt-832:red:ethernet";
- gpios = <&gpio 0 0>; // gpio 0 active high
- };
-
- usb0 {
- label = "rbt-832:red:usb0";
- gpios = <&gpio 4 0>; // gpio 4 active high
- };
-
- usb1 {
- label = "rbt-832:red:usb1";
- gpios = <&gpio 3 0>; // gpio 3 active high
- };
-
- usb2 {
- label = "rbt-832:red:usb2";
- gpios = <&gpio 2 0>; // gpio 2 active high
- };
-
- usb3 {
- label = "rbt-832:red:usb3";
- gpios = <&gpio 1 0>; // gpio 1 active high
- };
- };
- };
- };
-};
-
+++ /dev/null
-if ARCH_MCS814X
-
-config MCS8140
- bool
- select CPU_ARM926T
-
-menu "Moschip MCS8140 boards"
-
-config MACH_DLAN_USB_EXT
- bool "Devolo dLAN USB Extender"
- select MCS8140
- select NEW_LEDS
- select LEDS_CLASS
- select LEDS_GPIO
- help
- Machine support for the Devolo dLAN USB Extender
-
-config MACH_RBT_832
- bool "Tigal RBT-832"
- select MCS8140
- select NEW_LEDS
- select LEDS_CLASS
- select LEDS_GPIO
- help
- Machine support for the Tigal RBT-832 board
-
-endmenu
-
-endif
+++ /dev/null
-obj-y += clock.o
-obj-y += common.o
-obj-y += irq.o
-obj-y += timer.o
-obj-y += board-mcs8140-dt.o
+++ /dev/null
- zreladdr-y := 0x00008000
-
-dtb-$(CONFIG_MACH_DLAN_USB_EXT) += dlan-usb-extender.dtb
-dtb-$(CONFIG_MACH_RBT_832) += rbt-832.dtb
+++ /dev/null
-/*
- * Setup code for Moschip MCS8140-based board using Device Tree
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under GPLv2.
- */
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/gpio.h>
-#include <linux/irqdomain.h>
-#include <linux/of_platform.h>
-
-#include "common.h"
-
-#include <asm/setup.h>
-#include <asm/irq.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach/irq.h>
-
-static void __init mcs814x_dt_device_init(void)
-{
- of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
- mcs814x_init_machine();
-}
-
-static const char *mcs8140_dt_board_compat[] __initdata = {
- "moschip,mcs8140",
- NULL, /* sentinel */
-};
-
-DT_MACHINE_START(mcs8140_dt, "Moschip MCS8140 board")
- /* Maintainer: Florian Fainelli <florian@openwrt.org> */
- .map_io = mcs814x_map_io,
- .init_early = mcs814x_clk_init,
- .init_irq = mcs814x_of_irq_init,
- .init_time = mcs814x_timer_init,
- .init_machine = mcs814x_dt_device_init,
- .restart = mcs814x_restart,
- .dt_compat = mcs8140_dt_board_compat,
- .handle_irq = mcs814x_handle_irq,
-MACHINE_END
-
+++ /dev/null
-/*
- * Moschip MCS814x clock routines
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under GPLv2
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/export.h>
-#include <linux/spinlock.h>
-#include <linux/err.h>
-#include <linux/io.h>
-#include <linux/clkdev.h>
-#include <linux/clk.h>
-
-#include <mach/mcs814x.h>
-
-#include "common.h"
-
-#define KHZ 1000
-#define MHZ (KHZ * KHZ)
-
-struct clk_ops {
- unsigned long (*get_rate)(struct clk *clk);
- int (*set_rate)(struct clk *clk, unsigned long rate);
- struct clk *(*get_parent)(struct clk *clk);
- int (*enable)(struct clk *clk, int enable);
-};
-
-struct clk {
- struct clk *parent; /* parent clk */
- unsigned long rate; /* clock rate in Hz */
- unsigned long divider; /* clock divider */
- u32 usecount; /* reference count */
- struct clk_ops *ops; /* clock operation */
- u32 enable_reg; /* clock enable register */
- u32 enable_mask; /* clock enable mask */
-};
-
-static unsigned long clk_divide_parent(struct clk *clk)
-{
- if (clk->parent && clk->divider)
- return clk_get_rate(clk->parent) / clk->divider;
- else
- return 0;
-}
-
-static int clk_local_onoff_enable(struct clk *clk, int enable)
-{
- u32 tmp;
-
- /* no enable_reg means the clock is always enabled */
- if (!clk->enable_reg)
- return 0;
-
- tmp = readl_relaxed(mcs814x_sysdbg_base + clk->enable_reg);
- if (!enable)
- tmp &= ~clk->enable_mask;
- else
- tmp |= clk->enable_mask;
-
- writel_relaxed(tmp, mcs814x_sysdbg_base + clk->enable_reg);
-
- return 0;
-}
-
-static struct clk_ops default_clk_ops = {
- .get_rate = clk_divide_parent,
- .enable = clk_local_onoff_enable,
-};
-
-static DEFINE_SPINLOCK(clocks_lock);
-
-static const unsigned long cpu_freq_table[] = {
- 175000,
- 300000,
- 125000,
- 137500,
- 212500,
- 250000,
- 162500,
- 187500,
- 162500,
- 150000,
- 225000,
- 237500,
- 200000,
- 262500,
- 275000,
- 287500
-};
-
-static struct clk clk_cpu;
-
-/* System clock is fixed at 50Mhz */
-static struct clk clk_sys = {
- .rate = 50 * MHZ,
-};
-
-static struct clk clk_sdram;
-
-static struct clk clk_timer0 = {
- .parent = &clk_sdram,
- .divider = 2,
- .ops = &default_clk_ops,
-};
-
-static struct clk clk_timer1_2 = {
- .parent = &clk_sys,
-};
-
-/* Watchdog clock is system clock / 128 */
-static struct clk clk_wdt = {
- .parent = &clk_sys,
- .divider = 128,
- .ops = &default_clk_ops,
-};
-
-static struct clk clk_emac = {
- .ops = &default_clk_ops,
- .enable_reg = SYSDBG_SYSCTL,
- .enable_mask = SYSCTL_EMAC,
-};
-
-static struct clk clk_ephy = {
- .ops = &default_clk_ops,
- .enable_reg = SYSDBG_PLL_CTL,
- .enable_mask = ~SYSCTL_EPHY, /* active low */
-};
-
-static struct clk clk_cipher = {
- .ops = &default_clk_ops,
- .enable_reg = SYSDBG_SYSCTL,
- .enable_mask = SYSCTL_CIPHER,
-};
-
-#define CLK(_dev, _con, _clk) \
-{ .dev_id = (_dev), .con_id = (_con), .clk = (_clk) },
-
-static struct clk_lookup mcs814x_chip_clks[] = {
- CLK("cpu", NULL, &clk_cpu)
- CLK("sys", NULL, &clk_sys)
- CLK("sdram", NULL, &clk_sdram)
- /* 32-bits timer0 */
- CLK("timer0", NULL, &clk_timer0)
- /* 16-bits timer1 */
- CLK("timer1", NULL, &clk_timer1_2)
- /* 64-bits timer2, same as timer 1 */
- CLK("timer2", NULL, &clk_timer1_2)
- CLK(NULL, "wdt", &clk_wdt)
- CLK(NULL, "emac", &clk_emac)
- CLK(NULL, "ephy", &clk_ephy)
- CLK(NULL, "cipher", &clk_cipher)
-};
-
-static void local_clk_disable(struct clk *clk)
-{
- WARN_ON(!clk->usecount);
-
- if (clk->usecount > 0) {
- clk->usecount--;
-
- if ((clk->usecount == 0) && (clk->ops->enable))
- clk->ops->enable(clk, 0);
-
- if (clk->parent)
- local_clk_disable(clk->parent);
- }
-}
-
-static int local_clk_enable(struct clk *clk)
-{
- int ret = 0;
-
- if (clk->parent)
- ret = local_clk_enable(clk->parent);
-
- if (ret)
- return ret;
-
- if ((clk->usecount == 0) && (clk->ops->enable))
- ret = clk->ops->enable(clk, 1);
-
- if (!ret)
- clk->usecount++;
- else if (clk->parent && clk->parent->ops->enable)
- local_clk_disable(clk->parent);
-
- return ret;
-}
-
-int clk_enable(struct clk *clk)
-{
- int ret;
- unsigned long flags;
-
- spin_lock_irqsave(&clocks_lock, flags);
- ret = local_clk_enable(clk);
- spin_unlock_irqrestore(&clocks_lock, flags);
-
- return ret;
-}
-EXPORT_SYMBOL(clk_enable);
-
-void clk_disable(struct clk *clk)
-{
- unsigned long flags;
-
- spin_lock_irqsave(&clocks_lock, flags);
- local_clk_disable(clk);
- spin_unlock_irqrestore(&clocks_lock, flags);
-}
-EXPORT_SYMBOL(clk_disable);
-
-unsigned long clk_get_rate(struct clk *clk)
-{
- if (unlikely(IS_ERR_OR_NULL(clk)))
- return 0;
-
- if (clk->rate)
- return clk->rate;
-
- if (clk->ops && clk->ops->get_rate)
- return clk->ops->get_rate(clk);
-
- return clk_get_rate(clk->parent);
-}
-EXPORT_SYMBOL(clk_get_rate);
-
-struct clk *clk_get_parent(struct clk *clk)
-{
- unsigned long flags;
-
- if (unlikely(IS_ERR_OR_NULL(clk)))
- return NULL;
-
- if (!clk->ops || !clk->ops->get_parent)
- return clk->parent;
-
- spin_lock_irqsave(&clocks_lock, flags);
- clk->parent = clk->ops->get_parent(clk);
- spin_unlock_irqrestore(&clocks_lock, flags);
-
- return clk->parent;
-}
-EXPORT_SYMBOL(clk_get_parent);
-
-void __init mcs814x_clk_init(void)
-{
- u32 bs1;
- u8 cpu_freq;
-
- clkdev_add_table(mcs814x_chip_clks, ARRAY_SIZE(mcs814x_chip_clks));
-
- /* read the bootstrap registers to know the exact clocking scheme */
- bs1 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS1);
- cpu_freq = (bs1 >> CPU_FREQ_SHIFT) & CPU_FREQ_MASK;
-
- pr_info("CPU frequency: %lu (kHz)\n", cpu_freq_table[cpu_freq]);
- clk_cpu.rate = cpu_freq * KHZ;
-
- /* read SDRAM frequency */
- if (bs1 & SDRAM_FREQ_BIT)
- clk_sdram.rate = 100 * MHZ;
- else
- clk_sdram.rate = 133 * MHZ;
-
- pr_info("SDRAM frequency: %lu (MHz)\n", clk_sdram.rate / MHZ);
-}
-
+++ /dev/null
-/*
- * arch/arm/mach-mcs814x/common.c
- *
- * Core functions for Moschip MCS814x SoCs
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/gpio.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/reboot.h>
-
-#include <asm/setup.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <mach/mcs814x.h>
-#include <mach/cpu.h>
-#include <asm/pgtable.h>
-#include <asm/mach/map.h>
-
-void __iomem *mcs814x_sysdbg_base;
-
-static struct map_desc mcs814x_io_desc[] __initdata = {
- {
- .virtual = MCS814X_IO_BASE,
- .pfn = __phys_to_pfn(MCS814X_IO_START),
- .length = MCS814X_IO_SIZE,
- .type = MT_DEVICE
- },
-};
-
-struct cpu_mode {
- const char *name;
- int gpio_start;
- int gpio_end;
-};
-
-static const struct cpu_mode cpu_modes[] = {
- {
- .name = "I2S",
- .gpio_start = 4,
- .gpio_end = 8,
- },
- {
- .name = "UART",
- .gpio_start = 4,
- .gpio_end = 9,
- },
- {
- .name = "External MII",
- .gpio_start = 0,
- .gpio_end = 16,
- },
- {
- .name = "Normal",
- .gpio_start = -1,
- .gpio_end = -1,
- },
-};
-
-static void mcs814x_eth_hardware_filter_set(u8 value)
-{
- u32 reg;
-
- reg = readl_relaxed(MCS814X_VIRT_BASE + MCS814X_DBGLED);
- if (value)
- reg |= 0x80;
- else
- reg &= ~0x80;
- writel_relaxed(reg, MCS814X_VIRT_BASE + MCS814X_DBGLED);
-}
-
-static void mcs814x_eth_led_cfg_set(u8 cfg)
-{
- u32 reg;
-
- reg = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2);
- reg &= ~LED_CFG_MASK;
- reg |= cfg;
- writel_relaxed(reg, mcs814x_sysdbg_base + SYSDBG_BS2);
-}
-
-static void mcs814x_eth_buffer_shifting_set(u8 value)
-{
- u8 reg;
-
- reg = readb_relaxed(mcs814x_sysdbg_base + SYSDBG_SYSCTL_MAC);
- if (value)
- reg |= BUF_SHIFT_BIT;
- else
- reg &= ~BUF_SHIFT_BIT;
- writeb_relaxed(reg, mcs814x_sysdbg_base + SYSDBG_SYSCTL_MAC);
-}
-
-static struct of_device_id mcs814x_eth_ids[] __initdata = {
- { .compatible = "moschip,nuport-mac", },
- { /* sentinel */ },
-};
-
-/* Configure platform specific knobs based on ethernet device node
- * properties */
-static void mcs814x_eth_init(void)
-{
- struct device_node *np;
- const unsigned int *intspec;
-
- np = of_find_matching_node(NULL, mcs814x_eth_ids);
- if (!np)
- return;
-
- /* hardware filter must always be enabled */
- mcs814x_eth_hardware_filter_set(1);
-
- intspec = of_get_property(np, "nuport-mac,buffer-shifting", NULL);
- if (!intspec)
- mcs814x_eth_buffer_shifting_set(0);
- else
- mcs814x_eth_buffer_shifting_set(1);
-
- intspec = of_get_property(np, "nuport-mac,link-activity", NULL);
- if (intspec)
- mcs814x_eth_led_cfg_set(be32_to_cpup(intspec));
-
- of_node_put(np);
-}
-
-void __init mcs814x_init_machine(void)
-{
- u32 bs2, cpu_mode;
- int gpio;
-
- bs2 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2);
- cpu_mode = (bs2 >> CPU_MODE_SHIFT) & CPU_MODE_MASK;
-
- pr_info("CPU mode: %s\n", cpu_modes[cpu_mode].name);
-
- /* request the gpios since the pins are muxed for functionnality */
- for (gpio = cpu_modes[cpu_mode].gpio_start;
- gpio == cpu_modes[cpu_mode].gpio_end; gpio++) {
- if (gpio != -1)
- gpio_request(gpio, cpu_modes[cpu_mode].name);
- }
-
- mcs814x_eth_init();
-}
-
-void __init mcs814x_map_io(void)
-{
- iotable_init(mcs814x_io_desc, ARRAY_SIZE(mcs814x_io_desc));
-
- mcs814x_sysdbg_base = ioremap(MCS814X_IO_START + MCS814X_SYSDBG,
- MCS814X_SYSDBG_SIZE);
- if (!mcs814x_sysdbg_base)
- panic("unable to remap sysdbg base");
-}
-
-void mcs814x_restart(enum reboot_mode mode, const char *cmd)
-{
- writel_relaxed(~(1 << 31), mcs814x_sysdbg_base);
-}
+++ /dev/null
-#ifndef __ARCH_MCS814X_COMMON_H
-#define __ARCH_MCS814X_COMMON_H
-
-#include <linux/reboot.h>
-#include <asm/mach/time.h>
-
-void mcs814x_map_io(void);
-void mcs814x_clk_init(void);
-void mcs814x_of_irq_init(void);
-void mcs814x_init_machine(void);
-void mcs814x_handle_irq(struct pt_regs *regs);
-void mcs814x_restart(enum reboot_mode mode, const char *cmd);
-void mcs814x_timer_init(void);
-extern void __iomem *mcs814x_sysdbg_base;
-
-#endif /* __ARCH_MCS814X_COMMON_H */
+++ /dev/null
-#ifndef __ASM_ARCH_CPU_H__
-#define __ASM_ARCH_CPU_H__
-
-#include <asm/cputype.h>
-
-#define MCS8140_ID 0x41069260 /* ARM926EJ-S */
-#define MCS814X_MASK 0xff0ffff0
-
-#ifdef CONFIG_MCS8140
-/* Moschip MCS8140 is based on an ARM926EJ-S core */
-#define soc_is_mcs8140() ((read_cpuid_id() & MCS814X_MASK) == MCS8140_ID)
-#else
-#define soc_is_mcs8140() (0)
-#endif /* !CONFIG_MCS8140 */
-
-#endif /* __ASM_ARCH_CPU_H__ */
+++ /dev/null
-#include <mach/mcs814x.h>
-
- .macro addruart, rp, rv, tmp
- ldr \rp, =MCS814X_PHYS_BASE
- ldr \rv, =MCS814X_VIRT_BASE
- orr \rp, \rp, #MCS814X_UART
- orr \rv, \rv, #MCS814X_UART
- .endm
-
-#define UART_SHIFT 2
-#include <asm/hardware/debug-8250.S>
+++ /dev/null
-#include <mach/mcs814x.h>
- .macro disable_fiq
- .endm
-
- .macro arch_ret_to_user, tmp1, tmp2
- .endm
+++ /dev/null
-#ifndef __ASM_ARCH_GPIO_H
-#define __ASM_ARCH_GPIO_H
-
-/* new generic GPIO API */
-#include <asm-generic/gpio.h>
-
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-#define gpio_cansleep __gpio_cansleep
-
-static inline int gpio_to_irq(unsigned gpio)
-{
- return -EINVAL;
-}
-
-static inline int irq_to_gpio(unsigned irq)
-{
- return -EINVAL;
-}
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003 Artec Design Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H
-
-#include "mcs814x.h"
-
-#endif
-
+++ /dev/null
-/*
- * Copyright (C) 2003 Artec Design Ltd.
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARM_ARCH_IO_H
-#define __ASM_ARM_ARCH_IO_H
-
-#define IO_SPACE_LIMIT 0xffffffff
-
-/*
- * We don't support ins[lb]/outs[lb]. Make them fault.
- */
-#define __raw_readsb(p, d, l) do { *(int *)0 = 0; } while (0)
-#define __raw_readsl(p, d, l) do { *(int *)0 = 0; } while (0)
-#define __raw_writesb(p, d, l) do { *(int *)0 = 0; } while (0)
-#define __raw_writesl(p, d, l) do { *(int *)0 = 0; } while (0)
-
-#define __io(a) __typesafe_io(a)
-#define __mem_pci(a) (a)
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003 Artec Design Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARCH_IRQS_H
-#define __ASM_ARCH_IRQS_H
-
-#define FIQ_START 0
-
-#define NR_IRQS 32
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003 Artec Design Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARCH_MCS814X_H
-#define __ASM_ARCH_MCS814X_H
-
-#define MCS814X_IO_BASE 0xF0000000
-#define MCS814X_IO_START 0x40000000
-#define MCS814X_IO_SIZE 0x00100000
-
-/* IRQ controller register offset */
-#define MCS814X_IRQ_ICR 0x00
-#define MCS814X_IRQ_ISR 0x04
-#define MCS814X_IRQ_MASK 0x20
-#define MCS814X_IRQ_STS0 0x40
-
-#define MCS814X_PHYS_BASE 0x40000000
-#define MCS814X_VIRT_BASE MCS814X_IO_BASE
-
-#define MCS814X_UART 0x000DC000
-#define MCS814X_DBGLED 0x000EC000
-#define MCS814X_SYSDBG 0x000F8000
-#define MCS814X_SYSDBG_SIZE 0x50
-
-/* System configuration and bootstrap registers */
-#define SYSDBG_BS1 0x00
-#define CPU_FREQ_SHIFT 27
-#define CPU_FREQ_MASK 0x0F
-#define SDRAM_FREQ_BIT (1 << 22)
-
-#define SYSDBG_BS2 0x04
-#define LED_CFG_MASK 0x03
-#define CPU_MODE_SHIFT 23
-#define CPU_MODE_MASK 0x03
-
-#define SYSDBG_SYSCTL_MAC 0x1d
-#define BUF_SHIFT_BIT (1 << 0)
-
-#define SYSDBG_SYSCTL 0x08
-#define SYSCTL_EMAC (1 << 0)
-#define SYSCTL_EPHY (1 << 0) /* active low */
-#define SYSCTL_CIPHER (1 << 16)
-
-#define SYSDBG_PLL_CTL 0x3C
-
-#endif /* __ASM_ARCH_MCS814X_H */
-
+++ /dev/null
-/*
- * Copyright (C) 2003 Artec Design Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARCH_PARAM_H
-#define __ASM_ARCH_PARAM_H
-
-#define HZ 100
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003 Artec Design Ltd.
- * Copyright (C) 2012 Florian Fainelli <florian@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARCH_SYSTEM_H
-#define __ASM_ARCH_SYSTEM_H
-
-static inline void arch_idle(void)
-{
- cpu_do_idle();
-}
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2003 Artec Design Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARCH_TIMEX_H
-#define __ASM_ARCH_TIMEX_H
-
-/*
- * Timex specification for MCS814X
- */
-#define CLOCK_TICK_RATE 100
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __ASM_ARCH_UNCOMPRESS_H
-#define __ASM_ARCH_UNCOMPRESS_H
-
-#include <linux/serial_reg.h>
-#include <asm/io.h>
-#include <mach/mcs814x.h>
-#include <mach/cpu.h>
-
-#define UART_SHIFT (2)
-
-/* cannot be static because the code will be inlined */
-void __iomem *uart_base;
-
-static inline void putc(int c)
-{
- while (!(__raw_readb(uart_base + (UART_LSR << UART_SHIFT)) & UART_LSR_TEMT));
- __raw_writeb(c, uart_base + (UART_TX << UART_SHIFT));
-}
-
-static inline void flush(void)
-{
-}
-
-static inline void arch_decomp_setup(void)
-{
- if (soc_is_mcs8140())
- uart_base = (void __iomem *)(MCS814X_PHYS_BASE +MCS814X_UART);
-}
-
-#define arch_decomp_wdog()
-
-#endif
+++ /dev/null
-/*
- * Moschip MCS814x generic interrupt controller routines
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under the GPLv2
- */
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/irqdomain.h>
-
-#include <asm/exception.h>
-#include <asm/mach/irq.h>
-#include <mach/mcs814x.h>
-
-static void __iomem *mcs814x_intc_base;
-static struct irq_domain *domain;
-
-static void __init mcs814x_alloc_gc(void __iomem *base, unsigned int irq_start,
- unsigned int num)
-{
- struct irq_chip_generic *gc;
- struct irq_chip_type *ct;
-
- if (irq_alloc_domain_generic_chips(domain, num, 1, "mcs814x-intc", handle_level_irq,
- IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, 0))
- panic("unable to allocate domain generic irq chip");
-
- gc = irq_get_domain_generic_chip(domain, irq_start);
- if (!gc)
- panic("unable to get generic irq chip");
-
- gc->reg_base = base;
- ct = gc->chip_types;
- ct->chip.irq_ack = irq_gc_unmask_enable_reg;
- ct->chip.irq_mask = irq_gc_mask_clr_bit;
- ct->chip.irq_unmask = irq_gc_mask_set_bit;
- ct->regs.mask = MCS814X_IRQ_MASK;
- ct->regs.enable = MCS814X_IRQ_ICR;
-
- /* Clear all interrupts */
- writel_relaxed(0xffffffff, base + MCS814X_IRQ_ICR);
-}
-
-asmlinkage void __exception_irq_entry mcs814x_handle_irq(struct pt_regs *regs)
-{
- u32 status, irq;
-
- do {
- /* read the status register */
- status = __raw_readl(mcs814x_intc_base + MCS814X_IRQ_STS0);
- if (!status)
- break;
-
- irq = ffs(status) - 1;
- status |= (1 << irq);
- /* clear the interrupt */
- __raw_writel(status, mcs814x_intc_base + MCS814X_IRQ_STS0);
- /* call the generic handler */
- handle_domain_irq(domain, irq, regs);
-
- } while (1);
-}
-
-static const struct of_device_id mcs814x_intc_ids[] = {
- { .compatible = "moschip,mcs814x-intc" },
- { /* sentinel */ },
-};
-
-void __init mcs814x_of_irq_init(void)
-{
- struct device_node *np;
-
- np = of_find_matching_node(NULL, mcs814x_intc_ids);
- if (!np)
- panic("unable to find compatible intc node in dtb\n");
-
- mcs814x_intc_base = of_iomap(np, 0);
- if (!mcs814x_intc_base)
- panic("unable to map intc cpu registers\n");
-
- domain = irq_domain_add_linear(np, 32, &irq_generic_chip_ops, NULL);
- if (!domain)
- panic("unable to add irq domain\n");
- irq_set_default_host(domain);
-
- of_node_put(np);
-
- mcs814x_alloc_gc(mcs814x_intc_base, 0, 32);
-}
-
+++ /dev/null
-/*
- * Moschip MCS814x timer routines
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under GPLv2
- */
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/time.h>
-#include <linux/timex.h>
-#include <linux/irq.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-
-#include <asm/mach/time.h>
-#include <mach/mcs814x.h>
-
-/* Timer block registers */
-#define TIMER_VAL 0x00
-#define TIMER_CTL 0x04
-#define TIMER_CTL_EN 0x01
-#define TIMER_CTL_DBG 0x02
-
-static u32 last_reload;
-static u32 timer_correct;
-static u32 clock_rate;
-static u32 timer_reload_value;
-static void __iomem *mcs814x_timer_base;
-
-static inline u32 ticks2usecs(u32 x)
-{
- return x / (clock_rate / 1000000);
-}
-
-/*
- * Returns number of ms since last clock interrupt. Note that interrupts
- * will have been disabled by do_gettimeoffset()
- */
-static u32 mcs814x_gettimeoffset(void)
-{
- u32 ticks = readl_relaxed(mcs814x_timer_base + TIMER_VAL);
-
- if (ticks < last_reload)
- return ticks2usecs(ticks + (u32)(0xffffffff - last_reload));
- else
- return ticks2usecs(ticks - last_reload);
-}
-
-
-static irqreturn_t mcs814x_timer_interrupt(int irq, void *dev_id)
-{
- u32 count = readl_relaxed(mcs814x_timer_base + TIMER_VAL);
-
- /* take into account delay up to this moment */
- last_reload = count + timer_correct + timer_reload_value;
-
- if (last_reload < timer_reload_value) {
- last_reload = timer_reload_value;
- } else {
- if (timer_correct == 0)
- timer_correct = readl_relaxed(mcs814x_timer_base + TIMER_VAL) - count;
- }
- writel_relaxed(last_reload, mcs814x_timer_base + TIMER_VAL);
-
- timer_tick();
-
- return IRQ_HANDLED;
-}
-
-static struct of_device_id mcs814x_timer_ids[] = {
- { .compatible = "moschip,mcs814x-timer" },
- { /* sentinel */ },
-};
-
-static int __init mcs814x_of_timer_init(void)
-{
- struct device_node *np;
- int irq;
-
- np = of_find_matching_node(NULL, mcs814x_timer_ids);
- if (!np)
- panic("unable to find compatible timer node in dtb");
-
- mcs814x_timer_base = of_iomap(np, 0);
- if (!mcs814x_timer_base)
- panic("unable to remap timer cpu registers");
-
- irq = irq_of_parse_and_map(np, 0);
- if (!irq)
- panic("no interrupts property/mapping failed for timer");
-
- return irq;
-}
-
-void __init mcs814x_timer_init(void)
-{
- struct clk *clk;
- int irq;
-
- arch_gettimeoffset = mcs814x_gettimeoffset;
-
- clk = clk_get_sys("timer0", NULL);
- if (IS_ERR_OR_NULL(clk))
- panic("unable to get timer0 clock");
-
- clock_rate = clk_get_rate(clk);
-
- irq = mcs814x_of_timer_init();
-
- pr_info("Timer frequency: %d (kHz)\n", clock_rate / 1000);
-
- timer_reload_value = 0xffffffff - (clock_rate / HZ);
-
- /* disable timer */
- writel_relaxed(~TIMER_CTL_EN, mcs814x_timer_base + TIMER_CTL);
- writel_relaxed(timer_reload_value, mcs814x_timer_base + TIMER_VAL);
- last_reload = timer_reload_value;
-
- if (request_irq(irq, mcs814x_timer_interrupt,
- IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
- "mcs814x-timer", NULL))
- panic("unable to request timer0 irq %d", irq);
-
- /* enable timer, stop timer in debug mode */
- writel_relaxed(TIMER_CTL_EN | TIMER_CTL_DBG,
- mcs814x_timer_base + TIMER_CTL);
-}
+++ /dev/null
-/*
- * RNG driver for Moschip MCS814x SoC
- *
- * Copyright 2012 (C), Florian Fainelli <florian@openwrt.org>
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2. This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/platform_device.h>
-#include <linux/hw_random.h>
-#include <linux/io.h>
-#include <linux/of.h>
-
-#define STAT 0x00
-#define RND 0x04
-
-struct mcs814x_rng_priv {
- void __iomem *regs;
-};
-
-static int mcs814x_rng_data_read(struct hwrng *rng, u32 *buffer)
-{
- struct mcs814x_rng_priv *priv = (struct mcs814x_rng_priv *)rng->priv;
-
- *buffer = readl_relaxed(priv->regs + RND);
-
- return 4;
-}
-
-static int mcs814x_rng_probe(struct platform_device *pdev)
-{
- struct resource *res;
- struct mcs814x_rng_priv *priv;
- struct hwrng *rng;
- int ret;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv) {
- ret = -ENOMEM;
- goto out;
- }
-
- rng = kzalloc(sizeof(*rng), GFP_KERNEL);
- if (!rng) {
- ret = -ENOMEM;
- goto out_priv;
- }
-
- platform_set_drvdata(pdev, rng);
- rng->priv = (unsigned long)priv;
- rng->name = pdev->name;
- rng->data_read = mcs814x_rng_data_read;
-
- priv->regs = devm_ioremap_resource(&pdev->dev, res);
- if (!priv->regs) {
- ret = -ENOMEM;
- goto out_rng;
- }
-
- ret = hwrng_register(rng);
- if (ret) {
- dev_err(&pdev->dev, "failed to register hwrng driver\n");
- goto out;
- }
-
- dev_info(&pdev->dev, "registered\n");
-
- return ret;
-
-out_rng:
- platform_set_drvdata(pdev, NULL);
- kfree(rng);
-out_priv:
- kfree(priv);
-out:
- return ret;
-}
-
-static int mcs814x_rng_remove(struct platform_device *pdev)
-{
- struct hwrng *rng = platform_get_drvdata(pdev);
- struct mcs814x_rng_priv *priv = (struct mcs814x_rng_priv *)rng->priv;
-
- hwrng_unregister(rng);
- kfree(priv);
- kfree(rng);
- platform_set_drvdata(pdev, NULL);
-
- return 0;
-}
-
-static const struct of_device_id mcs814x_rng_ids[] = {
- { .compatible = "moschip,mcs814x-rng", },
- { /* sentinel */ },
-};
-
-static struct platform_driver mcs814x_rng_driver = {
- .driver = {
- .name = "mcs814x-rng",
- .owner = THIS_MODULE,
- .of_match_table = mcs814x_rng_ids,
- },
- .probe = mcs814x_rng_probe,
- .remove = mcs814x_rng_remove,
-};
-
-module_platform_driver(mcs814x_rng_driver);
-
-MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
-MODULE_DESCRIPTION("H/W Random Number Generator (RNG) for Moschip MCS814x");
-MODULE_LICENSE("GPL");
+++ /dev/null
-/*
- * Moschip MCS814x GPIO support
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under the GPLv2
- */
-
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <linux/gpio.h>
-#include <linux/io.h>
-#include <linux/of.h>
-#include <linux/of_address.h>
-
-struct mcs814x_gpio_chip {
- void __iomem *regs;
- struct gpio_chip chip;
-};
-
-#define GPIO_PIN 0x00
-#define GPIO_DIR 0x04
-
-#define to_mcs814x_gpio_chip(x) container_of(x, struct mcs814x_gpio_chip, chip)
-
-static int mcs814x_gpio_get(struct gpio_chip *chip, unsigned offset)
-{
- struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
-
- return readl_relaxed(mcs814x->regs + GPIO_PIN) & (1 << offset);
-}
-
-static void mcs814x_gpio_set(struct gpio_chip *chip,
- unsigned offset, int value)
-{
- struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
- u32 mask;
-
- mask = readl_relaxed(mcs814x->regs + GPIO_PIN);
- if (value)
- mask |= (1 << offset);
- else
- mask &= ~(1 << offset);
- writel_relaxed(mask, mcs814x->regs + GPIO_PIN);
-}
-
-static int mcs814x_gpio_direction_output(struct gpio_chip *chip,
- unsigned offset, int value)
-{
- struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
- u32 mask;
-
- mask = readl_relaxed(mcs814x->regs + GPIO_DIR);
- mask &= ~(1 << offset);
- writel_relaxed(mask, mcs814x->regs + GPIO_DIR);
-
- return 0;
-}
-
-static int mcs814x_gpio_direction_input(struct gpio_chip *chip,
- unsigned offset)
-{
- struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
- u32 mask;
-
- mask = readl_relaxed(mcs814x->regs + GPIO_DIR);
- mask |= (1 << offset);
- writel_relaxed(mask, mcs814x->regs + GPIO_DIR);
-
- return 0;
-}
-
-static int mcs814x_gpio_probe(struct platform_device *pdev)
-{
- struct resource *res;
- struct mcs814x_gpio_chip *mcs814x_chip;
- int ret;
- const unsigned int *num_gpios;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
- num_gpios = of_get_property(pdev->dev.of_node, "num-gpios", NULL);
- if (!num_gpios)
- dev_err(&pdev->dev, "FIXME: no num-gpios property\n");
-
- mcs814x_chip = kzalloc(sizeof(*mcs814x_chip), GFP_KERNEL);
- if (!mcs814x_chip)
- return -ENOMEM;
-
- mcs814x_chip->regs = devm_ioremap_resource(&pdev->dev, res);
- if (!mcs814x_chip->regs) {
- ret = -ENOMEM;
- goto out;
- }
-
- platform_set_drvdata(pdev, mcs814x_chip);
-
-#ifdef CONFIG_OF_GPIO
- mcs814x_chip->chip.of_node = pdev->dev.of_node;
-#endif
-
- mcs814x_chip->chip.label = pdev->name;
- mcs814x_chip->chip.get = mcs814x_gpio_get;
- mcs814x_chip->chip.set = mcs814x_gpio_set;
- mcs814x_chip->chip.direction_input = mcs814x_gpio_direction_input;
- mcs814x_chip->chip.direction_output = mcs814x_gpio_direction_output;
- mcs814x_chip->chip.ngpio = be32_to_cpup(num_gpios);
- /* we want dynamic base allocation */
- mcs814x_chip->chip.base = -1;
-
- ret = gpiochip_add(&mcs814x_chip->chip);
- if (ret) {
- dev_err(&pdev->dev, "failed to register gpiochip\n");
- goto out;
- }
-
- return 0;
-
-out:
- platform_set_drvdata(pdev, NULL);
- kfree(mcs814x_chip);
- return ret;
-}
-
-static struct of_device_id mcs814x_gpio_ids[] = {
- { .compatible = "moschip,mcs814x-gpio" },
- { /* sentinel */ },
-};
-
-static struct platform_driver mcs814x_gpio_driver = {
- .driver = {
- .name = "mcs814x-gpio",
- .owner = THIS_MODULE,
- .of_match_table = mcs814x_gpio_ids,
- },
- .probe = mcs814x_gpio_probe,
-};
-
-int __init mcs814x_gpio_init(void)
-{
- return platform_driver_register(&mcs814x_gpio_driver);
-}
-postcore_initcall(mcs814x_gpio_init);
+++ /dev/null
-config NUPORT_ETHERNET_DRIVER
- tristate "MCS8140 Ethernet driver"
- depends on ETHERNET && ARCH_MCS814X
- help
+++ /dev/null
-obj-$(CONFIG_NUPORT_ETHERNET_DRIVER) += mcs8140.o
-
-mcs8140-objs := nuport_mac.o
+++ /dev/null
-/*
- * Moschip MCS8140 Ethernet MAC driver
- *
- * Copyright (C) 2003, Moschip Semiconductors
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * Licensed under GPLv2
- */
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/delay.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <linux/io.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/of.h>
-#include <linux/of_mdio.h>
-#include <linux/of_net.h>
-#include <linux/irq.h>
-#include <linux/err.h>
-#include <linux/phy.h>
-#include <linux/clk.h>
-#include <linux/dma-mapping.h>
-
-#include <asm/unaligned.h>
-#include <asm/sizes.h>
-
-/* Hardware registers */
-#define MAC_BASE_ADDR ((priv->mac_base))
-
-#define CTRL_REG (MAC_BASE_ADDR)
-#define MII_BUSY (1 << 0)
-#define MII_WRITE (1 << 1)
-#define RX_ENABLE (1 << 2)
-#define TX_ENABLE (1 << 3)
-#define DEFER_CHECK (1 << 5)
-#define STRIP_PAD (1 << 8)
-#define DRTRY_DISABLE (1 << 10)
-#define FULL_DUPLEX (1 << 20)
-#define HBD_DISABLE (1 << 28)
-#define MAC_ADDR_HIGH_REG (MAC_BASE_ADDR + 0x04)
-#define MAC_ADDR_LOW_REG (MAC_BASE_ADDR + 0x08)
-#define MII_ADDR_REG (MAC_BASE_ADDR + 0x14)
-#define MII_ADDR_SHIFT (11)
-#define MII_REG_SHIFT (6)
-#define MII_DATA_REG (MAC_BASE_ADDR + 0x18)
-/* Link interrupt registers */
-#define LINK_INT_CSR (MAC_BASE_ADDR + 0xD0)
-#define LINK_INT_EN (1 << 0)
-#define LINK_PHY_ADDR_SHIFT (1)
-#define LINK_PHY_REG_SHIFT (6)
-#define LINK_BIT_UP_SHIFT (11)
-#define LINK_UP (1 << 16)
-#define LINK_INT_POLL_TIME (MAC_BASE_ADDR + 0xD4)
-#define LINK_POLL_MASK ((1 << 20) - 1)
-
-#define DMA_CHAN_WIDTH 32
-#define DMA_RX_CHAN 0
-#define DMA_TX_CHAN 2
-
-/* Receive DMA registers */
-#define RX_DMA_BASE ((priv->dma_base) + \
- (DMA_CHAN_WIDTH * DMA_RX_CHAN))
-#define RX_BUFFER_ADDR (RX_DMA_BASE + 0x00)
-#define RX_MAX_BYTES (RX_DMA_BASE + 0x04)
-#define RX_ACT_BYTES (RX_DMA_BASE + 0x08)
-#define RX_START_DMA (RX_DMA_BASE + 0x0C)
-#define RX_DMA_ENABLE (1 << 0)
-#define RX_DMA_RESET (1 << 1)
-#define RX_DMA_STATUS_FIFO (1 << 12)
-#define RX_DMA_ENH (RX_DMA_BASE + 0x14)
-#define RX_DMA_INT_ENABLE (1 << 1)
-
-/* Transmit DMA registers */
-#define TX_DMA_BASE ((priv->dma_base) + \
- (DMA_CHAN_WIDTH * DMA_TX_CHAN))
-#define TX_BUFFER_ADDR (TX_DMA_BASE + 0x00)
-#define TX_PKT_BYTES (TX_DMA_BASE + 0x04)
-#define TX_BYTES_SENT (TX_DMA_BASE + 0x08)
-#define TX_START_DMA (TX_DMA_BASE + 0x0C)
-#define TX_DMA_ENABLE (1 << 0)
-#define TX_DMA_START_FRAME (1 << 2)
-#define TX_DMA_END_FRAME (1 << 3)
-#define TX_DMA_PAD_DISABLE (1 << 8)
-#define TX_DMA_CRC_DISABLE (1 << 9)
-#define TX_DMA_FIFO_FULL (1 << 16)
-#define TX_DMA_FIFO_EMPTY (1 << 17)
-#define TX_DMA_STATUS_AVAIL (1 << 18)
-#define TX_DMA_RESET (1 << 24)
-#define TX_DMA_STATUS (TX_DMA_BASE + 0x10)
-#define TX_DMA_ENH (TX_DMA_BASE + 0x14)
-#define TX_DMA_ENH_ENABLE (1 << 0)
-#define TX_DMA_INT_FIFO (1 << 1)
-
-#define RX_ALLOC_SIZE SZ_2K
-#define MAX_ETH_FRAME_SIZE 1536
-#define RX_SKB_TAILROOM 128
-#define RX_SKB_HEADROOM (RX_ALLOC_SIZE - \
- (MAX_ETH_FRAME_SIZE + RX_SKB_TAILROOM) + 0)
-
- /* WDT Late COL Lenght COL Type */
-#define ERROR_FILTER_MASK ((1<<14) | (1<<15) | (1<<16) | (1<<17) | (0<<18) | \
- /* MII Dribbling CRC Len/type Control */\
- (1<<19) | (1<<20) | (1<<21) | (0<<24) | (1<<25) | \
- /* Unsup Missed */\
- (1<<26) | (0<<31))
-#define TX_RING_SIZE 30
-#define RX_RING_SIZE 30
-
-static inline u32 nuport_mac_readl(void __iomem *reg)
-{
- return readl_relaxed(reg);
-}
-
-static inline u8 nuport_mac_readb(void __iomem *reg)
-{
- return readb_relaxed(reg);
-}
-
-static inline void nuport_mac_writel(u32 value, void __iomem *reg)
-{
- writel_relaxed(value, reg);
-}
-
-static inline void nuport_mac_writeb(u8 value, void __iomem *reg)
-{
- writel_relaxed(value, reg);
-}
-
-/* MAC private data */
-struct nuport_mac_priv {
- spinlock_t lock;
-
- void __iomem *mac_base;
- void __iomem *dma_base;
-
- int rx_irq;
- int tx_irq;
- int link_irq;
- struct clk *emac_clk;
- struct clk *ephy_clk;
-
- /* Transmit buffers */
- struct sk_buff *tx_skb[TX_RING_SIZE];
- dma_addr_t tx_addr;
- unsigned int valid_txskb[TX_RING_SIZE];
- unsigned int cur_tx;
- unsigned int dma_tx;
- unsigned int tx_full;
-
- /* Receive buffers */
- struct sk_buff *rx_skb[RX_RING_SIZE];
- dma_addr_t rx_addr;
- unsigned int irq_rxskb[RX_RING_SIZE];
- int pkt_len[RX_RING_SIZE];
- unsigned int cur_rx;
- unsigned int dma_rx;
- unsigned int rx_full;
-
- unsigned int first_pkt;
-
- /* Private data */
- struct napi_struct napi;
- struct net_device *dev;
- struct platform_device *pdev;
- struct mii_bus *mii_bus;
- struct phy_device *phydev;
- struct device_node *phy_node;
- phy_interface_t phy_interface;
- int old_link;
- int old_duplex;
- u32 msg_level;
- unsigned int buffer_shifting_len;
-};
-
-static inline int nuport_mac_mii_busy_wait(struct nuport_mac_priv *priv)
-{
- unsigned long curr;
- unsigned long finish = jiffies + 3 * HZ;
-
- do {
- curr = jiffies;
- if (!(nuport_mac_readl(MII_ADDR_REG) & MII_BUSY))
- return 0;
- cpu_relax();
- } while (!time_after_eq(curr, finish));
-
- return -EBUSY;
-}
-
-/* Read from PHY registers */
-static int nuport_mac_mii_read(struct mii_bus *bus,
- int mii_id, int regnum)
-{
- struct net_device *dev = bus->priv;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- int ret;
- u32 val = 0;
-
- ret = nuport_mac_mii_busy_wait(priv);
- if (ret)
- return ret;
-
- val |= (mii_id << MII_ADDR_SHIFT) | (regnum << MII_REG_SHIFT) | MII_BUSY;
- nuport_mac_writel(val, MII_ADDR_REG);
- ret = nuport_mac_mii_busy_wait(priv);
- if (ret)
- return ret;
-
- return nuport_mac_readl(MII_DATA_REG);
-}
-
-static int nuport_mac_mii_write(struct mii_bus *bus, int mii_id,
- int regnum, u16 value)
-{
- struct net_device *dev = bus->priv;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- int ret;
- u32 val = 0;
-
- ret = nuport_mac_mii_busy_wait(priv);
- if (ret)
- return ret;
-
- val |= (mii_id << MII_ADDR_SHIFT) | (regnum << MII_REG_SHIFT);
- val |= MII_BUSY | MII_WRITE;
- nuport_mac_writel(value, MII_DATA_REG);
- nuport_mac_writel(val, MII_ADDR_REG);
-
- return nuport_mac_mii_busy_wait(priv);
-}
-
-static int nuport_mac_mii_reset(struct mii_bus *bus)
-{
- return 0;
-}
-
-static int nuport_mac_start_tx_dma(struct nuport_mac_priv *priv,
- struct sk_buff *skb)
-{
- u32 reg;
- unsigned int timeout = 2048;
-
- while (timeout--) {
- reg = nuport_mac_readl(TX_START_DMA);
- if (!(reg & TX_DMA_ENABLE)) {
- netdev_dbg(priv->dev, "dma ready\n");
- break;
- }
- cpu_relax();
- }
-
- if (!timeout)
- return -EBUSY;
-
- priv->tx_addr = dma_map_single(&priv->pdev->dev, skb->data,
- skb->len, DMA_TO_DEVICE);
- if (dma_mapping_error(&priv->pdev->dev, priv->tx_addr))
- return -ENOMEM;
-
- /* enable enhanced mode */
- nuport_mac_writel(TX_DMA_ENH_ENABLE, TX_DMA_ENH);
- nuport_mac_writel(priv->tx_addr, TX_BUFFER_ADDR);
- nuport_mac_writel((skb->len) - 1, TX_PKT_BYTES);
- wmb();
- reg = TX_DMA_ENABLE | TX_DMA_START_FRAME | TX_DMA_END_FRAME;
- nuport_mac_writel(reg, TX_START_DMA);
-
- return 0;
-}
-
-static void nuport_mac_reset_tx_dma(struct nuport_mac_priv *priv)
-{
- u32 reg;
-
- reg = nuport_mac_readl(TX_START_DMA);
- reg |= TX_DMA_RESET;
- nuport_mac_writel(reg, TX_START_DMA);
-}
-
-static int nuport_mac_start_rx_dma(struct nuport_mac_priv *priv,
- struct sk_buff *skb)
-{
- u32 reg;
- unsigned int timeout = 2048;
-
- while (timeout--) {
- reg = nuport_mac_readl(RX_START_DMA);
- if (!(reg & RX_DMA_ENABLE)) {
- netdev_dbg(priv->dev, "dma ready\n");
- break;
- }
- cpu_relax();
- }
-
- if (!timeout)
- return -EBUSY;
-
- priv->rx_addr = dma_map_single(&priv->pdev->dev, skb->data,
- RX_ALLOC_SIZE, DMA_FROM_DEVICE);
- if (dma_mapping_error(&priv->pdev->dev, priv->rx_addr))
- return -ENOMEM;
-
- nuport_mac_writel(priv->rx_addr, RX_BUFFER_ADDR);
- wmb();
- nuport_mac_writel(RX_DMA_ENABLE, RX_START_DMA);
-
- return 0;
-}
-
-static void nuport_mac_reset_rx_dma(struct nuport_mac_priv *priv)
-{
- u32 reg;
-
- reg = nuport_mac_readl(RX_START_DMA);
- reg |= RX_DMA_RESET;
- nuport_mac_writel(reg, RX_START_DMA);
-}
-
-/* I suppose this might do something, but I am not sure actually */
-static void nuport_mac_disable_rx_dma(struct nuport_mac_priv *priv)
-{
- u32 reg;
-
- reg = nuport_mac_readl(RX_DMA_ENH);
- reg &= ~RX_DMA_INT_ENABLE;
- nuport_mac_writel(reg, RX_DMA_ENH);
-}
-
-static void nuport_mac_enable_rx_dma(struct nuport_mac_priv *priv)
-{
- u32 reg;
-
- reg = nuport_mac_readl(RX_DMA_ENH);
- reg |= RX_DMA_INT_ENABLE;
- nuport_mac_writel(reg, RX_DMA_ENH);
-}
-
-/* Add packets to the transmit queue */
-static int nuport_mac_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
- unsigned long flags;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- int ret;
-
- if (netif_queue_stopped(dev)) {
- netdev_warn(dev, "netif queue was stopped, restarting\n");
- netif_start_queue(dev);
- }
-
- spin_lock_irqsave(&priv->lock, flags);
- if (priv->first_pkt) {
- ret = nuport_mac_start_tx_dma(priv, skb);
- if (ret) {
- netif_stop_queue(dev);
- spin_unlock_irqrestore(&priv->lock, flags);
- netdev_err(dev, "transmit path busy\n");
- return NETDEV_TX_BUSY;
- }
- priv->first_pkt = 0;
- }
-
- priv->tx_skb[priv->cur_tx] = skb;
- dev->stats.tx_bytes += skb->len;
- dev->stats.tx_packets++;
- priv->valid_txskb[priv->cur_tx] = 1;
- priv->cur_tx++;
- dev->trans_start = jiffies;
-
- if (priv->cur_tx >= TX_RING_SIZE)
- priv->cur_tx = 0;
-
- spin_unlock_irqrestore(&priv->lock, flags);
-
- if (priv->valid_txskb[priv->cur_tx]) {
- priv->tx_full = 1;
- netdev_err(dev, "stopping queue\n");
- netif_stop_queue(dev);
- }
-
- return NETDEV_TX_OK;
-}
-
-static void nuport_mac_adjust_link(struct net_device *dev)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
- struct phy_device *phydev = priv->phydev;
- unsigned int status_changed = 0;
- u32 reg;
-
- BUG_ON(!phydev);
-
- if (priv->old_link != phydev->link) {
- status_changed = 1;
- priv->old_link = phydev->link;
- }
-
- if (phydev->link && (priv->old_duplex != phydev->duplex)) {
- reg = nuport_mac_readl(CTRL_REG);
- if (phydev->duplex == DUPLEX_FULL)
- reg |= DUPLEX_FULL;
- else
- reg &= ~DUPLEX_FULL;
- nuport_mac_writel(reg, CTRL_REG);
-
- status_changed = 1;
- priv->old_duplex = phydev->duplex;
- }
-
- if (!status_changed)
- return;
-
- pr_info("%s: link %s", dev->name, phydev->link ?
- "UP" : "DOWN");
- if (phydev->link) {
- pr_cont(" - %d/%s", phydev->speed,
- phydev->duplex == DUPLEX_FULL ? "full" : "half");
- }
- pr_cont("\n");
-}
-
-static irqreturn_t nuport_mac_link_interrupt(int irq, void *dev_id)
-{
- struct net_device *dev = dev_id;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- u32 reg;
- u8 phy_addr;
- unsigned long flags;
- irqreturn_t ret = IRQ_HANDLED;
-
- spin_lock_irqsave(&priv->lock, flags);
- reg = nuport_mac_readl(LINK_INT_CSR);
- phy_addr = (reg >> LINK_PHY_ADDR_SHIFT) & (PHY_MAX_ADDR - 1);
-
- if (phy_addr != priv->phydev->addr) {
- netdev_err(dev, "spurious PHY irq (phy: %d)\n", phy_addr);
- ret = IRQ_NONE;
- goto out;
- }
-
- priv->phydev->link = (reg & LINK_UP);
- nuport_mac_adjust_link(dev);
-
-out:
- spin_unlock_irqrestore(&priv->lock, flags);
- return ret;
-}
-
-static irqreturn_t nuport_mac_tx_interrupt(int irq, void *dev_id)
-{
- struct net_device *dev = (struct net_device *)dev_id;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- struct sk_buff *skb;
- unsigned long flags;
- int ret;
- u32 reg;
-
- spin_lock_irqsave(&priv->lock, flags);
- /* clear status word available if ready */
- reg = nuport_mac_readl(TX_START_DMA);
- if (reg & TX_DMA_STATUS_AVAIL) {
- nuport_mac_writel(reg, TX_START_DMA);
- reg = nuport_mac_readl(TX_DMA_STATUS);
-
- if (reg & 1)
- dev->stats.tx_errors++;
- } else
- netdev_dbg(dev, "no status word: %08x\n", reg);
-
- skb = priv->tx_skb[priv->dma_tx];
- priv->tx_skb[priv->dma_tx] = NULL;
- priv->valid_txskb[priv->dma_tx] = 0;
- dma_unmap_single(&priv->pdev->dev, priv->rx_addr, skb->len,
- DMA_TO_DEVICE);
- dev_kfree_skb_irq(skb);
-
- priv->dma_tx++;
- if (priv->dma_tx >= TX_RING_SIZE)
- priv->dma_tx = 0;
-
- if (!priv->valid_txskb[priv->dma_tx])
- priv->first_pkt = 1;
- else {
- ret = nuport_mac_start_tx_dma(priv, priv->tx_skb[priv->dma_tx]);
- if (ret)
- netdev_err(dev, "failed to restart TX dma\n");
- }
-
- if (priv->tx_full) {
- netdev_dbg(dev, "restarting transmit queue\n");
- netif_wake_queue(dev);
- priv->tx_full = 0;
- }
-
- spin_unlock_irqrestore(&priv->lock, flags);
-
- return IRQ_HANDLED;
-}
-
-static unsigned int nuport_mac_has_work(struct nuport_mac_priv *priv)
-{
- unsigned int i;
-
- for (i = 0; i < RX_RING_SIZE; i++)
- if (priv->rx_skb[i])
- return 1;
-
- return 0;
-}
-
-static irqreturn_t nuport_mac_rx_interrupt(int irq, void *dev_id)
-{
- struct net_device *dev = (struct net_device *)dev_id;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- unsigned long flags;
- int ret;
-
- spin_lock_irqsave(&priv->lock, flags);
- if (!priv->rx_full) {
- priv->pkt_len[priv->dma_rx] = nuport_mac_readl(RX_ACT_BYTES) - 4;
- priv->irq_rxskb[priv->dma_rx] = 0;
- priv->dma_rx++;
-
- if (priv->dma_rx >= RX_RING_SIZE)
- priv->dma_rx = 0;
- } else
- priv->rx_full = 0;
-
- if (priv->irq_rxskb[priv->dma_rx] == 1) {
- ret = nuport_mac_start_rx_dma(priv, priv->rx_skb[priv->dma_rx]);
- if (ret)
- netdev_err(dev, "failed to start rx dma\n");
- } else {
- priv->rx_full = 1;
- netdev_dbg(dev, "RX ring full\n");
- }
-
- if (likely(nuport_mac_has_work(priv))) {
- /* find a way to disable DMA rx irq */
- nuport_mac_disable_rx_dma(priv);
- napi_schedule(&priv->napi);
- }
- spin_unlock_irqrestore(&priv->lock, flags);
-
- return IRQ_HANDLED;
-}
-
-/* Process received packets in tasklet */
-static int nuport_mac_rx(struct net_device *dev, int limit)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
- struct sk_buff *skb;
- int len, status;
- int count = 0;
-
- while (count < limit && !priv->irq_rxskb[priv->cur_rx]) {
- skb = priv->rx_skb[priv->cur_rx];
- len = priv->pkt_len[priv->cur_rx];
-
- /* Remove 2 bytes added by RX buffer shifting */
- len = len - priv->buffer_shifting_len;
- skb->data = skb->data + priv->buffer_shifting_len;
-
- /* Get packet status */
- status = get_unaligned((u32 *) (skb->data + len));
-
- dma_unmap_single(&priv->pdev->dev, priv->rx_addr, skb->len,
- DMA_FROM_DEVICE);
-
- /* packet filter failed */
- if (!(status & (1 << 30))) {
- dev_kfree_skb_irq(skb);
- goto exit;
- }
-
- /* missed frame */
- if (status & (1 << 31)) {
- dev->stats.rx_missed_errors++;
- dev_kfree_skb_irq(skb);
- goto exit;
- }
-
- /* Not ethernet type */
- if ((!(status & (1 << 18))) || (status & ERROR_FILTER_MASK))
- dev->stats.rx_errors++;
-
- if (len > MAX_ETH_FRAME_SIZE) {
- dev_kfree_skb_irq(skb);
- goto exit;
- } else
- skb_put(skb, len);
-
- skb->protocol = eth_type_trans(skb, dev);
- dev->stats.rx_packets++;
-
- if (status & (1 << 29))
- skb->pkt_type = PACKET_OTHERHOST;
- if (status & (1 << 27))
- skb->pkt_type = PACKET_MULTICAST;
- if (status & (1 << 28))
- skb->pkt_type = PACKET_BROADCAST;
-
- skb->ip_summed = CHECKSUM_UNNECESSARY;
-
- /* Pass the received packet to network layer */
- status = netif_receive_skb(skb);
- if (status != NET_RX_DROP)
- dev->stats.rx_bytes += len - 4; /* Without CRC */
- else
- dev->stats.rx_dropped++;
-
- dev->last_rx = jiffies;
-
-exit:
- skb = netdev_alloc_skb(dev, RX_ALLOC_SIZE);
- if (!skb)
- goto out;
-
- skb_reserve(skb, RX_SKB_HEADROOM);
- priv->rx_skb[priv->cur_rx] = skb;
- priv->irq_rxskb[priv->cur_rx] = 1;
- priv->cur_rx++;
-
- if (priv->cur_rx >= RX_RING_SIZE)
- priv->cur_rx = 0;
- count++;
- }
-out:
- return count;
-}
-
-static int nuport_mac_poll(struct napi_struct *napi, int budget)
-{
- struct nuport_mac_priv *priv =
- container_of(napi, struct nuport_mac_priv, napi);
- struct net_device *dev = priv->dev;
- int work_done;
-
- work_done = nuport_mac_rx(dev, budget);
-
- if (work_done < budget) {
- napi_complete(napi);
- nuport_mac_enable_rx_dma(priv);
- }
-
- return work_done;
-}
-
-static void nuport_mac_init_tx_ring(struct nuport_mac_priv *priv)
-{
- int i;
-
- priv->cur_tx = priv->dma_tx = priv->tx_full = 0;
- for (i = 0; i < TX_RING_SIZE; i++) {
- priv->tx_skb[i] = NULL;
- priv->valid_txskb[i] = 0;
- }
- priv->first_pkt = 1;
-}
-
-static int nuport_mac_init_rx_ring(struct net_device *dev)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
- struct sk_buff *skb;
- int i;
-
- priv->cur_rx = priv->dma_rx = priv->rx_full = 0;
-
- for (i = 0; i < RX_RING_SIZE; i++) {
- skb = netdev_alloc_skb(dev, RX_ALLOC_SIZE);
- if (!skb)
- return -ENOMEM;
- skb_reserve(skb, RX_SKB_HEADROOM);
- priv->rx_skb[i] = skb;
- priv->irq_rxskb[i] = 1;
- }
-
- return 0;
-}
-
-static void nuport_mac_free_rx_ring(struct nuport_mac_priv *priv)
-{
- int i;
-
- for (i = 0; i < RX_RING_SIZE; i++) {
- if (!priv->rx_skb[i])
- continue;
-
- dev_kfree_skb(priv->rx_skb[i]);
- priv->rx_skb[i] = NULL;
- }
-
- if (priv->rx_addr)
- dma_unmap_single(&priv->pdev->dev, priv->rx_addr, RX_ALLOC_SIZE,
- DMA_TO_DEVICE);
-}
-
-static void nuport_mac_read_mac_address(struct net_device *dev)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
- int i;
-
- for (i = 0; i < 4; i++)
- dev->dev_addr[i] = nuport_mac_readb(MAC_ADDR_LOW_REG + i);
- dev->dev_addr[4] = nuport_mac_readb(MAC_ADDR_HIGH_REG);
- dev->dev_addr[5] = nuport_mac_readb(MAC_ADDR_HIGH_REG + 1);
-
- if (!is_valid_ether_addr(dev->dev_addr)) {
- dev_info(&priv->pdev->dev, "using random address\n");
- random_ether_addr(dev->dev_addr);
- }
-}
-
-static int nuport_mac_change_mac_address(struct net_device *dev, void *mac_addr)
-{
- struct sockaddr *addr = mac_addr;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- unsigned long *temp = (unsigned long *)dev->dev_addr;
- u32 high, low;
-
- if (netif_running(dev))
- return -EBUSY;
-
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-
- spin_lock_irq(&priv->lock);
-
- nuport_mac_writel(*temp, MAC_ADDR_LOW_REG);
- temp = (unsigned long *)(dev->dev_addr + 4);
- nuport_mac_writel(*temp, MAC_ADDR_HIGH_REG);
-
- low = nuport_mac_readl(MAC_ADDR_LOW_REG);
- high = nuport_mac_readl(MAC_ADDR_HIGH_REG);
-
- spin_unlock_irq(&priv->lock);
-
- return 0;
-}
-
-static int nuport_mac_open(struct net_device *dev)
-{
- int ret;
- struct nuport_mac_priv *priv = netdev_priv(dev);
- unsigned long flags;
- u32 reg = 0;
-
- ret = clk_enable(priv->emac_clk);
- if (ret) {
- netdev_err(dev, "failed to enable EMAC clock\n");
- return ret;
- }
-
- /* Set MAC into full duplex mode by default */
- reg |= RX_ENABLE | TX_ENABLE;
- reg |= DEFER_CHECK | STRIP_PAD | DRTRY_DISABLE;
- reg |= FULL_DUPLEX | HBD_DISABLE;
- nuport_mac_writel(reg, CTRL_REG);
-
- /* set mac address in hardware in case it was not already */
- nuport_mac_change_mac_address(dev, dev->dev_addr);
-
- ret = request_irq(priv->link_irq, &nuport_mac_link_interrupt,
- 0, dev->name, dev);
- if (ret) {
- netdev_err(dev, "unable to request link interrupt\n");
- goto out_emac_clk;
- }
-
- ret = request_irq(priv->tx_irq, &nuport_mac_tx_interrupt,
- 0, dev->name, dev);
- if (ret) {
- netdev_err(dev, "unable to request rx interrupt\n");
- goto out_link_irq;
- }
-
- /* Enable link interrupt monitoring for our PHY address */
- reg = LINK_INT_EN | (priv->phydev->addr << LINK_PHY_ADDR_SHIFT);
- /* MII_BMSR register to be watched */
- reg |= (1 << LINK_PHY_REG_SHIFT);
- /* BMSR_STATUS to be watched in particular */
- reg |= (2 << LINK_BIT_UP_SHIFT);
-
- spin_lock_irqsave(&priv->lock, flags);
- nuport_mac_writel(reg, LINK_INT_CSR);
- nuport_mac_writel(LINK_POLL_MASK, LINK_INT_POLL_TIME);
- spin_unlock_irqrestore(&priv->lock, flags);
-
- phy_start(priv->phydev);
-
- ret = request_irq(priv->rx_irq, &nuport_mac_rx_interrupt,
- 0, dev->name, dev);
- if (ret) {
- netdev_err(dev, "unable to request tx interrupt\n");
- goto out_tx_irq;
- }
-
- netif_start_queue(dev);
-
- nuport_mac_init_tx_ring(priv);
-
- ret = nuport_mac_init_rx_ring(dev);
- if (ret) {
- netdev_err(dev, "rx ring init failed\n");
- goto out_rx_skb;
- }
-
- nuport_mac_reset_tx_dma(priv);
- nuport_mac_reset_rx_dma(priv);
-
- /* Start RX DMA */
- spin_lock_irqsave(&priv->lock, flags);
- ret = nuport_mac_start_rx_dma(priv, priv->rx_skb[0]);
- spin_unlock_irqrestore(&priv->lock, flags);
-
- napi_enable(&priv->napi);
-
- return ret;
-
-out_rx_skb:
- nuport_mac_free_rx_ring(priv);
- free_irq(priv->rx_irq, dev);
-out_tx_irq:
- free_irq(priv->tx_irq, dev);
-out_link_irq:
- free_irq(priv->link_irq, dev);
-out_emac_clk:
- clk_disable(priv->emac_clk);
- return ret;
-}
-
-static int nuport_mac_close(struct net_device *dev)
-{
- u32 reg;
- struct nuport_mac_priv *priv = netdev_priv(dev);
-
- spin_lock_irq(&priv->lock);
- reg = nuport_mac_readl(CTRL_REG);
- reg &= ~(RX_ENABLE | TX_ENABLE);
- nuport_mac_writel(reg, CTRL_REG);
-
- napi_disable(&priv->napi);
- netif_stop_queue(dev);
-
- free_irq(priv->link_irq, dev);
- /* disable PHY polling */
- nuport_mac_writel(0, LINK_INT_CSR);
- nuport_mac_writel(0, LINK_INT_POLL_TIME);
- phy_stop(priv->phydev);
-
- free_irq(priv->tx_irq, dev);
- free_irq(priv->rx_irq, dev);
- spin_unlock_irq(&priv->lock);
-
- nuport_mac_free_rx_ring(priv);
-
- clk_disable(priv->emac_clk);
-
- return 0;
-}
-
-static void nuport_mac_tx_timeout(struct net_device *dev)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
- unsigned int i;
-
- netdev_warn(dev, "transmit timeout, attempting recovery\n");
-
- netdev_info(dev, "TX DMA regs\n");
- for (i = 0; i < DMA_CHAN_WIDTH; i += 4)
- netdev_info(dev, "[%02x]: 0x%08x\n", i, nuport_mac_readl(TX_DMA_BASE + i));
- netdev_info(dev, "RX DMA regs\n");
- for (i = 0; i < DMA_CHAN_WIDTH; i += 4)
- netdev_info(dev, "[%02x]: 0x%08x\n", i, nuport_mac_readl(RX_DMA_BASE + i));
-
- nuport_mac_init_tx_ring(priv);
- nuport_mac_reset_tx_dma(priv);
-
- netif_wake_queue(dev);
-}
-
-static int nuport_mac_mii_probe(struct net_device *dev)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
- struct phy_device *phydev = NULL;
- int ret;
-
- ret = clk_enable(priv->ephy_clk);
- if (ret) {
- netdev_err(dev, "unable to enable ePHY clk\n");
- return ret;
- }
-
- phydev = phy_find_first(priv->mii_bus);
- if (!phydev) {
- netdev_err(dev, "no PHYs found\n");
- ret = -ENODEV;
- goto out;
- }
-
- phydev = of_phy_connect(dev, priv->phy_node,
- nuport_mac_adjust_link, 0,
- priv->phy_interface);
- if (IS_ERR(phydev)) {
- netdev_err(dev, "could not attach PHY\n");
- ret = PTR_ERR(phydev);
- goto out;
- }
-
- phydev->supported &= PHY_BASIC_FEATURES;
- phydev->advertising = phydev->supported;
- priv->phydev = phydev;
- priv->old_link = 1;
- priv->old_duplex = DUPLEX_FULL;
-
- dev_info(&priv->pdev->dev, "attached PHY driver [%s] "
- "(mii_bus:phy_addr=%d)\n",
- phydev->drv->name, phydev->addr);
-
- return 0;
-
-out:
- /* disable the Ethernet PHY clock for the moment */
- clk_disable(priv->ephy_clk);
-
- return ret;
-}
-
-static void nuport_mac_ethtool_drvinfo(struct net_device *dev,
- struct ethtool_drvinfo *info)
-{
- strncpy(info->driver, "nuport-mac", sizeof(info->driver));
- strncpy(info->version, "0.1", sizeof(info->version));
- strncpy(info->fw_version, "N/A", sizeof(info->fw_version));
- strncpy(info->bus_info, "internal", sizeof(info->bus_info));
- info->n_stats = 0;
- info->testinfo_len = 0;
- info->regdump_len = 0;
- info->eedump_len = 0;
-}
-
-static int nuport_mac_ethtool_get_settings(struct net_device *dev,
- struct ethtool_cmd *cmd)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
-
- if (priv->phydev)
- return phy_ethtool_gset(priv->phydev, cmd);
-
- return -EINVAL;
-}
-
-static int nuport_mac_ethtool_set_settings(struct net_device *dev,
- struct ethtool_cmd *cmd)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
-
- if (priv->phydev)
- return phy_ethtool_sset(priv->phydev, cmd);
-
- return -EINVAL;
-}
-
-static void nuport_mac_set_msglevel(struct net_device *dev, u32 msg_level)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
-
- priv->msg_level = msg_level;
-}
-
-static u32 nuport_mac_get_msglevel(struct net_device *dev)
-{
- struct nuport_mac_priv *priv = netdev_priv(dev);
-
- return priv->msg_level;
-}
-
-static const struct ethtool_ops nuport_mac_ethtool_ops = {
- .get_drvinfo = nuport_mac_ethtool_drvinfo,
- .get_link = ethtool_op_get_link,
- .get_settings = nuport_mac_ethtool_get_settings,
- .set_settings = nuport_mac_ethtool_set_settings,
- .set_msglevel = nuport_mac_set_msglevel,
- .get_msglevel = nuport_mac_get_msglevel,
-};
-
-static const struct net_device_ops nuport_mac_ops = {
- .ndo_open = nuport_mac_open,
- .ndo_stop = nuport_mac_close,
- .ndo_start_xmit = nuport_mac_start_xmit,
- .ndo_change_mtu = eth_change_mtu,
- .ndo_validate_addr = eth_validate_addr,
- .ndo_set_mac_address = nuport_mac_change_mac_address,
- .ndo_tx_timeout = nuport_mac_tx_timeout,
-};
-
-static int __init nuport_mac_probe(struct platform_device *pdev)
-{
- struct net_device *dev;
- struct nuport_mac_priv *priv = NULL;
- struct resource *regs, *dma;
- int ret = 0;
- int rx_irq, tx_irq, link_irq;
- int i;
- const unsigned int *intspec;
-
- dev = alloc_etherdev(sizeof(struct nuport_mac_priv));
- if (!dev) {
- dev_err(&pdev->dev, "no memory for net_device\n");
- return -ENOMEM;
- }
-
- regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- dma = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!regs || !dma) {
- dev_err(&pdev->dev, "failed to get regs resources\n");
- ret = -ENODEV;
- goto out;
- }
-
- rx_irq = platform_get_irq(pdev, 0);
- tx_irq = platform_get_irq(pdev, 1);
- link_irq = platform_get_irq(pdev, 2);
- if (rx_irq < 0 || tx_irq < 0 || link_irq < 0) {
- ret = -ENODEV;
- goto out;
- }
-
- platform_set_drvdata(pdev, dev);
- SET_NETDEV_DEV(dev, &pdev->dev);
- priv = netdev_priv(dev);
- priv->pdev = pdev;
- priv->dev = dev;
- spin_lock_init(&priv->lock);
-
- intspec = of_get_property(pdev->dev.of_node,
- "nuport-mac,buffer-shifting", NULL);
- if (!intspec)
- priv->buffer_shifting_len = 0;
- else
- priv->buffer_shifting_len = 2;
-
- priv->mac_base = devm_ioremap_resource(&pdev->dev, regs);
- if (!priv->mac_base) {
- dev_err(&pdev->dev, "failed to remap regs\n");
- ret = -ENOMEM;
- goto out_platform;
- }
-
- priv->dma_base = devm_ioremap_resource(&pdev->dev, dma);
- if (!priv->dma_base) {
- dev_err(&pdev->dev, "failed to remap dma-regs\n");
- ret = -ENOMEM;
- goto out_platform;
- }
-
- priv->emac_clk = clk_get(&pdev->dev, "emac");
- if (IS_ERR_OR_NULL(priv->emac_clk)) {
- dev_err(&pdev->dev, "failed to get emac clk\n");
- ret = PTR_ERR(priv->emac_clk);
- goto out_platform;
- }
-
- priv->ephy_clk = clk_get(&pdev->dev, "ephy");
- if (IS_ERR_OR_NULL(priv->ephy_clk)) {
- dev_err(&pdev->dev, "failed to get ephy clk\n");
- ret = PTR_ERR(priv->ephy_clk);
- goto out_platform;
- }
-
- priv->link_irq = link_irq;
- priv->rx_irq = rx_irq;
- priv->tx_irq = tx_irq;
- priv->msg_level = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK;
- dev->netdev_ops = &nuport_mac_ops;
- dev->ethtool_ops = &nuport_mac_ethtool_ops;
- dev->watchdog_timeo = HZ;
- dev->flags = IFF_BROADCAST; /* Supports Broadcast */
- dev->tx_queue_len = TX_RING_SIZE / 2;
-
- netif_napi_add(dev, &priv->napi, nuport_mac_poll, 64);
-
- priv->phy_node = of_parse_phandle(pdev->dev.of_node, "phy", 0);
- if (!priv->phy_node) {
- dev_err(&pdev->dev, "no associated PHY\n");
- ret = -ENODEV;
- goto out;
- }
-
- priv->phy_interface = of_get_phy_mode(pdev->dev.of_node);
- if (priv->phy_interface < 0) {
- dev_err(&pdev->dev, "invalid PHY mode\n");
- ret = -EINVAL;
- goto out;
- }
-
- priv->mii_bus = mdiobus_alloc();
- if (!priv->mii_bus) {
- dev_err(&pdev->dev, "mii bus allocation failed\n");
- goto out;
- }
-
- priv->mii_bus->priv = dev;
- priv->mii_bus->read = nuport_mac_mii_read;
- priv->mii_bus->write = nuport_mac_mii_write;
- priv->mii_bus->reset = nuport_mac_mii_reset;
- priv->mii_bus->name = "nuport-mac-mii";
- priv->mii_bus->phy_mask = (1 << 0);
- snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);
- priv->mii_bus->irq = kzalloc(PHY_MAX_ADDR * sizeof(int), GFP_KERNEL);
- if (!priv->mii_bus->irq) {
- dev_err(&pdev->dev, "failed to allocate mii_bus irqs\n");
- ret = -ENOMEM;
- goto out_mdio;
- }
-
- /* We support PHY interrupts routed back to the MAC */
- for (i = 0; i < PHY_MAX_ADDR; i++)
- priv->mii_bus->irq[i] = PHY_IGNORE_INTERRUPT;
-
- ret = of_mdiobus_register(priv->mii_bus, pdev->dev.of_node);
- if (ret) {
- dev_err(&pdev->dev, "failed to register mii_bus\n");
- goto out_mdio_irq;
- }
-
- ret = nuport_mac_mii_probe(dev);
- if (ret) {
- dev_err(&pdev->dev, "failed to probe MII bus\n");
- goto out_mdio_unregister;
- }
-
- ret = register_netdev(dev);
- if (ret) {
- dev_err(&pdev->dev, "failed to register net_device\n");
- goto out_mdio_probe;
- }
-
- /* read existing mac address */
- nuport_mac_read_mac_address(dev);
-
- dev_info(&pdev->dev, "registered (MAC: %pM)\n", dev->dev_addr);
-
- return ret;
-
-out_mdio_probe:
- phy_disconnect(priv->phydev);
-out_mdio_unregister:
- mdiobus_unregister(priv->mii_bus);
-out_mdio_irq:
- kfree(priv->mii_bus->irq);
-out_mdio:
- mdiobus_free(priv->mii_bus);
-out_platform:
- platform_set_drvdata(pdev, NULL);
-out:
- clk_put(priv->ephy_clk);
- clk_put(priv->emac_clk);
- free_netdev(dev);
- platform_set_drvdata(pdev, NULL);
- return ret;
-}
-
-static int nuport_mac_remove(struct platform_device *pdev)
-{
- struct net_device *dev = platform_get_drvdata(pdev);
- struct nuport_mac_priv *priv = netdev_priv(dev);
-
- unregister_netdev(dev);
- phy_disconnect(priv->phydev);
- mdiobus_unregister(priv->mii_bus);
- kfree(priv->mii_bus->irq);
- mdiobus_free(priv->mii_bus);
- clk_put(priv->ephy_clk);
- clk_put(priv->emac_clk);
- free_netdev(dev);
-
- platform_set_drvdata(pdev, NULL);
-
- return 0;
-}
-
-static struct of_device_id nuport_eth_ids[] __initdata = {
- {.compatible = "moschip,nuport-mac",},
- { /* sentinel */ },
-};
-
-static struct platform_driver nuport_eth_driver = {
- .driver = {
- .name = "nuport-mac",
- .owner = THIS_MODULE,
- .of_match_table = nuport_eth_ids,
- },
- .probe = nuport_mac_probe,
- .remove = nuport_mac_remove,
-};
-
-module_platform_driver(nuport_eth_driver);
-
-MODULE_AUTHOR("Moschip Semiconductors Ltd.");
-MODULE_DESCRIPTION("Moschip MCS8140 Ethernet MAC driver");
-MODULE_LICENSE("GPL");
+++ /dev/null
-/*
- * Driver for Moschip MCS814x internal PHY
- *
- * Copyright (c) 2012 Florian Fainelli <florian@openwrt.org>
- *
- * 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.
- *
- */
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/unistd.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/mii.h>
-#include <linux/ethtool.h>
-#include <linux/phy.h>
-
-MODULE_DESCRIPTION("Moschip MCS814x PHY driver");
-MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
-MODULE_LICENSE("GPL");
-
-/* Nothing special about this PHY but its OUI (O) */
-static struct phy_driver mcs8140_driver = {
- .phy_id = 0,
- .name = "Moschip MCS8140",
- .phy_id_mask = 0x02,
- .features = PHY_BASIC_FEATURES,
- .config_aneg = &genphy_config_aneg,
- .read_status = &genphy_read_status,
- .suspend = genphy_suspend,
- .resume = genphy_resume,
- .driver = { .owner = THIS_MODULE,},
-};
-
-static int __init mcs814x_phy_init(void)
-{
- return phy_driver_register(&mcs8140_driver);
-}
-
-static void __exit mcs814x_phy_exit(void)
-{
- phy_driver_unregister(&mcs8140_driver);
-}
-
-module_init(mcs814x_phy_init);
-module_exit(mcs814x_phy_exit);
-
-static struct mdio_device_id __maybe_unused mcs814x_phy_tbl[] = {
- { 0x0, 0x0ffffff0 },
- { }
-};
-
-MODULE_DEVICE_TABLE(mdio, mcs814x_phy_tbl);
+++ /dev/null
-/*
- * MCS814X EHCI Host Controller Driver
- *
- * Based on "ehci-fsl.c" by Randy Vinson <rvinson@mvista.com>
- *
- * 2007 (c) MontaVista Software, Inc. This file is licensed under
- * the terms of the GNU General Public License version 2. This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-
-#include <linux/platform_device.h>
-#include <linux/of.h>
-
-#define MCS814X_EHCI_CAPS_OFFSET 0x68
-
-static int mcs814x_ehci_init(struct usb_hcd *hcd)
-{
- struct ehci_hcd *ehci = hcd_to_ehci(hcd);
- int retval = 0;
-
- ehci->caps = hcd->regs + MCS814X_EHCI_CAPS_OFFSET;
- ehci->regs = hcd->regs
- + HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
- ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
- ehci_reset(ehci);
-
- retval = ehci_init(hcd);
- if (retval) {
- pr_err("ehci_init failed\n");
- return retval;
- }
-
- return retval;
-}
-
-static const struct hc_driver mcs814x_ehci_hc_driver = {
- .description = hcd_name,
- .product_desc = "MCS814X EHCI Host Controller",
- .hcd_priv_size = sizeof(struct ehci_hcd),
- .irq = ehci_irq,
- .flags = HCD_MEMORY | HCD_USB2,
- .reset = mcs814x_ehci_init,
- .start = ehci_run,
- .stop = ehci_stop,
- .shutdown = ehci_shutdown,
- .urb_enqueue = ehci_urb_enqueue,
- .urb_dequeue = ehci_urb_dequeue,
- .endpoint_disable = ehci_endpoint_disable,
- .get_frame_number = ehci_get_frame,
- .hub_status_data = ehci_hub_status_data,
- .hub_control = ehci_hub_control,
-#if defined(CONFIG_PM)
- .bus_suspend = ehci_bus_suspend,
- .bus_resume = ehci_bus_resume,
-#endif
- .relinquish_port = ehci_relinquish_port,
- .port_handed_over = ehci_port_handed_over,
-
- .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
-};
-
-static int mcs814x_ehci_probe(struct platform_device *pdev)
-{
- struct usb_hcd *hcd;
- const struct hc_driver *driver = &mcs814x_ehci_hc_driver;
- struct resource *res;
- int irq;
- int retval;
-
- if (usb_disabled())
- return -ENODEV;
-
- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
- if (!res) {
- dev_err(&pdev->dev,
- "Found HC with no IRQ. Check %s setup!\n",
- dev_name(&pdev->dev));
- return -ENODEV;
- }
- irq = res->start;
-
- pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
- pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-
- hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
- if (!hcd) {
- retval = -ENOMEM;
- goto fail_create_hcd;
- }
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- dev_err(&pdev->dev,
- "Found HC with no register addr. Check %s setup!\n",
- dev_name(&pdev->dev));
- retval = -ENODEV;
- goto fail_request_resource;
- }
- hcd->rsrc_start = res->start;
- hcd->rsrc_len = resource_size(res);
-
- if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
- driver->description)) {
- dev_dbg(&pdev->dev, "controller already in use\n");
- retval = -EBUSY;
- goto fail_request_resource;
- }
-
- hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
- if (hcd->regs == NULL) {
- dev_dbg(&pdev->dev, "error mapping memory\n");
- retval = -EFAULT;
- goto fail_ioremap;
- }
-
- retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
- if (retval)
- goto fail_add_hcd;
-
- dev_info(&pdev->dev, "added MCS814X EHCI driver\n");
-
- return retval;
-
-fail_add_hcd:
- iounmap(hcd->regs);
-fail_ioremap:
- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
-fail_request_resource:
- usb_put_hcd(hcd);
-fail_create_hcd:
- dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval);
- return retval;
-}
-
-static int mcs814x_ehci_remove(struct platform_device *pdev)
-{
- struct usb_hcd *hcd = platform_get_drvdata(pdev);
-
- usb_remove_hcd(hcd);
- iounmap(hcd->regs);
- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
- usb_put_hcd(hcd);
-
- return 0;
-}
-
-MODULE_ALIAS("platform:mcs814x-ehci");
-
-static const struct of_device_id mcs814x_ehci_id[] = {
- { .compatible = "moschip,mcs814x-ehci" },
- { .compatible = "usb-ehci" },
- { /* sentinel */ },
-};
-
-static struct platform_driver mcs814x_ehci_driver = {
- .probe = mcs814x_ehci_probe,
- .remove = mcs814x_ehci_remove,
- .driver = {
- .name = "mcs814x-ehci",
- .of_match_table = mcs814x_ehci_id,
- },
-};
+++ /dev/null
-/*
- * OHCI HCD (Host Controller Driver) for USB.
- *
- * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
- * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
- * (C) Copyright 2002 Hewlett-Packard Company
- *
- * Bus Glue for Moschip MCS814x.
- *
- * Written by Christopher Hoover <ch@hpl.hp.com>
- * Based on fragments of previous driver by Russell King et al.
- *
- * Modified for LH7A404 from ohci-sa1111.c
- * by Durgesh Pattamatta <pattamattad@sharpsec.com>
- *
- * Modified for pxa27x from ohci-lh7a404.c
- * by Nick Bane <nick@cecomputing.co.uk> 26-8-2004
- *
- * Modified for mcs814x from ohci-mcs814x.c
- * by Lennert Buytenhek <buytenh@wantstofly.org> 28-2-2006
- * Based on an earlier driver by Ray Lehtiniemi
- *
- * This file is licenced under the GPL.
- */
-
-#include <linux/device.h>
-#include <linux/signal.h>
-#include <linux/platform_device.h>
-#include <linux/of.h>
-
-static int usb_hcd_mcs814x_probe(const struct hc_driver *driver,
- struct platform_device *pdev)
-{
- int retval;
- struct usb_hcd *hcd;
-
- if (pdev->resource[1].flags != IORESOURCE_IRQ) {
- pr_debug("resource[1] is not IORESOURCE_IRQ");
- return -ENOMEM;
- }
-
- pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
- pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-
- hcd = usb_create_hcd(driver, &pdev->dev, "mcs814x");
- if (hcd == NULL)
- return -ENOMEM;
-
- hcd->rsrc_start = pdev->resource[0].start;
- hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;
- if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
- usb_put_hcd(hcd);
- retval = -EBUSY;
- goto err1;
- }
-
- hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
- if (hcd->regs == NULL) {
- pr_debug("ioremap failed");
- retval = -ENOMEM;
- goto err2;
- }
-
- ohci_hcd_init(hcd_to_ohci(hcd));
-
- retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED);
- if (retval == 0)
- return retval;
-
- iounmap(hcd->regs);
-err2:
- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
-err1:
- usb_put_hcd(hcd);
-
- return retval;
-}
-
-static void usb_hcd_mcs814x_remove(struct usb_hcd *hcd,
- struct platform_device *pdev)
-{
- usb_remove_hcd(hcd);
- iounmap(hcd->regs);
- release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
- usb_put_hcd(hcd);
-}
-
-static int ohci_mcs814x_start(struct usb_hcd *hcd)
-{
- struct ohci_hcd *ohci = hcd_to_ohci(hcd);
- int ret;
-
- ret = ohci_init(ohci);
- if (ret < 0)
- return ret;
-
- ret = ohci_run(ohci);
- if (ret < 0) {
- ohci_err(ohci, "can't start %s", hcd->self.bus_name);
- ohci_stop(hcd);
- return ret;
- }
-
- return 0;
-}
-
-static struct hc_driver ohci_mcs814x_hc_driver = {
- .description = hcd_name,
- .product_desc = "MCS814X OHCI",
- .hcd_priv_size = sizeof(struct ohci_hcd),
- .irq = ohci_irq,
- .flags = HCD_USB11 | HCD_MEMORY,
- .start = ohci_mcs814x_start,
- .stop = ohci_stop,
- .shutdown = ohci_shutdown,
- .urb_enqueue = ohci_urb_enqueue,
- .urb_dequeue = ohci_urb_dequeue,
- .endpoint_disable = ohci_endpoint_disable,
- .get_frame_number = ohci_get_frame,
- .hub_status_data = ohci_hub_status_data,
- .hub_control = ohci_hub_control,
-#ifdef CONFIG_PM
- .bus_suspend = ohci_bus_suspend,
- .bus_resume = ohci_bus_resume,
-#endif
- .start_port_reset = ohci_start_port_reset,
-};
-
-extern int usb_disabled(void);
-
-static int ohci_hcd_mcs814x_drv_probe(struct platform_device *pdev)
-{
- int ret;
-
- ret = -ENODEV;
- if (!usb_disabled())
- ret = usb_hcd_mcs814x_probe(&ohci_mcs814x_hc_driver, pdev);
-
- return ret;
-}
-
-static int ohci_hcd_mcs814x_drv_remove(struct platform_device *pdev)
-{
- struct usb_hcd *hcd = platform_get_drvdata(pdev);
-
- usb_hcd_mcs814x_remove(hcd, pdev);
-
- return 0;
-}
-
-#ifdef CONFIG_PM
-static int ohci_hcd_mcs814x_drv_suspend(struct platform_device *pdev, pm_message_t state)
-{
- struct usb_hcd *hcd = platform_get_drvdata(pdev);
- struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-
- if (time_before(jiffies, ohci->next_statechange))
- msleep(5);
- ohci->next_statechange = jiffies;
-
- hcd->state = HC_STATE_SUSPENDED;
-
- return 0;
-}
-
-static int ohci_hcd_mcs814x_drv_resume(struct platform_device *pdev)
-{
- struct usb_hcd *hcd = platform_get_drvdata(pdev);
- struct ohci_hcd *ohci = hcd_to_ohci(hcd);
- int status;
-
- if (time_before(jiffies, ohci->next_statechange))
- msleep(5);
- ohci->next_statechange = jiffies;
-
- ohci_finish_controller_resume(hcd);
- return 0;
-}
-#endif
-
-static const struct of_device_id mcs814x_ohci_id[] = {
- { .compatible = "moschip,mcs814x-ohci" },
- { .compatible = "ohci-le" },
- { /* sentinel */ },
-};
-
-static struct platform_driver ohci_hcd_mcs814x_driver = {
- .probe = ohci_hcd_mcs814x_drv_probe,
- .remove = ohci_hcd_mcs814x_drv_remove,
- .shutdown = usb_hcd_platform_shutdown,
-#ifdef CONFIG_PM
- .suspend = ohci_hcd_mcs814x_drv_suspend,
- .resume = ohci_hcd_mcs814x_drv_resume,
-#endif
- .driver = {
- .name = "mcs814x-ohci",
- .owner = THIS_MODULE,
- .of_match_table = mcs814x_ohci_id,
- },
-};
-
-MODULE_ALIAS("platform:mcs814x-ohci");
+++ /dev/null
-/*
- * Moschip MCS814x Watchdog driver
- *
- * Copyright (C) 2012, Florian Fainelli <florian@openwrt.org>
- *
- * 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
- */
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/miscdevice.h>
-#include <linux/watchdog.h>
-#include <linux/io.h>
-#include <linux/err.h>
-#include <linux/clk.h>
-#include <linux/of.h>
-
-#define WDT_COUNT 0x00
-#define WDT_CTRL 0x04
-#define WDT_CTRL_EN 0x1
-
-/* watchdog frequency */
-#define WDT_MAX_VALUE (0xffffffff)
-
-struct mcs814x_wdt {
- void __iomem *regs;
- spinlock_t lock;
- struct watchdog_device wdt_dev;
- struct clk *clk;
-};
-
-static int mcs814x_wdt_start(struct watchdog_device *dev)
-{
- struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev);
- u32 reg;
-
- spin_lock(&wdt->lock);
- reg = readl_relaxed(wdt->regs + WDT_CTRL);
- reg |= WDT_CTRL_EN;
- writel_relaxed(reg, wdt->regs + WDT_CTRL);
- spin_unlock(&wdt->lock);
-
- return 0;
-}
-
-static int mcs814x_wdt_stop(struct watchdog_device *dev)
-{
- struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev);
- u32 reg;
-
- spin_lock(&wdt->lock);
- reg = readl_relaxed(wdt->regs + WDT_CTRL);
- reg &= ~WDT_CTRL_EN;
- writel_relaxed(reg, wdt->regs + WDT_CTRL);
- spin_unlock(&wdt->lock);
-
- return 0;
-}
-
-static int mcs814x_wdt_set_timeout(struct watchdog_device *dev,
- unsigned int new_timeout)
-{
- struct mcs814x_wdt *wdt = watchdog_get_drvdata(dev);
-
- spin_lock(&wdt->lock);
- /* watchdog counts upward and rollover (0xfffffff -> 0)
- * triggers the reboot
- */
- writel_relaxed(WDT_MAX_VALUE - (new_timeout * clk_get_rate(wdt->clk)),
- wdt->regs + WDT_COUNT);
- spin_unlock(&wdt->lock);
-
- return 0;
-}
-
-static int mcs814x_wdt_ping(struct watchdog_device *dev)
-{
- /* restart the watchdog */
- mcs814x_wdt_stop(dev);
- mcs814x_wdt_set_timeout(dev, dev->timeout);
- mcs814x_wdt_start(dev);
-
- return 0;
-}
-
-static const struct watchdog_info mcs814x_wdt_ident = {
- .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT |
- WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
- .identity = "MCS814x Watchdog",
-};
-
-static struct watchdog_ops mcs814x_wdt_ops = {
- .owner = THIS_MODULE,
- .start = mcs814x_wdt_start,
- .stop = mcs814x_wdt_stop,
- .set_timeout = mcs814x_wdt_set_timeout,
- .ping = mcs814x_wdt_ping,
-};
-
-static int mcs814x_wdt_probe(struct platform_device *pdev)
-{
- struct resource *res;
- struct mcs814x_wdt *wdt;
- int ret;
- struct clk *clk;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
-
- clk = clk_get(NULL, "wdt");
- if (IS_ERR_OR_NULL(clk)) {
- dev_err(&pdev->dev, "failed to get watchdog clock\n");
- return PTR_ERR(clk);
- }
-
- wdt = kzalloc(sizeof(*wdt), GFP_KERNEL);
- if (!wdt) {
- ret = -ENOMEM;
- goto out_clk;
- }
-
- spin_lock_init(&wdt->lock);
- wdt->clk = clk;
- wdt->wdt_dev.info = &mcs814x_wdt_ident;
- wdt->wdt_dev.ops = &mcs814x_wdt_ops;
- wdt->wdt_dev.min_timeout = 1;
- /* approximately 10995 secs */
- wdt->wdt_dev.max_timeout = (WDT_MAX_VALUE / clk_get_rate(clk));
-
- platform_set_drvdata(pdev, wdt);
-
- /* only ioremap registers, because the register is shared */
- wdt->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
- if (!wdt->regs) {
- ret = -ENOMEM;
- goto out;
- }
-
- watchdog_set_drvdata(&wdt->wdt_dev, wdt);
-
- ret = watchdog_register_device(&wdt->wdt_dev);
- if (ret) {
- dev_err(&pdev->dev, "cannot register watchdog: %d\n", ret);
- goto out;
- }
-
- dev_info(&pdev->dev, "registered\n");
- return 0;
-
-out:
- platform_set_drvdata(pdev, NULL);
- kfree(wdt);
-out_clk:
- clk_put(clk);
- return ret;
-}
-
-static int mcs814x_wdt_remove(struct platform_device *pdev)
-{
- struct mcs814x_wdt *wdt = platform_get_drvdata(pdev);
-
- clk_put(wdt->clk);
- watchdog_unregister_device(&wdt->wdt_dev);
- watchdog_set_drvdata(&wdt->wdt_dev, NULL);
- kfree(wdt);
- platform_set_drvdata(pdev, NULL);
-
- return 0;
-}
-
-static const struct of_device_id mcs814x_wdt_ids[] = {
- { .compatible = "moschip,mcs814x-wdt", },
- { /* sentinel */ },
-};
-
-static struct platform_driver mcs814x_wdt_driver = {
- .driver = {
- .name = "mcs814x-wdt",
- .owner = THIS_MODULE,
- .of_match_table = mcs814x_wdt_ids,
- },
- .probe = mcs814x_wdt_probe,
- .remove = mcs814x_wdt_remove,
-};
-
-module_platform_driver(mcs814x_wdt_driver);
-
-MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
-MODULE_DESCRIPTION("Moschip MCS814x Watchdog driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-MODULE_ALIAS("platform:mcs814x-wdt");
+++ /dev/null
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-JFFS2_BLOCKSIZE = 128k
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-TARGET_DTBS := rbt-832 dlan-usb-extender
-
-DTBS_DIR:=dts/
-
-LOADADDR:=0x00008000
-
-UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
-
-define Image/Build/MkuImage
- mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \
- -n 'ARM $(VERSION_DIST) Linux-$(LINUX_VERSION)' -d $(1) $(2);
-endef
-
-define Image/Build/DTB
- cp $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1);
- cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(DTBS_DIR)$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
- $(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1))
- cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
-endef
-
-define Image/Build/Profile/dLAN_USB_Extender
- dd if=$(KDIR)/uImage-dlan-usb-extender bs=64k conv=sync of=$(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin
- cat $(KDIR)/root.$(1) >> $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin
- cp $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin $(BIN_DIR)/
-endef
-
-define Image/BuildKernel
- $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
-endef
-
-define Image/Build/Initramfs
- $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
-endef
-
-define Image/Build/squashfs
- $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs 128
-endef
-
-define Image/Build
- $(call Image/Build/$(1))
- dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
- $(call Image/Build/Profile/$(PROFILE),$(1))
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
- $(call Image/Build/Initramfs)
-endif
-endef
-
-$(eval $(call BuildImage))
+++ /dev/null
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-
-define KernelPackage/mcs814x-wdt
- SUBMENU:=$(OTHER_MENU)
- DEPENDS:=@TARGET_mcs814x
- TITLE:=MCS814x watchdog driver
- KCONFIG:=CONFIG_MCS814X_WATCHDOG
- FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/mcs814x_wdt.ko
- AUTOLOAD:=$(call AutoLoad,50,mcs814x_wdt)
-endef
-
-define KernelPackage/mcs814x-wdt/description
- Kernel module for the Moschip MCS814x watchdog timer.
-endef
-
-$(eval $(call KernelPackage,mcs814x-wdt))
+++ /dev/null
---- a/arch/arm/Kconfig
-+++ b/arch/arm/Kconfig
-@@ -267,7 +267,8 @@ config PHYS_OFFSET
- ARCH_INTEGRATOR || \
- ARCH_IOP13XX || \
- ARCH_KS8695 || \
-- (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET)
-+ (ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET) || \
-+ ARCH_MCS814X
- default 0x10000000 if ARCH_OMAP1 || ARCH_RPC
- default 0x20000000 if ARCH_S5PV210
- default 0x70000000 if REALVIEW_HIGH_PHYS_OFFSET
-@@ -786,6 +787,21 @@ config ARCH_OMAP1
- help
- Support for older TI OMAP1 (omap7xx, omap15xx or omap16xx)
-
-+config ARCH_MCS814X
-+ bool "Moschip MCS814x"
-+ select FIQ
-+ select GENERIC_IRQ_CHIP
-+ select GENERIC_GPIO
-+ select ARCH_REQUIRE_GPIOLIB
-+ select CLKDEV_LOOKUP
-+ select ARCH_USES_GETTIMEOFFSET
-+ select USB_ARCH_HAS_OHCI
-+ select USB_ARCH_HAS_EHCI
-+ select MULTI_IRQ_HANDLER
-+ help
-+ Support for Moschip MCS814x SoCs (MCS8140).
-+
-+
- endchoice
-
- menu "Multiple platform selection"
-@@ -927,6 +943,8 @@ source "arch/arm/mach-picoxcell/Kconfig"
- source "arch/arm/mach-pxa/Kconfig"
- source "arch/arm/plat-pxa/Kconfig"
-
-+source "arch/arm/mach-mcs814x/Kconfig"
-+
- source "arch/arm/mach-mmp/Kconfig"
-
- source "arch/arm/mach-qcom/Kconfig"
---- a/arch/arm/Makefile
-+++ b/arch/arm/Makefile
-@@ -180,6 +180,7 @@ machine-$(CONFIG_ARCH_IXP4XX) += ixp4xx
- machine-$(CONFIG_ARCH_KEYSTONE) += keystone
- machine-$(CONFIG_ARCH_KS8695) += ks8695
- machine-$(CONFIG_ARCH_LPC32XX) += lpc32xx
-+machine-$(CONFIG_ARCH_MCS814X) += mcs814x
- machine-$(CONFIG_ARCH_MESON) += meson
- machine-$(CONFIG_ARCH_MMP) += mmp
- machine-$(CONFIG_ARCH_MOXART) += moxart
---- a/arch/arm/boot/dts/Makefile
-+++ b/arch/arm/boot/dts/Makefile
-@@ -163,6 +163,8 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += kirkwood-
- kirkwood-ts419-6282.dtb
- dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
- dtb-$(CONFIG_ARCH_MARCO) += marco-evb.dtb
-+dtb-$(CONFIG_ARCH_MCS814X) += dlan-usb-extender.dtb \
-+ rbt-832.dtb
- dtb-$(CONFIG_MACH_MESON6) += meson6-atv1200.dtb
- dtb-$(CONFIG_ARCH_MOXART) += moxart-uc7112lx.dtb
- dtb-$(CONFIG_ARCH_MXC) += \
+++ /dev/null
---- a/drivers/net/ethernet/Kconfig
-+++ b/drivers/net/ethernet/Kconfig
-@@ -186,4 +186,6 @@ source "drivers/net/ethernet/wiznet/Kcon
- source "drivers/net/ethernet/xilinx/Kconfig"
- source "drivers/net/ethernet/xircom/Kconfig"
-
-+source "drivers/net/ethernet/mcs8140/Kconfig"
-+
- endif # ETHERNET
---- a/drivers/net/ethernet/Makefile
-+++ b/drivers/net/ethernet/Makefile
-@@ -84,3 +84,4 @@ obj-$(CONFIG_NET_VENDOR_VIA) += via/
- obj-$(CONFIG_NET_VENDOR_WIZNET) += wiznet/
- obj-$(CONFIG_NET_VENDOR_XILINX) += xilinx/
- obj-$(CONFIG_NET_VENDOR_XIRCOM) += xircom/
-+obj-$(CONFIG_NUPORT_ETHERNET_DRIVER) += mcs8140/
+++ /dev/null
---- a/drivers/usb/host/ehci-hcd.c
-+++ b/drivers/usb/host/ehci-hcd.c
-@@ -1298,6 +1298,11 @@ MODULE_LICENSE ("GPL");
- #define PLATFORM_DRIVER ehci_hcd_sead3_driver
- #endif
-
-+#ifdef CONFIG_ARCH_MCS814X
-+#include "ehci-mcs814x.c"
-+#define PLATFORM_DRIVER mcs814x_ehci_driver
-+#endif
-+
- static int __init ehci_hcd_init(void)
- {
- int retval = 0;
---- a/drivers/usb/host/ohci-hcd.c
-+++ b/drivers/usb/host/ohci-hcd.c
-@@ -1259,6 +1259,11 @@ MODULE_LICENSE ("GPL");
- #define PLATFORM_DRIVER ohci_hcd_tilegx_driver
- #endif
-
-+#ifdef CONFIG_ARCH_MCS814X
-+#include "ohci-mcs814x.c"
-+#define PLATFORM_DRIVER ohci_hcd_mcs814x_driver
-+#endif
-+
- static int __init ohci_hcd_mod_init(void)
- {
- int retval = 0;
+++ /dev/null
---- a/drivers/char/hw_random/Kconfig
-+++ b/drivers/char/hw_random/Kconfig
-@@ -229,6 +229,18 @@ config HW_RANDOM_TX4939
-
- If unsure, say Y.
-
-+config HW_RANDOM_MCS814X
-+ tristate "Moschip MCS814x Random Number Generator"
-+ depends on HW_RANDOM && ARCH_MCS814X
-+ ---help---
-+ This driver provides kernel-side support for the Random Number
-+ Generator hardware found on Moschip MCS814x processors.
-+
-+ To compile this driver as a module, choose M here: the
-+ module will be called mcs814x-rng.
-+
-+ If unusure, say Y.
-+
- config HW_RANDOM_MXC_RNGA
- tristate "Freescale i.MX RNGA Random Number Generator"
- depends on ARCH_HAS_RNGA
---- a/drivers/char/hw_random/Makefile
-+++ b/drivers/char/hw_random/Makefile
-@@ -19,6 +19,7 @@ obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += oma
- obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o
- obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o
- obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o
-+obj-$(CONFIG_HW_RANDOM_MCS814X) += mcs814x-rng.o
- obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o
- obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
- obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
+++ /dev/null
---- a/drivers/watchdog/Kconfig
-+++ b/drivers/watchdog/Kconfig
-@@ -505,6 +505,12 @@ config MESON_WATCHDOG
- To compile this driver as a module, choose M here: the
- module will be called meson_wdt.
-
-+config MCS814X_WATCHDOG
-+ tristate "Moschip MCS814x watchdog"
-+ depends on WATCHDOG_CORE && ARCH_MCS814X
-+ help
-+ Support for the Moschip MCS814x SoCs on-chip watchdog timer.
-+
- # AVR32 Architecture
-
- config AT32AP700X_WDT
---- a/drivers/watchdog/Makefile
-+++ b/drivers/watchdog/Makefile
-@@ -63,6 +63,7 @@ obj-$(CONFIG_QCOM_WDT) += qcom-wdt.o
- obj-$(CONFIG_BCM_KONA_WDT) += bcm_kona_wdt.o
- obj-$(CONFIG_TEGRA_WATCHDOG) += tegra_wdt.o
- obj-$(CONFIG_MESON_WATCHDOG) += meson_wdt.o
-+obj-$(CONFIG_MCS814X_WATCHDOG) += mcs814x_wdt.o
-
- # AVR32 Architecture
- obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
+++ /dev/null
---- a/drivers/gpio/Kconfig
-+++ b/drivers/gpio/Kconfig
-@@ -820,6 +820,12 @@ config GPIO_MC33880
- SPI driver for Freescale MC33880 high-side/low-side switch.
- This provides GPIO interface supporting inputs and outputs.
-
-+config GPIO_MCS814X
-+ tristate "Moschip MCS814x GPIO support"
-+ depends on ARCH_MCS814X
-+ help
-+ GPIO driver for Moschip MCS814x SoC gpio controllers.
-+
- config GPIO_74X164
- tristate "74x164 serial-in/parallel-out 8-bits shift register"
- depends on SPI_MASTER && OF
---- a/drivers/gpio/Makefile
-+++ b/drivers/gpio/Makefile
-@@ -49,6 +49,7 @@ obj-$(CONFIG_GPIO_MAX732X) += gpio-max73
- obj-$(CONFIG_GPIO_MC33880) += gpio-mc33880.o
- obj-$(CONFIG_GPIO_MC9S08DZ60) += gpio-mc9s08dz60.o
- obj-$(CONFIG_GPIO_MCP23S08) += gpio-mcp23s08.o
-+obj-$(CONFIG_GPIO_MCS814X) += gpio-mcs814x.o
- obj-$(CONFIG_GPIO_ML_IOH) += gpio-ml-ioh.o
- obj-$(CONFIG_GPIO_MM_LANTIQ) += gpio-mm-lantiq.o
- obj-$(CONFIG_GPIO_MOXART) += gpio-moxart.o
+++ /dev/null
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -164,6 +164,10 @@ config RTL8306_PHY
- tristate "Driver for Realtek RTL8306S switches"
- select SWCONFIG
-
-+config MCS814X_PHY
-+ tristate "Driver for the Moschip MCS814x internal PHY"
-+ depends on ARCH_MCS814X
-+
- config FIXED_PHY
- bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
- depends on PHYLIB=y
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -51,3 +51,4 @@ obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o
- obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o
- obj-$(CONFIG_AMD_XGBE_PHY) += amd-xgbe-phy.o
- obj-$(CONFIG_MDIO_BCM_UNIMAC) += mdio-bcm-unimac.o
-+obj-$(CONFIG_MCS814X_PHY) += mcs814x.o
+++ /dev/null
---- a/drivers/mtd/chips/cfi_cmdset_0002.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
-@@ -40,9 +40,9 @@
- #include <linux/mtd/xip.h>
-
- #define AMD_BOOTLOC_BUG
--#define FORCE_WORD_WRITE 0
-+#define FORCE_WORD_WRITE 1
-
--#define MAX_WORD_RETRIES 3
-+#define MAX_WORD_RETRIES 10
-
- #define SST49LF004B 0x0060
- #define SST49LF040B 0x0050
+++ /dev/null
---- a/drivers/usb/host/ohci.h
-+++ b/drivers/usb/host/ohci.h
-@@ -122,7 +122,7 @@ struct td {
- /* PSW is only for ISO. Only 1 PSW entry is used, but on
- * big-endian PPC hardware that's the second entry.
- */
--#define MAXPSW 2
-+#define MAXPSW 8
- __hc16 hwPSW [MAXPSW];
-
- /* rest are purely for the driver's use */
---- a/drivers/usb/host/ohci-hcd.c
-+++ b/drivers/usb/host/ohci-hcd.c
-@@ -441,6 +441,7 @@ static int ohci_init (struct ohci_hcd *o
- {
- int ret;
- struct usb_hcd *hcd = ohci_to_hcd(ohci);
-+ u32 hcca_area;
-
- /* Accept arbitrarily long scatter-gather lists */
- hcd->self.sg_tablesize = ~0;
-@@ -501,11 +502,13 @@ static int ohci_init (struct ohci_hcd *o
- (unsigned long) ohci);
- set_timer_slack(&ohci->io_watchdog, msecs_to_jiffies(20));
-
-- ohci->hcca = dma_alloc_coherent (hcd->self.controller,
-- sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL);
-+ hcca_area = ohci_readl(ohci, &ohci->regs->hcca);
-+ ohci->hcca = ioremap_nocache(hcca_area, sizeof *ohci->hcca);
- if (!ohci->hcca)
- return -ENOMEM;
-
-+ ohci->hcca_dma = hcca_area;
-+
- if ((ret = ohci_mem_init (ohci)) < 0)
- ohci_stop (hcd);
- else {
-@@ -523,6 +526,7 @@ static int ohci_init (struct ohci_hcd *o
- */
- static int ohci_run (struct ohci_hcd *ohci)
- {
-+ int i = 0;
- u32 mask, val;
- int first = ohci->fminterval == 0;
- struct usb_hcd *hcd = ohci_to_hcd(ohci);
-@@ -573,6 +577,8 @@ static int ohci_run (struct ohci_hcd *oh
- msleep(val);
-
- memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
-+ for (i = 0; i < NUM_INTS; i++)
-+ ohci->hcca->int_table[i] = 0;
-
- /* 2msec timelimit here means no irqs/preempt */
- spin_lock_irq (&ohci->lock);
-@@ -984,9 +990,6 @@ static void ohci_stop (struct usb_hcd *h
- remove_debug_files (ohci);
- ohci_mem_cleanup (ohci);
- if (ohci->hcca) {
-- dma_free_coherent (hcd->self.controller,
-- sizeof *ohci->hcca,
-- ohci->hcca, ohci->hcca_dma);
- ohci->hcca = NULL;
- ohci->hcca_dma = 0;
- }
+++ /dev/null
---- a/arch/arm/mach-mcs814x/include/mach/debug-macro.S
-+++ /dev/null
-@@ -1,11 +0,0 @@
--#include <mach/mcs814x.h>
--
-- .macro addruart, rp, rv, tmp
-- ldr \rp, =MCS814X_PHYS_BASE
-- ldr \rv, =MCS814X_VIRT_BASE
-- orr \rp, \rp, #MCS814X_UART
-- orr \rv, \rv, #MCS814X_UART
-- .endm
--
--#define UART_SHIFT 2
--#include <asm/hardware/debug-8250.S>
---- a/arch/arm/Kconfig.debug
-+++ b/arch/arm/Kconfig.debug
-@@ -1089,7 +1089,7 @@ config DEBUG_UART_8250
- (FOOTBRIDGE && !DEBUG_DC21285_PORT) || \
- ARCH_GEMINI || ARCH_IOP13XX || ARCH_IOP32X || \
- ARCH_IOP33X || ARCH_IXP4XX || \
-- ARCH_LPC32XX || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC
-+ ARCH_LPC32XX || ARCH_MCS814X || ARCH_MV78XX0 || ARCH_ORION5X || ARCH_RPC
-
- # Compatibility options for BCM63xx
- config DEBUG_UART_BCM63XX
-@@ -1124,6 +1124,7 @@ config DEBUG_UART_PHYS
- default 0x3e000000 if DEBUG_BCM_KONA_UART
- default 0x4000e400 if DEBUG_LL_UART_EFM32
- default 0x40090000 if ARCH_LPC32XX
-+ default 0x400dc000 if ARCH_MCS814X
- default 0x40100000 if DEBUG_PXA_UART1
- default 0x42000000 if ARCH_GEMINI
- default 0x50000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \
-@@ -1178,6 +1179,7 @@ config DEBUG_UART_VIRT
- default 0xe0010fe0 if ARCH_RPC
- default 0xe1000000 if DEBUG_MSM_UART
- default 0xf0000be0 if ARCH_EBSA110
-+ default 0xf00dc000 if ARCH_MCS814X
- default 0xf01fb000 if DEBUG_NOMADIK_UART
- default 0xf0201000 if DEBUG_BCM2835
- default 0xf1000300 if DEBUG_BCM_5301X
+++ /dev/null
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/Generic
- NAME:=Generic profile
-endef
-
-define Profile/Generic/Description
- Default profile for Moschip MCS814x targets
-endef
-$(eval $(call Profile,Generic))
-
+++ /dev/null
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/dLAN_USB_Extender
- NAME:=Devolo dLAN USB Extender
- PACKAGES:=kmod-usb-serial kmod-usb-serial-ftdi
-endef
-
-define Profile/dLAN_USB_Extender/Description
- Package set specifically tuned for the Devolo dLAN USB Extender device.
-
- Binary packages are required to enable the power line portion of the
- device, these packages can be found in the following package feed:
-
- src-git dlan https://github.com/ffainelli/dlan-usb-extender-3rd-party.git
-
- Instructions are available here:
- http://ffainelli.github.io/dlan-usb-extender-3rd-party/
-endef
-$(eval $(call Profile,dLAN_USB_Extender))
-
+++ /dev/null
-#
-# Copyright (C) 2010-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=arm
-BOARD:=omap24xx
-BOARDNAME:=TI OMAP24xx
-MAINTAINER:=Michael Buesch <m@bues.ch>
-FEATURES:=targz squashfs jffs2_nand usb usbgadget display gpio audio broken
-CPU_TYPE:=arm1136j-s
-
-KERNEL_PATCHVER:=4.1
-
-KERNELNAME:=zImage dtbs
-
-define Target/Description
- TI OMAP-24xx
-endef
-
-include $(INCLUDE_DIR)/target.mk
-
-$(eval $(call BuildTarget))
+++ /dev/null
-config mount
- option target /maemo/initfs
- option device /dev/mtdblock3
- option fstype jffs2
- option options rw,noatime
- option enabled 0
-
-config mount
- option target /maemo/rootfs
- option device /dev/mtdblock4
- option fstype jffs2
- option options rw,noatime
- option enabled 0
+++ /dev/null
-config interface loopback
- option ifname lo
- option proto static
- option netmask 255.0.0.0
-
-config interface lan
- option proto dhcp
- option netmask 255.255.255.0
-
-config interface usb
- option ifname usb0
- option proto static
- option ipaddr 192.168.168.168
- option netmask 255.255.255.0
- option ip6addr fe80::810:1
+++ /dev/null
-config wifi-device radio0
- option type mac80211
- option phy phy0
- option channel auto
- # TODO: CHANGE THE MAC-ADDRESS:
- option macaddr 00:11:22:33:44:55
- option hwmode 11g
-# option country DE
-
- # REMOVE THIS LINE TO ENABLE WIFI:
- option disabled 1
-
-config wifi-iface
- option device radio0
- option powersave 1
- option network lan
- option mode sta
- option ssid OpenWrt
-# option encryption psk2
-# option key "foobar"
+++ /dev/null
-#!/bin/sh
-
-n810_cal_bme_pmm_extract() {
- [ -x /usr/bin/calvaria ] && {
- /usr/bin/calvaria -p -n bme -i last /dev/mtdblock1 >/lib/firmware/n810-cal-bme-pmm.fw ||\
- echo "CAL-BME extract: Failed to extract blob"
- }
-}
-
-. /lib/functions.sh
-
-[ "$FIRMWARE" = "n810-cal-bme-pmm.fw" ] && {
- [ "$(board_name)" != "nokia,n810" ] || {
- [ -e /lib/firmware/n810-cal-bme-pmm.fw ] ||\
- n810_cal_bme_pmm_extract
- }
-}
+++ /dev/null
-#!/bin/sh
-
-p54spi_eeprom_clean() {
- rm -f /tmp/wlan-iq-align /tmp/wlan-tx-gen2
-}
-
-p54spi_eeprom_die() {
- echo "$*"
- p54spi_eeprom_clean
- exit 1
-}
-
-p54spi_eeprom_extract() {
- [ -x /usr/bin/calvaria -a -x /usr/bin/cal2p54 ] && {
- /usr/bin/calvaria -p -n wlan-iq-align -i last /dev/mtdblock1 >/tmp/wlan-iq-align ||\
- p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-iq-align"
- /usr/bin/calvaria -p -n wlan-tx-gen2 -i last /dev/mtdblock1 >/tmp/wlan-tx-gen2 ||\
- p54spi_eeprom_die "p54spi EEPROM: Failed to extract wlan-tx-gen2"
- /usr/bin/cal2p54 /tmp/wlan-tx-gen2 /tmp/wlan-iq-align >/lib/firmware/3826.eeprom ||\
- p54spi_eeprom_die "p54spi EEPROM: Failed to generate EEPROM"
- p54spi_eeprom_clean
- }
-}
-
-. /lib/functions.sh
-
-[ "$FIRMWARE" = "3826.eeprom" ] && {
- [ "$(board_name)" != "nokia,n810" ] || {
- [ -e /lib/firmware/3826.eeprom ] ||\
- p54spi_eeprom_extract
- }
-}
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2008-2010 OpenWrt.org
-
-START=25
-
-start() {
- [ -c /dev/watchdog -a -x /sbin/watchdog ] || {
- echo "WARNING: Watchdog not available. System will reboot soon!"
- return 1
- }
- /sbin/watchdog -T 63 -t 50 /dev/watchdog
- [ -x /usr/bin/schedtool ] && /usr/bin/schedtool -R -p 60 -n -20 $(pidof watchdog)
-}
-
-stop() {
- killall -q watchdog
-}
+++ /dev/null
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K shutdown
-tts/0::askfirst:/usr/libexec/login.sh
-ttyO2::askfirst:/usr/libexec/login.sh
-tty1::askfirst:/usr/libexec/login.sh
+++ /dev/null
-14706 -12 -3754952 36 -9898 35656000 65536
+++ /dev/null
-CONFIG_ALIGNMENT_TRAP=y
-# CONFIG_APM_EMULATION is not set
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_BANDGAP=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
-CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MULTIPLATFORM=y
-# CONFIG_ARCH_MULTI_CPU_AUTO is not set
-CONFIG_ARCH_MULTI_V6=y
-CONFIG_ARCH_MULTI_V6_V7=y
-CONFIG_ARCH_NR_GPIO=0
-CONFIG_ARCH_OMAP=y
-CONFIG_ARCH_OMAP2=y
-CONFIG_ARCH_OMAP2PLUS=y
-CONFIG_ARCH_OMAP2PLUS_TYPICAL=y
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-# CONFIG_ARCH_WM8750 is not set
-CONFIG_ARM=y
-CONFIG_ARM_APPENDED_DTB=y
-CONFIG_ARM_ATAG_DTB_COMPAT=y
-CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND=y
-# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER is not set
-# CONFIG_ARM_CPU_SUSPEND is not set
-CONFIG_ARM_HAS_SG_CHAIN=y
-CONFIG_ARM_L1_CACHE_SHIFT=5
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-CONFIG_ARM_THUMB=y
-CONFIG_ATAGS=y
-CONFIG_AUTO_ZRELADDR=y
-CONFIG_BINFMT_MISC=y
-CONFIG_BOUNCE=y
-# CONFIG_CACHE_L2X0 is not set
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_MMIO=y
-CONFIG_CLKSRC_OF=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="root=/dev/mmcblk0p1 rootwait rootfstype=ext4,ext3,ext2,squashfs,jffs2 console=tty0 console=ttyO2,115200n8 earlyprintk"
-CONFIG_CMDLINE_FORCE=y
-CONFIG_COMMON_CLK=y
-CONFIG_CPU_32v6=y
-CONFIG_CPU_32v6K=y
-CONFIG_CPU_ABRT_EV6=y
-# CONFIG_CPU_BPREDICT_DISABLE is not set
-CONFIG_CPU_CACHE_V6=y
-CONFIG_CPU_CACHE_VIPT=y
-CONFIG_CPU_COPY_V6=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_HAS_ASID=y
-# CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_PABRT_V6=y
-CONFIG_CPU_TLB_V6=y
-CONFIG_CPU_V6=y
-CONFIG_CPU_V6K=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_DCACHE_WORD_ACCESS=y
-CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
-# CONFIG_DEBUG_UART_8250 is not set
-# CONFIG_DEBUG_USER is not set
-# CONFIG_DISPLAY_ENCODER_OPA362 is not set
-CONFIG_DTC=y
-CONFIG_EXTCON=y
-# CONFIG_EXTCON_GPIO is not set
-# CONFIG_EXTCON_RT8973A is not set
-# CONFIG_EXTCON_SM5502 is not set
-# CONFIG_EXTCON_USB_GPIO is not set
-CONFIG_FB=y
-CONFIG_FB_CFB_COPYAREA=y
-CONFIG_FB_CFB_FILLRECT=y
-CONFIG_FB_CFB_IMAGEBLIT=y
-CONFIG_FB_CMDLINE=y
-CONFIG_FB_OMAP2=y
-CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
-CONFIG_FB_OMAP2_NUM_FBS=3
-CONFIG_FRAME_POINTER=y
-CONFIG_GENERIC_ALLOCATOR=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_CHIP=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_PINCONF=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIOLIB_IRQCHIP=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_OMAP=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-# CONFIG_HAVE_ARCH_BITREVERSE is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CLK_PREPARE=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZ4=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_OPTPROBES=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PERF_REGS=y
-CONFIG_HAVE_PERF_USER_STACK_DUMP=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HDMI=y
-CONFIG_HIGHMEM=y
-# CONFIG_HIGHPTE is not set
-CONFIG_HZ_FIXED=0
-CONFIG_HZ_PERIODIC=y
-CONFIG_I2C=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_I2C_OMAP=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_INPUT=y
-CONFIG_INPUT_RETU_PWRBUTTON=y
-CONFIG_IOMMU_HELPER=y
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_LIBFDT=y
-CONFIG_LZO_COMPRESS=y
-CONFIG_LZO_DECOMPRESS=y
-CONFIG_MACH_NOKIA_N810=y
-CONFIG_MACH_NOKIA_N810_WIMAX=y
-CONFIG_MACH_NOKIA_N8X0=y
-CONFIG_MACH_OMAP2_TUSB6010=y
-CONFIG_MACH_OMAP_GENERIC=y
-CONFIG_MEMORY=y
-CONFIG_MENELAUS=y
-CONFIG_MFD_CORE=y
-CONFIG_MFD_RETU=y
-CONFIG_MFD_SYSCON=y
-CONFIG_MIGHT_HAVE_CACHE_L2X0=y
-CONFIG_MIGHT_HAVE_PCI=y
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MULTI_IRQ_HANDLER=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NLS=y
-CONFIG_NO_BOOTMEM=y
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_OMAP2_DSS=y
-CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS=y
-CONFIG_OMAP2_DSS_DEBUG=y
-CONFIG_OMAP2_DSS_DEBUGFS=y
-# CONFIG_OMAP2_DSS_DPI is not set
-# CONFIG_OMAP2_DSS_DSI is not set
-CONFIG_OMAP2_DSS_INIT=y
-CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=0
-CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET=y
-# CONFIG_OMAP2_DSS_VENC is not set
-CONFIG_OMAP2_VRFB=y
-# CONFIG_OMAP4_DSS_HDMI is not set
-# CONFIG_OMAP5_DSS_HDMI is not set
-CONFIG_OMAP_32K_TIMER=y
-# CONFIG_OMAP_CONTROL_PHY is not set
-CONFIG_OMAP_DM_TIMER=y
-CONFIG_OMAP_GPMC=y
-# CONFIG_OMAP_INTERCONNECT is not set
-CONFIG_OMAP_IRQCHIP=y
-CONFIG_OMAP_MUX=y
-# CONFIG_OMAP_MUX_DEBUG is not set
-CONFIG_OMAP_MUX_WARNINGS=y
-CONFIG_OMAP_PM_NOOP=y
-# CONFIG_OMAP_RESET_CLOCKS is not set
-# CONFIG_OMAP_WATCHDOG is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xC0000000
-# CONFIG_PCI is not set
-# CONFIG_PCI_DOMAINS_GENERIC is not set
-# CONFIG_PCI_SYSCALL is not set
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PGTABLE_LEVELS=2
-# CONFIG_PHY_DM816X_USB is not set
-CONFIG_PINCTRL=y
-CONFIG_PM=y
-CONFIG_PM_CLK=y
-# CONFIG_PM_DEBUG is not set
-# CONFIG_RCU_STALL_COMMON is not set
-CONFIG_REGMAP=y
-CONFIG_REGMAP_IRQ=y
-CONFIG_REGMAP_MMIO=y
-CONFIG_REGULATOR=y
-# CONFIG_REGULATOR_PBIAS is not set
-CONFIG_RETU_WATCHDOG=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SERIAL_8250_OMAP is not set
-# CONFIG_SERIAL_OMAP is not set
-CONFIG_SOC_BUS=y
-CONFIG_SOC_HAS_OMAP2_SDRC=y
-CONFIG_SOC_OMAP2420=y
-# CONFIG_SOC_OMAP2430 is not set
-CONFIG_SPARSE_IRQ=y
-CONFIG_SPI=y
-CONFIG_SPI_MASTER=y
-# CONFIG_SPI_OMAP24XX is not set
-CONFIG_SRCU=y
-CONFIG_SWIOTLB=y
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-CONFIG_TAHVO_USB=y
-# CONFIG_TAHVO_USB_HOST_BY_DEFAULT is not set
-CONFIG_TICK_CPU_ACCOUNTING=y
-# CONFIG_TI_EMIF is not set
-CONFIG_TI_PRIV_EDMA=y
-CONFIG_UID16=y
-CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
-CONFIG_USB=y
-CONFIG_USB_COMMON=y
-# CONFIG_USB_EHCI_HCD is not set
-CONFIG_USB_MON=y
-CONFIG_USB_OTG=y
-CONFIG_USB_OTG_FSM=y
-CONFIG_USB_PHY=y
-CONFIG_USB_SUPPORT=y
-CONFIG_USE_OF=y
-CONFIG_VECTORS_BASE=0xffff0000
-CONFIG_VFP=y
-CONFIG_VIDEOMODE_HELPERS=y
-CONFIG_WATCHDOG_CORE=y
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZONE_DMA_FLAG=0
+++ /dev/null
-#
-# Copyright (C) 2010-2015 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
-
-NAND_BLOCKSIZE=2048-128k
-
-define Image/BuildKernel
- cat $(KDIR)/zImage $(DTS_DIR)/omap2420-n810.dtb > $(BIN_DIR)/$(IMG_PREFIX)-zImage
- chmod 0644 $(BIN_DIR)/$(IMG_PREFIX)-zImage
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-root.$(1))
-endef
-
-define Image/Build
- $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-root.$(1)
- $(call Image/Build/$(1),$(1))
-endef
-
-
-$(eval $(call BuildImage))
+++ /dev/null
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define KernelPackage/sound-soc-omap
- TITLE:=OMAP SoC sound support
- KCONFIG:= \
- CONFIG_SND_OMAP_SOC
- FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap.ko
- AUTOLOAD:=$(call AutoLoad,60,snd-soc-omap)
- DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-core
- $(call AddDepends/sound)
-endef
-
-$(eval $(call KernelPackage,sound-soc-omap))
-
-
-define KernelPackage/sound-soc-omap-mcbsp
- TITLE:=OMAP SoC MCBSP support
- KCONFIG:= \
- CONFIG_SND_OMAP_SOC_MCBSP
- FILES:=$(LINUX_DIR)/sound/soc/omap/snd-soc-omap-mcbsp.ko
- AUTOLOAD:=$(call AutoLoad,61,snd-soc-omap-mcbsp)
- DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap
- $(call AddDepends/sound)
-endef
-
-$(eval $(call KernelPackage,sound-soc-omap-mcbsp))
-
-
-define KernelPackage/sound-soc-n810
- TITLE:=Nokia n810 SoC sound support
- KCONFIG:= \
- CONFIG_SND_OMAP_SOC_N810
- FILES:= \
- $(LINUX_DIR)/sound/soc/codecs/snd-soc-tlv320aic3x.ko \
- $(LINUX_DIR)/sound/soc/omap/snd-soc-n810.ko
- AUTOLOAD:=$(call AutoLoad,65,snd-soc-tlv320aic3x snd-soc-n810)
- DEPENDS:=@TARGET_omap24xx +kmod-sound-soc-omap +kmod-sound-soc-omap-mcbsp
- $(call AddDepends/sound)
-endef
-
-$(eval $(call KernelPackage,sound-soc-n810))
-
-
-define KernelPackage/n810bm
- SUBMENU:=$(OTHER_MENU)
- TITLE:=Nokia N810 battery management driver
- DEPENDS:=@TARGET_omap24xx
- KCONFIG:=CONFIG_N810BM
- FILES:=$(LINUX_DIR)/drivers/cbus/n810bm.ko
- AUTOLOAD:=$(call AutoLoad,01,n810bm)
-endef
-
-define KernelPackage/n810bm/description
- Nokia N810 battery management driver.
- Controls battery power management and battery charging.
-endef
-
-$(eval $(call KernelPackage,n810bm))
-
-
-define KernelPackage/usb-tahvo
- TITLE:=Support for Tahvo (Nokia n810) USB
- KCONFIG:= \
- CONFIG_TAHVO_USB \
- CONFIG_TAHVO_USB_HOST_BY_DEFAULT=n \
- CONFIG_USB_OHCI_HCD_OMAP1=y \
- CONFIG_USB_GADGET_DEBUG_FS=n
- DEPENDS:=@TARGET_omap24xx
- FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-tahvo.ko
- AUTOLOAD:=$(call AutoLoad,45,phy-tahvo)
- $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-tahvo/description
- Kernel support for Nokia n810 USB OHCI controller.
-endef
-
-$(eval $(call KernelPackage,usb-tahvo))
+++ /dev/null
-#
-# Copyright (C) 2010-2011 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/n810-base
- NAME:=Nokia n810 (base)
- PACKAGES:= \
- block-mount \
- gpsd \
- ip iw kmod-p54-spi wpa-supplicant \
- dnsmasq dropbear \
- pwrtray-backend \
- kmod-fs-vfat kmod-fs-msdos \
- kmod-input-evdev \
- kmod-leds-gpio \
- kmod-usb-tahvo kmod-usb-gadget-eth \
- kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-pegasus kmod-usb-net-rndis \
- kmod-usb-storage kmod-usb-hid \
- kmod-bluetooth kmod-bluetooth-hci-h4p bluez-utils bluez-hcidump \
- kmod-n810bm maemo-kexec calvaria \
- schedtool
-endef
-
-define Profile/n810-base/Description
- Minimal package set for Nokia n810 hardware.
-endef
-$(eval $(call Profile,n810-base))
-
+++ /dev/null
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define Profile/n810-gui
- $(call Profile/n810-base)
- NAME:=Nokia n810 (GUI)
- PACKAGES+= \
- xserver-xorg xinit xauth xkeyboard-config xkbdata xterm \
- xf86-video-omapfb xf86-input-tslib xf86-input-evdev \
- openbox tint2 matchbox-keyboard \
- pwrtray
-endef
-
-define Profile/n810-gui/Description
- Graphical user interface package set for Nokia n810 hardware.
-endef
-$(eval $(call Profile,n810-gui))
-
+++ /dev/null
-#
-# Copyright (C) 2008-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=powerpc
-BOARD:=ppc40x
-BOARDNAME:=AMCC/IBM PPC40x
-FEATURES:=squashfs broken
-CPU_TYPE:=405
-MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
-
-KERNEL_PATCHVER:=3.18
-
-define Target/Description
- Build firmware images for AMCC/IBM PPC40x based boards.
-endef
-
-include $(INCLUDE_DIR)/target.mk
-
-KERNELNAME:=uImage cuImage.magicbox cuImage.openrb
-
-$(eval $(call BuildTarget))
+++ /dev/null
-#!/bin/sh
-
-do_sysinfo_ppc40x() {
- local name="$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /model/ {print $2}' /proc/cpuinfo)"
- [ -z "$name" ] && name="unknown"
-
- [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
- echo "$name" > /tmp/sysinfo/board_name
- echo "unknown" > /tmp/sysinfo/model
-}
-
-boot_hook_add preinit_main do_sysinfo_ppc40x
+++ /dev/null
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-
-PART_NAME=firmware
-
-platform_check_image() {
- local board=$(board_name)
- local magic="$(get_magic_word "$1")"
-
- [ "$#" -gt 1 ] && return 1
-
- case "$board" in
- kilauea | openrb | magicbox)
- [ "$magic" != "2705" ] && {
- echo "Invalid image type."
- return 1
- }
- return 0
- ;;
- esac
-
- echo "Sysupgrade is not yet supported on $board."
- return 1
-}
-
-platform_do_upgrade() {
- local board=$(board_name)
-
- case "$board" in
- *)
- default_do_upgrade "$ARGV"
- ;;
- esac
-}
+++ /dev/null
-CONFIG_405EX=y
-CONFIG_40x=y
-# CONFIG_44x is not set
-CONFIG_4xx=y
-CONFIG_4xx_SOC=y
-# CONFIG_ACADIA is not set
-# CONFIG_ADVANCED_OPTIONS is not set
-CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
-CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_ILOG2_U32=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_WALK_MEMORY=y
-CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MAY_HAVE_PC_FDC=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-# CONFIG_ARCH_RANDOM is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-CONFIG_AUDIT_ARCH=y
-CONFIG_BOOKE_WDT=y
-CONFIG_BOUNCE=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd"
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CONSISTENT_SIZE=0x00200000
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-# CONFIG_CRYPTO_SHA1_PPC is not set
-# CONFIG_DEFAULT_UIMAGE is not set
-CONFIG_DTC=y
-# CONFIG_E200 is not set
-CONFIG_EARLY_PRINTK=y
-# CONFIG_EP405 is not set
-# CONFIG_EPAPR_BOOT is not set
-CONFIG_EXTRA_TARGETS="uImage"
-# CONFIG_FSL_ULI1575 is not set
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-# CONFIG_GENERIC_CSUM is not set
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_ISA_DMA=y
-CONFIG_GENERIC_NVRAM=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-# CONFIG_GENERIC_TBSYNC is not set
-CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_GE_FPGA is not set
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAS_RAPIDIO is not set
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IOREMAP_PROT=y
-CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-# CONFIG_HOTFOOT is not set
-CONFIG_HW_RANDOM=y
-CONFIG_HZ=250
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_IBM_EMAC=y
-CONFIG_IBM_EMAC_EMAC4=y
-CONFIG_IBM_EMAC_POLL_WEIGHT=32
-CONFIG_IBM_EMAC_RGMII=y
-CONFIG_IBM_EMAC_RXB=256
-CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256
-CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0
-CONFIG_IBM_EMAC_TXB=256
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_IOMMU_HELPER is not set
-# CONFIG_IPIC is not set
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_ISA_DMA_API=y
-CONFIG_KERNEL_START=0xc0000000
-CONFIG_KILAUEA=y
-CONFIG_LIBFDT=y
-CONFIG_LOWMEM_SIZE=0x30000000
-CONFIG_MAGICBOX=y
-# CONFIG_MAKALU is not set
-# CONFIG_MATH_EMULATION is not set
-# CONFIG_MMIO_NVRAM is not set
-CONFIG_MODULES_USE_ELF_RELA=y
-# CONFIG_MPIC is not set
-# CONFIG_MPIC_U3_HT_IRQS is not set
-# CONFIG_MPIC_WEIRD is not set
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_SPLIT_FIRMWARE=y
-CONFIG_MTD_SPLIT_UIMAGE_FW=y
-CONFIG_NEED_DMA_MAP_STATE=y
-# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NEED_SG_DMA_LENGTH=y
-# CONFIG_NONSTATIC_KERNEL is not set
-CONFIG_NOT_COHERENT_CACHE=y
-CONFIG_NR_IRQS=512
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND=y
-CONFIG_OPENRB=y
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xc0000000
-CONFIG_PCI=y
-CONFIG_PCIEAER=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_MSI=y
-CONFIG_PHYSICAL_START=0x00000000
-CONFIG_PPC=y
-CONFIG_PPC32=y
-CONFIG_PPC40x_SIMPLE=y
-# CONFIG_PPC4xx_HSTA_MSI is not set
-CONFIG_PPC4xx_MSI=y
-# CONFIG_PPC4xx_OCM is not set
-CONFIG_PPC4xx_PCI_EXPRESS=y
-# CONFIG_PPC64 is not set
-# CONFIG_PPC_85xx is not set
-# CONFIG_PPC_8xx is not set
-# CONFIG_PPC_970_NAP is not set
-CONFIG_PPC_ADV_DEBUG_DACS=2
-CONFIG_PPC_ADV_DEBUG_DVCS=0
-CONFIG_PPC_ADV_DEBUG_IACS=2
-CONFIG_PPC_ADV_DEBUG_REGS=y
-# CONFIG_PPC_BOOK3S_32 is not set
-# CONFIG_PPC_CELL is not set
-# CONFIG_PPC_CELL_NATIVE is not set
-# CONFIG_PPC_COPRO_BASE is not set
-CONFIG_PPC_DCR=y
-# CONFIG_PPC_DCR_MMIO is not set
-CONFIG_PPC_DCR_NATIVE=y
-# CONFIG_PPC_DOORBELL is not set
-# CONFIG_PPC_EARLY_DEBUG is not set
-# CONFIG_PPC_EPAPR_HV_PIC is not set
-# CONFIG_PPC_I8259 is not set
-# CONFIG_PPC_ICP_HV is not set
-# CONFIG_PPC_ICP_NATIVE is not set
-# CONFIG_PPC_ICS_RTAS is not set
-CONFIG_PPC_INDIRECT_PCI=y
-CONFIG_PPC_MMU_NOHASH=y
-# CONFIG_PPC_MM_SLICES is not set
-# CONFIG_PPC_MPC106 is not set
-CONFIG_PPC_MSI_BITMAP=y
-CONFIG_PPC_OF=y
-# CONFIG_PPC_P7_NAP is not set
-CONFIG_PPC_PCI_CHOICE=y
-# CONFIG_PPC_RTAS is not set
-CONFIG_PPC_UDBG_16550=y
-CONFIG_PPC_WERROR=y
-# CONFIG_PPC_XICS is not set
-# CONFIG_PQ2ADS is not set
-# CONFIG_PREEMPT_RCU is not set
-CONFIG_RAS=y
-# CONFIG_RCU_STALL_COMMON is not set
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCSI_DMA is not set
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_OF_PLATFORM=y
-# CONFIG_SLAB is not set
-CONFIG_SLUB=y
-CONFIG_SPARSE_IRQ=y
-# CONFIG_SWIOTLB is not set
-CONFIG_SYSCTL_EXCEPTION_TRACE=y
-CONFIG_TASK_SIZE=0xc0000000
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_USB_SUPPORT=y
-# CONFIG_WALNUT is not set
-CONFIG_WORD_SIZE=32
-# CONFIG_XILINX_SYSACE is not set
-# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_XZ_DEC_POWERPC=y
+++ /dev/null
-#
-# Copyright (C) 2008-2013 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
-
-JFFS2_BLOCKSIZE=128k 64k
-
-define Image/Prepare
- $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(DTS_DIR)/kilauea.dts > $(KDIR)/openwrt-kilauea.dtb
-endef
-
-define Image/BuildKernel
- cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
- $(call Image/Build/Initramfs)
-endef
-
-define Image/Build
- $(call Image/Build/$(1),$(1))
-endef
-
-define Image/Build/ext2
- cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img
-endef
-
-define Image/Build/jffs2-128k
- ( \
- dd if=$(KDIR)/uImage bs=1920k conv=sync; \
- dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-jffs2.img
-endef
-
-define Image/Build/jffs2-64k
- ( \
- dd if=$(KDIR)/cuImage.magicbox bs=1408k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-jffs2.img
- ( \
- dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-jffs2.img
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
- ( \
- dd if=$(KDIR)/uImage bs=1920k conv=sync; \
- dd if=$(KDIR)/openwrt-kilauea.dtb bs=128k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-kilauea-$(1).img
- ( \
- dd if=$(KDIR)/cuImage.magicbox bs=64k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-magicbox-$(1).img
- ( \
- dd if=$(KDIR)/cuImage.openrb bs=1408k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-openrb-$(1).img
-endef
-
-ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
-define Image/Build/Initramfs
- cp $(KDIR)/cuImage.magicbox-initramfs $(BIN_DIR)/openwrt-$(BOARD)-magicbox-initramfs.bin
- cp $(KDIR)/cuImage.openrb-initramfs $(BIN_DIR)/openwrt-$(BOARD)-openrb-initramfs.bin
-endef
-endif
-
-$(eval $(call BuildImage))
+++ /dev/null
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define KernelPackage/ata-magicbox-cf
- SUBMENU:=$(BLOCK_MENU)
- TITLE:=Magicbox v2/OpenRB Compact flash support
- DEPENDS:=@TARGET_ppc40x
- KCONFIG:=CONFIG_PATA_MAGICBOX_CF
- FILES:=$(LINUX_DIR)/drivers/ata/pata_magicbox_cf.ko
- AUTOLOAD:=$(call AutoLoad,41,pata_magicbox_cf,1)
- $(call AddDepends/ata)
-endef
-
-define KernelPackage/ata-magicbox-cf/description
- Support for Magicbox v2/OpenRB on-board CF slot.
-endef
-
-$(eval $(call KernelPackage,ata-magicbox-cf))
-
-
-define KernelPackage/usb-isp116x-hcd
- TITLE:=Support for the ISP116x USB Host Controller
- DEPENDS:=@TARGET_ppc40x
- KCONFIG:= \
- CONFIG_USB_ISP116X_HCD \
- CONFIG_USB_ISP116X_HCD_OF=y \
- CONFIG_USB_ISP116X_HCD_PLATFORM=n
- FILES:=$(LINUX_DIR)/drivers/usb/host/isp116x-hcd.ko
- AUTOLOAD:=$(call AutoLoad,50,isp116x-hcd)
- $(call AddDepends/usb)
-endef
-
-define KernelPackage/usb-isp116x-hcd/description
- Kernel support for the ISP116X USB Host Controller
-endef
-
-$(eval $(call KernelPackage,usb-isp116x-hcd))
+++ /dev/null
---- a/arch/powerpc/boot/dcr.h
-+++ b/arch/powerpc/boot/dcr.h
-@@ -59,6 +59,14 @@ static const unsigned long sdram_bxcr[]
- #define EBC_BXCR(n) (n)
- #define EBC_BXCR_BAS 0xfff00000
- #define EBC_BXCR_BS 0x000e0000
-+#define EBC_BXCR_BS_1M 0x00000000
-+#define EBC_BXCR_BS_2M 0x00020000
-+#define EBC_BXCR_BS_4M 0x00040000
-+#define EBC_BXCR_BS_8M 0x00060000
-+#define EBC_BXCR_BS_16M 0x00080000
-+#define EBC_BXCR_BS_32M 0x000a0000
-+#define EBC_BXCR_BS_64M 0x000c0000
-+#define EBC_BXCR_BS_128M 0x000e0000
- #define EBC_BXCR_BANK_SIZE(reg) \
- (0x100000 << (((reg) & EBC_BXCR_BS) >> 17))
- #define EBC_BXCR_BU 0x00018000
-@@ -67,6 +75,9 @@ static const unsigned long sdram_bxcr[]
- #define EBC_BXCR_BU_WO 0x00010000
- #define EBC_BXCR_BU_RW 0x00018000
- #define EBC_BXCR_BW 0x00006000
-+#define EBC_BXCR_BW_8 0x00000000
-+#define EBC_BXCR_BW_16 0x00002000
-+#define EBC_BXCR_BW_32 0x00006000
- #define EBC_B0AP 0x10
- #define EBC_B1AP 0x11
- #define EBC_B2AP 0x12
+++ /dev/null
---- /dev/null
-+++ b/arch/powerpc/boot/cuboot-magicbox.c
-@@ -0,0 +1,98 @@
-+/*
-+ * Old U-boot compatibility for Magicbox boards
-+ *
-+ * Author: Imre Kaloz <kaloz@openwrt.org>
-+ * Gabor Juhos <juhosg@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published
-+ * by the Free Software Foundation.
-+ */
-+
-+#include "ops.h"
-+#include "io.h"
-+#include "dcr.h"
-+#include "stdio.h"
-+#include "4xx.h"
-+#include "44x.h"
-+#include "cuboot.h"
-+
-+#define TARGET_4xx
-+#define TARGET_405EP
-+#include "ppcboot.h"
-+
-+static bd_t bd;
-+
-+static void fixup_perwe(void)
-+{
-+
-+#define DCRN_CPC0_PCI_BASE 0xf9
-+
-+ /* Turn on PerWE instead of PCIINT */
-+ mtdcr(DCRN_CPC0_PCI_BASE,
-+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27));
-+
-+#undef DCRN_CPC0_PCI_BASE
-+}
-+
-+static void fixup_cf_card(void)
-+{
-+
-+#define CF_CS0_BASE 0xff100000
-+#define CF_CS1_BASE 0xff200000
-+
-+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+#undef CF_CS0_BASE
-+#undef CF_CS1_BASE
-+}
-+
-+static void magicbox_fixups(void)
-+{
-+ ibm405ep_fixup_clocks(bd.bi_procfreq / 8);
-+ ibm4xx_sdram_fixup_memsize();
-+
-+ /* Magicbox v1 has only one ethernet, one serial and no
-+ * CF slot -- detect it using it's fake enet1addr
-+ */
-+ if ((bd.bi_enet1addr[2] == 0x02) &&
-+ (bd.bi_enet1addr[3] == 0xfa) &&
-+ (bd.bi_enet1addr[4] == 0xf0) &&
-+ (bd.bi_enet1addr[5] == 0x80)) {
-+ void *devp;
-+ devp = finddevice("/plb/opb/ethernet@ef600900");
-+ del_node(devp);
-+ devp = finddevice("/plb/opb/serial@ef600400");
-+ del_node(devp);
-+ devp = finddevice("/plb/ebc/cf_card@ff100000");
-+ del_node(devp);
-+
-+ } else {
-+ fixup_perwe();
-+ fixup_cf_card();
-+ }
-+
-+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
-+}
-+
-+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
-+ unsigned long r6, unsigned long r7)
-+{
-+ CUBOOT_INIT();
-+ platform_ops.fixups = magicbox_fixups;
-+ platform_ops.exit = ibm40x_dbcr_reset;
-+ fdt_init(_dtb_start);
-+ serial_console_init();
-+}
---- /dev/null
-+++ b/arch/powerpc/boot/dts/magicbox.dts
-@@ -0,0 +1,285 @@
-+/*
-+ * Device Tree Source for Magicbox boards
-+ *
-+ * Copyright 2008-2009 Imre Kaloz <kaloz@openwrt.org>
-+ * Copyright 2009 Gabor Juhos <juhosg@openwrt.org>
-+ *
-+ * Based on walnut.dts
-+ *
-+ * This file is licensed under the terms of the GNU General Public
-+ * License version 2. This program is licensed "as is" without
-+ * any warranty of any kind, whether express or implied.
-+ */
-+
-+/dts-v1/;
-+
-+/ {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ model = "magicbox";
-+ compatible = "magicbox";
-+ dcr-parent = <&{/cpus/cpu@0}>;
-+
-+ aliases {
-+ ethernet0 = &EMAC0;
-+ ethernet1 = &EMAC1;
-+ serial0 = &UART0;
-+ serial1 = &UART1;
-+ };
-+
-+ cpus {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ cpu@0 {
-+ device_type = "cpu";
-+ model = "PowerPC,405EP";
-+ reg = <0x00000000>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ timebase-frequency = <0>; /* Filled in by zImage */
-+ i-cache-line-size = <0x20>;
-+ d-cache-line-size = <0x20>;
-+ i-cache-size = <0x4000>;
-+ d-cache-size = <0x4000>;
-+ dcr-controller;
-+ dcr-access-method = "native";
-+ };
-+ };
-+
-+ memory {
-+ device_type = "memory";
-+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */
-+ };
-+
-+ UIC0: interrupt-controller {
-+ compatible = "ibm,uic";
-+ interrupt-controller;
-+ cell-index = <0>;
-+ dcr-reg = <0x0c0 0x009>;
-+ #address-cells = <0>;
-+ #size-cells = <0>;
-+ #interrupt-cells = <2>;
-+ };
-+
-+ plb {
-+ compatible = "ibm,plb3";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ SDRAM0: memory-controller {
-+ compatible = "ibm,sdram-405ep";
-+ dcr-reg = <0x010 0x002>;
-+ };
-+
-+ MAL: mcmal {
-+ compatible = "ibm,mcmal-405ep", "ibm,mcmal";
-+ dcr-reg = <0x180 0x062>;
-+ num-tx-chans = <4>;
-+ num-rx-chans = <2>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xb 0x4 /* TXEOB */
-+ 0xc 0x4 /* RXEOB */
-+ 0xa 0x4 /* SERR */
-+ 0xd 0x4 /* TXDE */
-+ 0xe 0x4 /* RXDE */>;
-+ };
-+
-+ POB0: opb {
-+ compatible = "ibm,opb-405ep", "ibm,opb";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges = <0xef600000 0xef600000 0x00a00000>;
-+ dcr-reg = <0x0a0 0x005>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ UART0: serial@ef600300 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600300 0x00000008>;
-+ virtual-reg = <0xef600300>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x0 0x4>;
-+ };
-+
-+ UART1: serial@ef600400 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600400 0x00000008>;
-+ virtual-reg = <0xef600400>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x1 0x4>;
-+ };
-+
-+ IIC: i2c@ef600500 {
-+ compatible = "ibm,iic-405ep", "ibm,iic";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0xef600500 0x00000011>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x2 0x4>;
-+
-+ dtt@48 {
-+ compatible = "national,lm75";
-+ reg = <0x48>;
-+ };
-+
-+ eeprom@50 {
-+ compatible = "at24,24c16";
-+ reg = <0x50>;
-+ };
-+ };
-+
-+ GPIO0: gpio-controller@ef600700 {
-+ compatible = "ibm,ppc4xx-gpio";
-+ reg = <0xef600700 0x00000020>;
-+ #gpio-cells = <2>;
-+ gpio-controller;
-+ };
-+
-+ EMAC0: ethernet@ef600800 {
-+ linux,network-index = <0x0>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xf 0x4 /* Ethernet */
-+ 0x9 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600800 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <0>;
-+ mal-rx-channel = <0>;
-+ cell-index = <0>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000000>;
-+ };
-+
-+ EMAC1: ethernet@ef600900 {
-+ linux,network-index = <0x1>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0x11 0x4 /* Ethernet */
-+ 0x09 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600900 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <2>;
-+ mal-rx-channel = <1>;
-+ cell-index = <1>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ mdio-device = <&EMAC0>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000001>;
-+ };
-+
-+ leds {
-+ compatible = "gpio-leds";
-+ user {
-+ label = "magicbox:red:user";
-+ gpios = <&GPIO0 2 1>;
-+ };
-+ };
-+ };
-+
-+ EBC0: ebc {
-+ compatible = "ibm,ebc-405ep", "ibm,ebc";
-+ dcr-reg = <0x012 0x002>;
-+ #address-cells = <2>;
-+ #size-cells = <1>;
-+ /* The ranges property is supplied by the bootwrapper
-+ * and is based on the firmware's configuration of the
-+ * EBC bridge
-+ */
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ cf_card@ff100000 {
-+ compatible = "magicbox-cf", "pata-magicbox-cf";
-+ reg = <0x00000000 0xff100000 0x00001000
-+ 0x00000000 0xff200000 0x00001000>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
-+ };
-+
-+ nor_flash@ffc00000 {
-+ compatible = "cfi-flash";
-+ bank-width = <2>;
-+ reg = <0x00000000 0xffc00000 0x00400000>;
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ partition0@0 {
-+ label = "linux";
-+ reg = <0x0 0x160000>;
-+ };
-+ partition1@120000 {
-+ label = "rootfs";
-+ reg = <0x160000 0x260000>;
-+ };
-+ partition2@3c0000 {
-+ label = "u-boot";
-+ reg = <0x3c0000 0x30000>;
-+ read-only;
-+ };
-+ partition3@0 {
-+ label = "firmware";
-+ reg = <0x0 0x3c0000>;
-+ };
-+ };
-+ };
-+
-+ PCI0: pci@ec000000 {
-+ device_type = "pci";
-+ #interrupt-cells = <1>;
-+ #size-cells = <2>;
-+ #address-cells = <3>;
-+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
-+ primary;
-+ reg = <0xeec00000 0x00000008 /* Config space access */
-+ 0xeed80000 0x00000004 /* IACK */
-+ 0xeed80000 0x00000004 /* Special cycle */
-+ 0xef480000 0x00000040>; /* Internal registers */
-+
-+ /* Outbound ranges, one memory and one IO,
-+ * later cannot be changed. Chip supports a second
-+ * IO range but we don't use it for now
-+ */
-+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
-+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
-+
-+ /* Inbound 2GB range starting at 0 */
-+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
-+
-+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
-+ interrupt-map = <
-+ /* IDSEL 1 */
-+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8
-+
-+ /* IDSEL 2 */
-+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8
-+
-+ /* IDSEL 3 */
-+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8
-+
-+ /* IDSEL 4 */
-+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8
-+ >;
-+ };
-+ };
-+
-+ chosen {
-+ linux,stdout-path = "/plb/opb/serial@ef600300";
-+ };
-+};
---- a/arch/powerpc/boot/Makefile
-+++ b/arch/powerpc/boot/Makefile
-@@ -50,6 +50,7 @@ $(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -
- $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440
- $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
- $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
-+$(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
-@@ -86,7 +87,8 @@ src-plat-y := of.c epapr.c
- src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
- treeboot-walnut.c cuboot-acadia.c \
- cuboot-kilauea.c simpleboot.c \
-- virtex405-head.S virtex.c
-+ virtex405-head.S virtex.c \
-+ cuboot-magicbox.c
- src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
- cuboot-bamboo.c cuboot-sam440ep.c \
- cuboot-sequoia.c cuboot-rainier.c \
-@@ -238,6 +240,7 @@ image-$(CONFIG_HOTFOOT) += cuImage.hot
- image-$(CONFIG_WALNUT) += treeImage.walnut
- image-$(CONFIG_ACADIA) += cuImage.acadia
- image-$(CONFIG_OBS600) += uImage.obs600
-+image-$(CONFIG_MAGICBOX) += cuImage.magicbox
-
- # Board ports in arch/powerpc/platform/44x/Kconfig
- image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
---- a/arch/powerpc/platforms/40x/Kconfig
-+++ b/arch/powerpc/platforms/40x/Kconfig
-@@ -37,6 +37,16 @@ config KILAUEA
- help
- This option enables support for the AMCC PPC405EX evaluation board.
-
-+config MAGICBOX
-+ bool "Magicbox"
-+ depends on 40x
-+ default n
-+ select PPC40x_SIMPLE
-+ select 405EP
-+ select PCI
-+ help
-+ This option enables support for the Magicbox boards.
-+
- config MAKALU
- bool "Makalu"
- depends on 40x
---- a/arch/powerpc/platforms/40x/ppc40x_simple.c
-+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
-@@ -58,6 +58,7 @@ static const char * const board[] __init
- "apm,klondike",
- "est,hotfoot",
- "plathome,obs600",
-+ "magicbox",
- NULL
- };
-
+++ /dev/null
---- /dev/null
-+++ b/arch/powerpc/boot/cuboot-openrb.c
-@@ -0,0 +1,94 @@
-+/*
-+ * Old U-boot compatibility for OpenRB boards
-+ *
-+ * Author: Gabor Juhos <juhosg@openwrt.org>
-+ * Imre Kaloz <kaloz@openwrt.org>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published
-+ * by the Free Software Foundation.
-+ */
-+
-+#include "ops.h"
-+#include "io.h"
-+#include "dcr.h"
-+#include "stdio.h"
-+#include "4xx.h"
-+#include "44x.h"
-+#include "cuboot.h"
-+
-+#define TARGET_4xx
-+#define TARGET_405EP
-+#include "ppcboot.h"
-+
-+static bd_t bd;
-+
-+static void fixup_perwe(void)
-+{
-+#define DCRN_CPC0_PCI_BASE 0xf9
-+
-+ /* Turn on PerWE instead of PCIINT */
-+ mtdcr(DCRN_CPC0_PCI_BASE,
-+ mfdcr(DCRN_CPC0_PCI_BASE) | (0x80000000L >> 27));
-+
-+#undef DCRN_CPC0_PCI_BASE
-+}
-+
-+static void fixup_cf_card(void)
-+{
-+#define CF_CS0_BASE 0xff100000
-+#define CF_CS1_BASE 0xff200000
-+
-+ /* PerCS1 (CF's CS0): base 0xff100000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS0_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B1AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+ /* PerCS2 (CF's CS1): base 0xff200000, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, CF_CS1_BASE | EBC_BXCR_BS_1M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B2AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x080bd800);
-+
-+#undef CF_CS0_BASE
-+#undef CF_CS1_BASE
-+}
-+
-+static void fixup_isp116x(void)
-+{
-+#define ISP116X_CS_BASE 0xf0000000
-+
-+ /* PerCS3 (ISP1160's CS): base 0xf0000000, size 32MB, 16-bit, rw */
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3CR);
-+ mtdcr(DCRN_EBC0_CFGDATA, ISP116X_CS_BASE | EBC_BXCR_BS_32M |
-+ EBC_BXCR_BU_RW | EBC_BXCR_BW_16);
-+ mtdcr(DCRN_EBC0_CFGADDR, EBC_B3AP);
-+ mtdcr(DCRN_EBC0_CFGDATA, 0x03016600);
-+
-+#undef ISP116X_CS_BASE
-+}
-+
-+static void openrb_fixups(void)
-+{
-+ ibm405ep_fixup_clocks(bd.bi_procfreq / 8);
-+ ibm4xx_sdram_fixup_memsize();
-+
-+ fixup_perwe();
-+ fixup_cf_card();
-+ fixup_isp116x();
-+
-+ dt_fixup_mac_addresses(&bd.bi_enetaddr, &bd.bi_enet1addr);
-+}
-+
-+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
-+ unsigned long r6, unsigned long r7)
-+{
-+ CUBOOT_INIT();
-+ platform_ops.fixups = openrb_fixups;
-+ platform_ops.exit = ibm40x_dbcr_reset;
-+ fdt_init(_dtb_start);
-+ serial_console_init();
-+}
---- /dev/null
-+++ b/arch/powerpc/boot/dts/openrb.dts
-@@ -0,0 +1,291 @@
-+/*
-+ * Device Tree Source for OpenRB boards
-+ *
-+ * Copyright 2009 Gabor Juhos <juhosg@openwrt.org>
-+ * Copyright 2009 Imre Kaloz <kaloz@openwrt.org>
-+ *
-+ * Based on walnut.dts
-+ *
-+ * This file is licensed under the terms of the GNU General Public
-+ * License version 2. This program is licensed "as is" without
-+ * any warranty of any kind, whether express or implied.
-+ */
-+
-+/dts-v1/;
-+
-+/ {
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ model = "openrb";
-+ compatible = "openrb";
-+ dcr-parent = <&{/cpus/cpu@0}>;
-+
-+ aliases {
-+ ethernet0 = &EMAC0;
-+ ethernet1 = &EMAC1;
-+ serial0 = &UART0;
-+ serial1 = &UART1;
-+ };
-+
-+ cpus {
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+
-+ cpu@0 {
-+ device_type = "cpu";
-+ model = "PowerPC,405EP";
-+ reg = <0x00000000>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ timebase-frequency = <0>; /* Filled in by zImage */
-+ i-cache-line-size = <0x20>;
-+ d-cache-line-size = <0x20>;
-+ i-cache-size = <0x4000>;
-+ d-cache-size = <0x4000>;
-+ dcr-controller;
-+ dcr-access-method = "native";
-+ };
-+ };
-+
-+ memory {
-+ device_type = "memory";
-+ reg = <0x00000000 0x00000000>; /* Filled in by zImage */
-+ };
-+
-+ UIC0: interrupt-controller {
-+ compatible = "ibm,uic";
-+ interrupt-controller;
-+ cell-index = <0>;
-+ dcr-reg = <0x0c0 0x009>;
-+ #address-cells = <0>;
-+ #size-cells = <0>;
-+ #interrupt-cells = <2>;
-+ };
-+
-+ plb {
-+ compatible = "ibm,plb3";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ SDRAM0: memory-controller {
-+ compatible = "ibm,sdram-405ep";
-+ dcr-reg = <0x010 0x002>;
-+ };
-+
-+ MAL: mcmal {
-+ compatible = "ibm,mcmal-405ep", "ibm,mcmal";
-+ dcr-reg = <0x180 0x062>;
-+ num-tx-chans = <4>;
-+ num-rx-chans = <2>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xb 0x4 /* TXEOB */
-+ 0xc 0x4 /* RXEOB */
-+ 0xa 0x4 /* SERR */
-+ 0xd 0x4 /* TXDE */
-+ 0xe 0x4 /* RXDE */>;
-+ };
-+
-+ POB0: opb {
-+ compatible = "ibm,opb-405ep", "ibm,opb";
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ ranges = <0xef600000 0xef600000 0x00a00000>;
-+ dcr-reg = <0x0a0 0x005>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ UART0: serial@ef600300 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600300 0x00000008>;
-+ virtual-reg = <0xef600300>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x0 0x4>;
-+ };
-+
-+ UART1: serial@ef600400 {
-+ device_type = "serial";
-+ compatible = "ns16550";
-+ reg = <0xef600400 0x00000008>;
-+ virtual-reg = <0xef600400>;
-+ clock-frequency = <0>; /* Filled in by zImage */
-+ current-speed = <115200>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x1 0x4>;
-+ };
-+
-+ IIC: i2c@ef600500 {
-+ compatible = "ibm,iic-405ep", "ibm,iic";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ reg = <0xef600500 0x00000011>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x2 0x4>;
-+
-+ eeprom@50 {
-+ compatible = "at24,24c16";
-+ reg = <0x50>;
-+ };
-+ };
-+
-+ GPIO0: gpio-controller@ef600700 {
-+ compatible = "ibm,ppc4xx-gpio";
-+ reg = <0xef600700 0x00000020>;
-+ #gpio-cells = <2>;
-+ gpio-controller;
-+ };
-+
-+ EMAC0: ethernet@ef600800 {
-+ linux,network-index = <0x0>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0xf 0x4 /* Ethernet */
-+ 0x9 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600800 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <0>;
-+ mal-rx-channel = <0>;
-+ cell-index = <0>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000000>;
-+ };
-+
-+ EMAC1: ethernet@ef600900 {
-+ linux,network-index = <0x1>;
-+ device_type = "network";
-+ compatible = "ibm,emac-405ep", "ibm,emac";
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <
-+ 0x11 0x4 /* Ethernet */
-+ 0x09 0x4 /* Ethernet Wake Up */>;
-+ local-mac-address = [000000000000]; /* Filled in by zImage */
-+ reg = <0xef600900 0x00000070>;
-+ mal-device = <&MAL>;
-+ mal-tx-channel = <2>;
-+ mal-rx-channel = <1>;
-+ cell-index = <1>;
-+ max-frame-size = <0x5dc>;
-+ rx-fifo-size = <0x1000>;
-+ tx-fifo-size = <0x800>;
-+ mdio-device = <&EMAC0>;
-+ phy-mode = "mii";
-+ phy-map = <0x00000001>;
-+ };
-+
-+ leds {
-+ compatible = "gpio-leds";
-+ user {
-+ label = "openrb:green:user";
-+ gpios = <&GPIO0 2 1>;
-+ };
-+ };
-+ };
-+
-+ EBC0: ebc {
-+ compatible = "ibm,ebc-405ep", "ibm,ebc";
-+ dcr-reg = <0x012 0x002>;
-+ #address-cells = <2>;
-+ #size-cells = <1>;
-+ /* The ranges property is supplied by the bootwrapper
-+ * and is based on the firmware's configuration of the
-+ * EBC bridge
-+ */
-+ clock-frequency = <0>; /* Filled in by zImage */
-+
-+ isp116x@f0000000 {
-+ compatible = "isp116x-hcd";
-+ oc_enable;
-+ int_act_high;
-+ int_edge_triggered;
-+ reg = <0x00000000 0xf0000000 0x00000002 /* data */
-+ 0x00000000 0xf1000000 0x00000002 /* addr */ >;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x1b 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
-+ };
-+
-+ cf_card@ff100000 {
-+ compatible = "magicbox-cf", "pata-magicbox-cf";
-+ reg = <0x00000000 0xff100000 0x00001000
-+ 0x00000000 0xff200000 0x00001000>;
-+ interrupt-parent = <&UIC0>;
-+ interrupts = <0x19 0x1 /* IRQ_TYPE_EDGE_RISING */ >;
-+ };
-+
-+ nor_flash@ff800000 {
-+ compatible = "cfi-flash";
-+ bank-width = <2>;
-+ reg = <0x00000000 0xff800000 0x00800000>;
-+ #address-cells = <1>;
-+ #size-cells = <1>;
-+ partition0@0 {
-+ label = "linux";
-+ reg = <0x0 0x160000>;
-+ };
-+ partition1@120000 {
-+ label = "rootfs";
-+ reg = <0x160000 0x660000>;
-+ };
-+ partition2@7c0000 {
-+ label = "u-boot";
-+ reg = <0x7c0000 0x30000>;
-+ read-only;
-+ };
-+ partition3@0 {
-+ label = "firmware";
-+ reg = <0x0 0x7c0000>;
-+ };
-+ };
-+ };
-+
-+ PCI0: pci@ec000000 {
-+ device_type = "pci";
-+ #interrupt-cells = <1>;
-+ #size-cells = <2>;
-+ #address-cells = <3>;
-+ compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
-+ primary;
-+ reg = <0xeec00000 0x00000008 /* Config space access */
-+ 0xeed80000 0x00000004 /* IACK */
-+ 0xeed80000 0x00000004 /* Special cycle */
-+ 0xef480000 0x00000040>; /* Internal registers */
-+
-+ /* Outbound ranges, one memory and one IO,
-+ * later cannot be changed. Chip supports a second
-+ * IO range but we don't use it for now
-+ */
-+ ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
-+ 0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
-+
-+ /* Inbound 2GB range starting at 0 */
-+ dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
-+
-+ interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
-+ interrupt-map = <
-+ /* IDSEL 1 */
-+ 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8
-+
-+ /* IDSEL 2 */
-+ 0x1000 0x0 0x0 0x0 &UIC0 0x1d 0x8
-+
-+ /* IDSEL 3 */
-+ 0x1800 0x0 0x0 0x0 &UIC0 0x1e 0x8
-+
-+ /* IDSEL 4 */
-+ 0x2000 0x0 0x0 0x0 &UIC0 0x1f 0x8
-+ >;
-+ };
-+ };
-+
-+ chosen {
-+ linux,stdout-path = "/plb/opb/serial@ef600300";
-+ };
-+};
---- a/arch/powerpc/boot/Makefile
-+++ b/arch/powerpc/boot/Makefile
-@@ -51,6 +51,7 @@ $(obj)/cuboot-taishan.o: BOOTCFLAGS += -
- $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
- $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
- $(obj)/cuboot-magicbox.o: BOOTCFLAGS += -mcpu=405
-+$(obj)/cuboot-openrb.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
- $(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
-@@ -88,7 +89,7 @@ src-plat-$(CONFIG_40x) += fixed-head.S e
- treeboot-walnut.c cuboot-acadia.c \
- cuboot-kilauea.c simpleboot.c \
- virtex405-head.S virtex.c \
-- cuboot-magicbox.c
-+ cuboot-magicbox.c cuboot-openrb
- src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
- cuboot-bamboo.c cuboot-sam440ep.c \
- cuboot-sequoia.c cuboot-rainier.c \
-@@ -241,6 +242,7 @@ image-$(CONFIG_WALNUT) += treeImage.wa
- image-$(CONFIG_ACADIA) += cuImage.acadia
- image-$(CONFIG_OBS600) += uImage.obs600
- image-$(CONFIG_MAGICBOX) += cuImage.magicbox
-+image-$(CONFIG_OPENRB) += cuImage.openrb
-
- # Board ports in arch/powerpc/platform/44x/Kconfig
- image-$(CONFIG_EBONY) += treeImage.ebony cuImage.ebony
---- a/arch/powerpc/platforms/40x/Kconfig
-+++ b/arch/powerpc/platforms/40x/Kconfig
-@@ -47,6 +47,16 @@ config MAGICBOX
- help
- This option enables support for the Magicbox boards.
-
-+config OPENRB
-+ bool "OpenRB"
-+ depends on 40x
-+ default n
-+ select PPC40x_SIMPLE
-+ select 405EP
-+ select PCI
-+ help
-+ This option enables support for the OpenRB boards.
-+
- config MAKALU
- bool "Makalu"
- depends on 40x
---- a/arch/powerpc/platforms/40x/ppc40x_simple.c
-+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
-@@ -59,6 +59,7 @@ static const char * const board[] __init
- "est,hotfoot",
- "plathome,obs600",
- "magicbox",
-+ "openrb",
- NULL
- };
-
+++ /dev/null
---- a/drivers/ata/Kconfig
-+++ b/drivers/ata/Kconfig
-@@ -234,6 +234,16 @@ config PDC_ADMA
-
- If unsure, say N.
-
-+config PATA_MAGICBOX_CF
-+ tristate "Magicbox/OpenRB Compact Flash support"
-+ depends on MAGICBOX || OPENRB
-+ help
-+ This option enables support for a Compact Flash conected on
-+ the ppc405ep expansion bus. This driver had been written for
-+ the Magicbox v2 and OpenRB boards.
-+
-+ If unsure, say N.
-+
- config PATA_OCTEON_CF
- tristate "OCTEON Boot Bus Compact Flash support"
- depends on CAVIUM_OCTEON_SOC
---- a/drivers/ata/Makefile
-+++ b/drivers/ata/Makefile
-@@ -91,6 +91,7 @@ obj-$(CONFIG_PATA_AT91) += pata_at91.o
- obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o
- obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o
- obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o
-+obj-$(CONFIG_PATA_MAGICBOX_CF) += pata_magicbox_cf.o
- obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o
- obj-$(CONFIG_PATA_NS87410) += pata_ns87410.o
- obj-$(CONFIG_PATA_OPTI) += pata_opti.o
---- /dev/null
-+++ b/drivers/ata/pata_magicbox_cf.c
-@@ -0,0 +1,401 @@
-+/*
-+ * PATA/CompactFlash driver for the MagicBox v2/OpenRB boards.
-+ *
-+ * Copyright (C) 2009,2012 Gabor Juhos <juhosg@openwrt.org>
-+ *
-+ * Based on the IDE driver by Wojtek Kaniewski <wojtekka@toxygen.net>
-+ *
-+ * This program is free software; you can redistribute it and/or modify it
-+ * under the terms of the GNU General Public License version 2 as published
-+ * by the Free Software Foundation.
-+ */
-+
-+#include <linux/kernel.h>
-+#include <linux/module.h>
-+#include <linux/slab.h>
-+#include <linux/types.h>
-+#include <linux/ioport.h>
-+#include <linux/libata.h>
-+#include <linux/irq.h>
-+//#include <linux/of.h>
-+//#include <linux/of_device.h>
-+#include <linux/of_platform.h>
-+#include <scsi/scsi_host.h>
-+
-+#define DRV_DESC "PATA/CompactFlash driver for Magicbox/OpenRB boards"
-+#define DRV_NAME "pata_magicbox_cf"
-+#define DRV_VERSION "0.1.0"
-+
-+#define MAGICBOX_CF_REG_CMD (2 * ATA_REG_CMD)
-+#define MAGICBOX_CF_REG_DATA (2 * ATA_REG_DATA)
-+#define MAGICBOX_CF_REG_ERR (2 * ATA_REG_ERR)
-+#define MAGICBOX_CF_REG_FEATURE (2 * ATA_REG_FEATURE)
-+#define MAGICBOX_CF_REG_NSECT (2 * ATA_REG_NSECT)
-+#define MAGICBOX_CF_REG_LBAL (2 * ATA_REG_LBAL)
-+#define MAGICBOX_CF_REG_LBAM (2 * ATA_REG_LBAM)
-+#define MAGICBOX_CF_REG_LBAH (2 * ATA_REG_LBAH)
-+#define MAGICBOX_CF_REG_DEVICE (2 * ATA_REG_DEVICE)
-+#define MAGICBOX_CF_REG_STATUS (2 * ATA_REG_STATUS)
-+#define MAGICBOX_CF_REG_ALTSTATUS (2 * 6)
-+#define MAGICBOX_CF_REG_CTL (2 * 6)
-+
-+#define MAGICBOX_CF_MAXPORTS 1
-+
-+struct magicbox_cf_info {
-+ void __iomem *base;
-+ void __iomem *ctrl;
-+};
-+
-+static inline u8 magicbox_cf_inb(void __iomem *port)
-+{
-+ return (u8) (readw(port) >> 8) & 0xff;
-+}
-+
-+static inline void magicbox_cf_outb(void __iomem *port, u8 value)
-+{
-+ writew(value << 8, port);
-+}
-+
-+static int magicbox_cf_set_mode(struct ata_link *link,
-+ struct ata_device **error)
-+{
-+ struct ata_device *dev;
-+
-+ ata_for_each_dev(dev, link, ENABLED) {
-+ ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n");
-+ dev->pio_mode = XFER_PIO_0;
-+ dev->xfer_mode = XFER_PIO_0;
-+ dev->xfer_shift = ATA_SHIFT_PIO;
-+ dev->flags |= ATA_DFLAG_PIO;
-+ }
-+
-+ return 0;
-+}
-+
-+static void magicbox_cf_exec_command(struct ata_port *ap,
-+ const struct ata_taskfile *tf)
-+{
-+ DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
-+
-+ magicbox_cf_outb(ap->ioaddr.command_addr, tf->command);
-+ ata_sff_pause(ap);
-+}
-+
-+static u8 magicbox_cf_check_status(struct ata_port *ap)
-+{
-+ u8 status;
-+
-+ status = magicbox_cf_inb(ap->ioaddr.status_addr);
-+
-+ DPRINTK("ata%u: status 0x%X, from %p\n", ap->print_id, status,
-+ ap->ioaddr.status_addr);
-+
-+ return status;
-+}
-+
-+static u8 magicbox_cf_check_altstatus(struct ata_port *ap)
-+{
-+ u8 altstatus;
-+
-+ altstatus = magicbox_cf_inb(ap->ioaddr.altstatus_addr);
-+
-+ DPRINTK("ata%u: altstatus 0x%X, from %p\n", ap->print_id,
-+ altstatus, ap->ioaddr.altstatus_addr);
-+
-+ return altstatus;
-+}
-+
-+static void magicbox_cf_dev_select(struct ata_port *ap, unsigned int device)
-+{
-+ /* Nothing to do. We are supporting one device only. */
-+}
-+
-+static void magicbox_cf_tf_load(struct ata_port *ap,
-+ const struct ata_taskfile *tf)
-+{
-+ struct ata_ioports *ioaddr = &ap->ioaddr;
-+ unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
-+
-+ if (tf->ctl != ap->last_ctl) {
-+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl);
-+ ap->last_ctl = tf->ctl;
-+ ata_wait_idle(ap);
-+ }
-+
-+ if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
-+ magicbox_cf_outb(ioaddr->feature_addr, tf->hob_feature);
-+ magicbox_cf_outb(ioaddr->nsect_addr, tf->hob_nsect);
-+ magicbox_cf_outb(ioaddr->lbal_addr, tf->hob_lbal);
-+ magicbox_cf_outb(ioaddr->lbam_addr, tf->hob_lbam);
-+ magicbox_cf_outb(ioaddr->lbah_addr, tf->hob_lbah);
-+ VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
-+ tf->hob_feature,
-+ tf->hob_nsect,
-+ tf->hob_lbal,
-+ tf->hob_lbam,
-+ tf->hob_lbah);
-+ }
-+
-+ if (is_addr) {
-+ magicbox_cf_outb(ioaddr->feature_addr, tf->feature);
-+ magicbox_cf_outb(ioaddr->nsect_addr, tf->nsect);
-+ magicbox_cf_outb(ioaddr->lbal_addr, tf->lbal);
-+ magicbox_cf_outb(ioaddr->lbam_addr, tf->lbam);
-+ magicbox_cf_outb(ioaddr->lbah_addr, tf->lbah);
-+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-+ tf->feature,
-+ tf->nsect,
-+ tf->lbal,
-+ tf->lbam,
-+ tf->lbah);
-+ }
-+
-+ if (tf->flags & ATA_TFLAG_DEVICE) {
-+ magicbox_cf_outb(ioaddr->device_addr, tf->device);
-+ VPRINTK("device 0x%X\n", tf->device);
-+ }
-+
-+ ata_wait_idle(ap);
-+}
-+
-+static void magicbox_cf_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
-+{
-+ struct ata_ioports *ioaddr = &ap->ioaddr;
-+
-+ tf->command = magicbox_cf_inb(ap->ioaddr.status_addr);
-+ tf->feature = magicbox_cf_inb(ioaddr->error_addr);
-+ tf->nsect = magicbox_cf_inb(ioaddr->nsect_addr);
-+ tf->lbal = magicbox_cf_inb(ioaddr->lbal_addr);
-+ tf->lbam = magicbox_cf_inb(ioaddr->lbam_addr);
-+ tf->lbah = magicbox_cf_inb(ioaddr->lbah_addr);
-+ tf->device = magicbox_cf_inb(ioaddr->device_addr);
-+ VPRINTK("feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-+ tf->feature,
-+ tf->nsect,
-+ tf->lbal,
-+ tf->lbam,
-+ tf->lbah);
-+
-+ if (tf->flags & ATA_TFLAG_LBA48) {
-+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl | ATA_HOB);
-+ tf->hob_feature = magicbox_cf_inb(ioaddr->error_addr);
-+ tf->hob_nsect = magicbox_cf_inb(ioaddr->nsect_addr);
-+ tf->hob_lbal = magicbox_cf_inb(ioaddr->lbal_addr);
-+ tf->hob_lbam = magicbox_cf_inb(ioaddr->lbam_addr);
-+ tf->hob_lbah = magicbox_cf_inb(ioaddr->lbah_addr);
-+ magicbox_cf_outb(ioaddr->ctl_addr, tf->ctl);
-+ ap->last_ctl = tf->ctl;
-+ VPRINTK("hob: feat 0x%X nsect 0x%X lba 0x%X 0x%X 0x%X\n",
-+ tf->feature,
-+ tf->nsect,
-+ tf->lbal,
-+ tf->lbam,
-+ tf->lbah);
-+ }
-+}
-+
-+static unsigned int magicbox_cf_data_xfer(struct ata_device *dev,
-+ unsigned char *buf,
-+ unsigned int buflen, int rw)
-+{
-+ struct ata_port *ap = dev->link->ap;
-+ unsigned int words = buflen >> 1;
-+ unsigned int i;
-+ u16 *buf16 = (u16 *) buf;
-+ void __iomem *mmio = ap->ioaddr.data_addr;
-+
-+ /* Transfer multiple of 2 bytes */
-+ if (rw == READ)
-+ for (i = 0; i < words; i++)
-+ buf16[i] = readw(mmio);
-+ else
-+ for (i = 0; i < words; i++)
-+ writew(buf16[i], mmio);
-+
-+ /* Transfer trailing 1 byte, if any. */
-+ if (unlikely(buflen & 0x01)) {
-+ u16 align_buf[1] = { 0 };
-+ unsigned char *trailing_buf = buf + buflen - 1;
-+
-+ if (rw == READ) {
-+ align_buf[0] = readw(mmio);
-+ memcpy(trailing_buf, align_buf, 1);
-+ } else {
-+ memcpy(align_buf, trailing_buf, 1);
-+ writew(align_buf[0], mmio);
-+ }
-+ words++;
-+ }
-+
-+ return words << 1;
-+}
-+
-+static void magicbox_cf_irq_on(struct ata_port *ap)
-+{
-+ /* Nothing to do. */
-+}
-+
-+static void magicbox_cf_irq_clear(struct ata_port *ap)
-+{
-+ /* Nothing to do. */
-+}
-+
-+static struct ata_port_operations magicbox_cf_port_ops = {
-+ .inherits = &ata_sff_port_ops,
-+
-+ .cable_detect = ata_cable_40wire,
-+ .set_mode = magicbox_cf_set_mode,
-+
-+ .sff_exec_command = magicbox_cf_exec_command,
-+ .sff_check_status = magicbox_cf_check_status,
-+ .sff_check_altstatus = magicbox_cf_check_altstatus,
-+ .sff_dev_select = magicbox_cf_dev_select,
-+ .sff_tf_load = magicbox_cf_tf_load,
-+ .sff_tf_read = magicbox_cf_tf_read,
-+ .sff_data_xfer = magicbox_cf_data_xfer,
-+
-+ .sff_irq_on = magicbox_cf_irq_on,
-+ .sff_irq_clear = magicbox_cf_irq_clear,
-+
-+ .port_start = ATA_OP_NULL,
-+};
-+
-+static struct scsi_host_template magicbox_cf_sht = {
-+ ATA_PIO_SHT(DRV_NAME),
-+};
-+
-+static inline void magicbox_cf_setup_port(struct ata_host *host)
-+{
-+ struct magicbox_cf_info *info = host->private_data;
-+ struct ata_port *ap;
-+
-+ ap = host->ports[0];
-+
-+ ap->ops = &magicbox_cf_port_ops;
-+ ap->pio_mask = ATA_PIO4;
-+ ap->flags |= ATA_FLAG_NO_ATAPI;
-+
-+ ap->ioaddr.cmd_addr = info->base + MAGICBOX_CF_REG_CMD;
-+ ap->ioaddr.data_addr = info->base + MAGICBOX_CF_REG_DATA;
-+ ap->ioaddr.error_addr = info->base + MAGICBOX_CF_REG_ERR;
-+ ap->ioaddr.feature_addr = info->base + MAGICBOX_CF_REG_FEATURE;
-+ ap->ioaddr.nsect_addr = info->base + MAGICBOX_CF_REG_NSECT;
-+ ap->ioaddr.lbal_addr = info->base + MAGICBOX_CF_REG_LBAL;
-+ ap->ioaddr.lbam_addr = info->base + MAGICBOX_CF_REG_LBAM;
-+ ap->ioaddr.lbah_addr = info->base + MAGICBOX_CF_REG_LBAH;
-+ ap->ioaddr.device_addr = info->base + MAGICBOX_CF_REG_DEVICE;
-+ ap->ioaddr.status_addr = info->base + MAGICBOX_CF_REG_STATUS;
-+ ap->ioaddr.command_addr = info->base + MAGICBOX_CF_REG_CMD;
-+
-+ ap->ioaddr.altstatus_addr = info->ctrl + MAGICBOX_CF_REG_ALTSTATUS;
-+ ap->ioaddr.ctl_addr = info->ctrl + MAGICBOX_CF_REG_CTL;
-+
-+ ata_port_desc(ap, "cmd 0x%p ctl 0x%p", ap->ioaddr.cmd_addr,
-+ ap->ioaddr.ctl_addr);
-+}
-+
-+static int magicbox_cf_of_probe(struct platform_device *op)
-+{
-+ struct magicbox_cf_info *info;
-+ struct ata_host *host;
-+ int irq;
-+ int ret = 0;
-+
-+ info = kzalloc(sizeof(struct magicbox_cf_info), GFP_KERNEL);
-+ if (info == NULL) {
-+ ret = -ENOMEM;
-+ goto err_exit;
-+ }
-+
-+ irq = irq_of_parse_and_map(op->dev.of_node, 0);
-+ if (irq < 0) {
-+ dev_err(&op->dev, "invalid irq\n");
-+ ret = -EINVAL;
-+ goto err_free_info;
-+ }
-+
-+ info->base = of_iomap(op->dev.of_node, 0);
-+ if (info->base == NULL) {
-+ ret = -ENOMEM;
-+ goto err_free_info;
-+ }
-+
-+ info->ctrl = of_iomap(op->dev.of_node, 1);
-+ if (info->ctrl == NULL) {
-+ ret = -ENOMEM;
-+ goto err_unmap_base;
-+ }
-+
-+ host = ata_host_alloc(&op->dev, MAGICBOX_CF_MAXPORTS);
-+ if (host == NULL) {
-+ ret = -ENOMEM;
-+ goto err_unmap_ctrl;
-+ }
-+
-+ host->private_data = info;
-+ magicbox_cf_setup_port(host);
-+
-+ ret = ata_host_activate(host, irq, ata_sff_interrupt,
-+ IRQF_TRIGGER_RISING, &magicbox_cf_sht);
-+ if (ret)
-+ goto err_unmap_ctrl;
-+
-+ dev_set_drvdata(&op->dev, host);
-+ return 0;
-+
-+ err_unmap_ctrl:
-+ iounmap(info->ctrl);
-+ err_unmap_base:
-+ iounmap(info->base);
-+ err_free_info:
-+ kfree(info);
-+ err_exit:
-+ return ret;
-+}
-+
-+static int magicbox_cf_of_remove(struct platform_device *op)
-+{
-+ struct ata_host *host = dev_get_drvdata(&op->dev);
-+ struct magicbox_cf_info *info = host->private_data;
-+
-+ ata_host_detach(host);
-+ iounmap(info->ctrl);
-+ iounmap(info->base);
-+ kfree(info);
-+
-+ return 0;
-+}
-+
-+static struct of_device_id magicbox_cf_of_match[] = {
-+ { .compatible = "pata-magicbox-cf", },
-+ {},
-+};
-+
-+static struct platform_driver magicbox_cf_of_platform_driver = {
-+ .probe = magicbox_cf_of_probe,
-+ .remove = magicbox_cf_of_remove,
-+ .driver = {
-+ .name = DRV_NAME,
-+ .owner = THIS_MODULE,
-+ .of_match_table = magicbox_cf_of_match,
-+ },
-+};
-+
-+static int __init magicbox_cf_init(void)
-+{
-+ return platform_driver_register(&magicbox_cf_of_platform_driver);
-+}
-+
-+static void __exit magicbox_cf_exit(void)
-+{
-+ platform_driver_unregister(&magicbox_cf_of_platform_driver);
-+}
-+
-+module_init(magicbox_cf_init);
-+module_exit(magicbox_cf_exit);
-+
-+MODULE_DESCRIPTION(DRV_DESC);
-+MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
-+MODULE_LICENSE("GPL v2");
-+MODULE_VERSION(DRV_VERSION);
-+MODULE_DEVICE_TABLE(of, magicbox_cf_of_match);
+++ /dev/null
---- a/arch/powerpc/boot/dts/kilauea.dts
-+++ b/arch/powerpc/boot/dts/kilauea.dts
-@@ -102,8 +102,8 @@
- compatible = "ibm,sdram-405ex", "ibm,sdram-4xx-ddr2";
- dcr-reg = <0x010 0x002>;
- interrupt-parent = <&UIC2>;
-- interrupts = <0x5 0x4 /* ECC DED Error */
-- 0x6 0x4>; /* ECC SEC Error */
-+ interrupts = <0x5 0x4 /* ECC DED Error */
-+ 0x6 0x4>; /* ECC SEC Error */
- };
-
- CRYPTO: crypto@ef700000 {
-@@ -157,30 +157,30 @@
- reg = <0x00000000 0x00000000 0x04000000>;
- #address-cells = <1>;
- #size-cells = <1>;
-- partition@0 {
-+ partition0@0 {
- label = "kernel";
- reg = <0x00000000 0x001e0000>;
- };
-- partition@1e0000 {
-+ partition1@1e0000 {
- label = "dtb";
- reg = <0x001e0000 0x00020000>;
- };
-- partition@200000 {
-- label = "root";
-- reg = <0x00200000 0x00200000>;
-- };
-- partition@400000 {
-- label = "user";
-- reg = <0x00400000 0x03b60000>;
-+ partition2@200000 {
-+ label = "rootfs";
-+ reg = <0x00200000 0x03d60000>;
- };
-- partition@3f60000 {
-+ partition3@3f60000 {
- label = "env";
- reg = <0x03f60000 0x00040000>;
- };
-- partition@3fa0000 {
-+ partition4@3fa0000 {
- label = "u-boot";
- reg = <0x03fa0000 0x00060000>;
- };
-+ partition5@0 {
-+ label = "firmware";
-+ reg = <0x00000000 0x03f60000>;
-+ };
- };
-
- ndfc@1,0 {
+++ /dev/null
---- a/drivers/usb/host/isp116x-hcd.c
-+++ b/drivers/usb/host/isp116x-hcd.c
-@@ -1533,6 +1533,7 @@ static struct hc_driver isp116x_hc_drive
-
- /*----------------------------------------------------------------*/
-
-+#ifdef CONFIG_USB_ISP116X_HCD_PLATFORM
- static int isp116x_remove(struct platform_device *pdev)
- {
- struct usb_hcd *hcd = platform_get_drvdata(pdev);
-@@ -1711,4 +1712,251 @@ static struct platform_driver isp116x_dr
- },
- };
-
--module_platform_driver(isp116x_driver);
-+static inline int isp116x_platform_register(void)
-+{
-+ return platform_driver_register(&isp116x_driver);
-+}
-+
-+static inline void isp116x_platform_unregister(void)
-+{
-+ platform_driver_unregister(&isp116x_driver);
-+}
-+#else
-+static inline int isp116x_platform_register(void) { return 0; };
-+static void isp116x_platform_unregister(void) {};
-+#endif /* CONFIG_USB_ISP116X_PLATFORM */
-+
-+/*-----------------------------------------------------------------*/
-+
-+#ifdef CONFIG_USB_ISP116X_HCD_OF
-+
-+/* TODO: rework platform probe instead of using a separate probe */
-+
-+#include <linux/of_platform.h>
-+
-+#ifdef USE_PLATFORM_DELAY
-+static void isp116x_of_delay(struct device *ddev, int delay)
-+{
-+ ndelay(delay);
-+}
-+#else
-+#define isp116x_of_delay NULL
-+#endif
-+
-+static int isp116x_of_probe(struct platform_device *op)
-+{
-+ struct device_node *dn = op->dev.of_node;
-+ struct usb_hcd *hcd;
-+ struct isp116x *isp116x;
-+ struct resource addr, data;
-+ struct isp116x_platform_data *board;
-+ void __iomem *addr_reg;
-+ void __iomem *data_reg;
-+ int irq;
-+ int ret = 0;
-+ unsigned long irqflags;
-+
-+ ret = of_address_to_resource(dn, 0, &data);
-+ if (ret)
-+ return ret;
-+
-+ ret = of_address_to_resource(dn, 1, &addr);
-+ if (ret)
-+ return ret;
-+
-+ board = kzalloc(sizeof(struct isp116x_platform_data), GFP_KERNEL);
-+ if (board == NULL)
-+ return -ENOMEM;
-+
-+ if (!request_mem_region(addr.start, resource_size(&addr), hcd_name)) {
-+ ret = -EBUSY;
-+ goto err_free_board;
-+ }
-+
-+ addr_reg = ioremap_nocache(addr.start, resource_size(&addr));
-+ if (addr_reg == NULL) {
-+ ret = -ENOMEM;
-+ goto err_release_addr;
-+ }
-+
-+ if (!request_mem_region(data.start, resource_size(&data), hcd_name)) {
-+ ret = -EBUSY;
-+ goto err_unmap_addr;
-+ }
-+
-+ data_reg = ioremap_nocache(data.start, resource_size(&data));
-+ if (data_reg == NULL) {
-+ ret = -ENOMEM;
-+ goto err_release_data;
-+ }
-+
-+ irq = irq_of_parse_and_map(dn, 0);
-+ if (irq == NO_IRQ) {
-+ ret = -EINVAL;
-+ goto err_unmap_data;
-+ }
-+
-+ /* allocate and initialize hcd */
-+ hcd = usb_create_hcd(&isp116x_hc_driver, &op->dev, dev_name(&op->dev));
-+ if (!hcd) {
-+ ret = -ENOMEM;
-+ goto err_irq_dispose;
-+ }
-+
-+ /* this rsrc_start is bogus */
-+ hcd->rsrc_start = addr.start;
-+ isp116x = hcd_to_isp116x(hcd);
-+ isp116x->data_reg = data_reg;
-+ isp116x->addr_reg = addr_reg;
-+ isp116x->board = board;
-+ spin_lock_init(&isp116x->lock);
-+ INIT_LIST_HEAD(&isp116x->async);
-+
-+ board->delay = isp116x_of_delay;
-+ if (of_get_property(dn, "sel15Kres", NULL))
-+ board->sel15Kres = 1;
-+ if (of_get_property(dn, "oc_enable", NULL))
-+ board->oc_enable = 1;
-+ if (of_get_property(dn, "remote_wakeup_enable", NULL))
-+ board->remote_wakeup_enable = 1;
-+
-+ if (of_get_property(dn, "int_act_high", NULL))
-+ board->int_act_high = 1;
-+ if (of_get_property(dn, "int_edge_triggered", NULL))
-+ board->int_edge_triggered = 1;
-+
-+ if (board->int_edge_triggered)
-+ irqflags = board->int_act_high ? IRQF_TRIGGER_RISING :
-+ IRQF_TRIGGER_FALLING;
-+ else
-+ irqflags = board->int_act_high ? IRQF_TRIGGER_HIGH :
-+ IRQF_TRIGGER_LOW;
-+
-+ ret = usb_add_hcd(hcd, irq, irqflags | IRQF_DISABLED);
-+ if (ret)
-+ goto err_put_hcd;
-+
-+ ret = create_debug_file(isp116x);
-+ if (ret) {
-+ ERR("Couldn't create debugfs entry\n");
-+ goto err_remove_hcd;
-+ }
-+
-+ return 0;
-+
-+ err_remove_hcd:
-+ usb_remove_hcd(hcd);
-+ err_put_hcd:
-+ usb_put_hcd(hcd);
-+ err_irq_dispose:
-+ irq_dispose_mapping(irq);
-+ err_unmap_data:
-+ iounmap(data_reg);
-+ err_release_data:
-+ release_mem_region(data.start, resource_size(&data));
-+ err_unmap_addr:
-+ iounmap(addr_reg);
-+ err_release_addr:
-+ release_mem_region(addr.start, resource_size(&addr));
-+ err_free_board:
-+ kfree(board);
-+ return ret;
-+}
-+
-+static int isp116x_of_remove(struct platform_device *op)
-+{
-+ struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
-+ struct isp116x *isp116x;
-+ struct resource res;
-+
-+ if (!hcd)
-+ return 0;
-+
-+ dev_set_drvdata(&op->dev, NULL);
-+
-+ isp116x = hcd_to_isp116x(hcd);
-+ remove_debug_file(isp116x);
-+ usb_remove_hcd(hcd);
-+
-+ irq_dispose_mapping(hcd->irq);
-+
-+ iounmap(isp116x->data_reg);
-+ (void) of_address_to_resource(op->dev.of_node, 0, &res);
-+ release_mem_region(res.start, resource_size(&res));
-+
-+ iounmap(isp116x->addr_reg);
-+ (void) of_address_to_resource(op->dev.of_node, 1, &res);
-+ release_mem_region(res.start, resource_size(&res));
-+
-+ kfree(isp116x->board);
-+ usb_put_hcd(hcd);
-+
-+ return 0;
-+}
-+
-+static struct of_device_id isp116x_of_match[] = {
-+ { .compatible = "isp116x-hcd", },
-+ {},
-+};
-+
-+static struct platform_driver isp116x_of_platform_driver = {
-+ .probe = isp116x_of_probe,
-+ .remove = isp116x_of_remove,
-+ .driver = {
-+ .name = "isp116x-hcd-of",
-+ .owner = THIS_MODULE,
-+ .of_match_table = isp116x_of_match,
-+ },
-+};
-+
-+static int __init isp116x_of_register(void)
-+{
-+ return platform_driver_register(&isp116x_of_platform_driver);
-+}
-+
-+static void __exit isp116x_of_unregister(void)
-+{
-+ platform_driver_unregister(&isp116x_of_platform_driver);
-+}
-+
-+MODULE_DEVICE_TABLE(of, isp116x_of_match);
-+
-+#else
-+static inline int isp116x_of_register(void) { return 0; };
-+static void isp116x_of_unregister(void) {};
-+#endif /* CONFIG_USB_ISP116X_HCD_OF */
-+
-+/*-----------------------------------------------------------------*/
-+
-+static int __init isp116x_init(void)
-+{
-+ int ret;
-+
-+ if (usb_disabled())
-+ return -ENODEV;
-+
-+ INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
-+ ret = isp116x_platform_register();
-+ if (ret)
-+ return ret;
-+
-+ ret = isp116x_of_register();
-+ if (ret)
-+ goto err_platform_unregister;
-+
-+ return 0;
-+
-+ err_platform_unregister:
-+ isp116x_platform_unregister();
-+ return ret;
-+}
-+
-+module_init(isp116x_init);
-+
-+static void __exit isp116x_cleanup(void)
-+{
-+ isp116x_of_unregister();
-+ isp116x_platform_unregister();
-+}
-+
-+module_exit(isp116x_cleanup);
---- a/drivers/usb/host/Kconfig
-+++ b/drivers/usb/host/Kconfig
-@@ -327,6 +327,24 @@ config USB_ISP116X_HCD
- To compile this driver as a module, choose M here: the
- module will be called isp116x-hcd.
-
-+config USB_ISP116X_HCD_PLATFORM
-+ bool "ISP116X support for controllers on platform bus"
-+ depends on USB_ISP116X_HCD
-+ default n if PPC_OF
-+ default y
-+ ---help---
-+ Enables support for the ISP116x USB controller present on the
-+ platform bus.
-+
-+config USB_ISP116X_HCD_OF
-+ bool "ISP116X support for controllers on OF platform bus"
-+ depends on USB_ISP116X_HCD && PPC_OF
-+ default y if PPC_OF
-+ default n
-+ ---help---
-+ Enables support for the ISP116x USB controller present on the
-+ OpenFirmware platform bus.
-+
- config USB_ISP1760_HCD
- tristate "ISP 1760 HCD support"
- ---help---
+++ /dev/null
---- a/drivers/usb/host/isp116x.h
-+++ b/drivers/usb/host/isp116x.h
-@@ -354,21 +354,63 @@ struct isp116x_ep {
- #define isp116x_check_platform_delay(h) 0
- #endif
-
-+#ifdef CONFIG_PPC
-+static inline void isp116x_writew(u16 val, void __iomem *addr)
-+{
-+ writew(cpu_to_le16(val), addr);
-+}
-+
-+static inline u16 isp116x_readw(void __iomem *addr)
-+{
-+ return le16_to_cpu(readw(addr));
-+}
-+
-+static inline void isp116x_raw_writew(u16 val, void __iomem *addr)
-+{
-+ writew(cpu_to_le16(val), addr);
-+}
-+
-+static inline u16 isp116x_raw_readw(void __iomem *addr)
-+{
-+ return le16_to_cpu(readw(addr));
-+}
-+#else
-+static inline void isp116x_writew(u16 val, void __iomem *addr)
-+{
-+ writew(val, addr);
-+}
-+
-+static inline u16 isp116x_readw(void __iomem *addr)
-+{
-+ return readw(addr);
-+}
-+
-+static inline void isp116x_raw_writew(u16 val, void __iomem *addr)
-+{
-+ __raw_writew(val, addr);
-+}
-+
-+static inline u16 isp116x_raw_readw(void __iomem *addr)
-+{
-+ return __raw_readw(addr);
-+}
-+#endif
-+
- static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg)
- {
-- writew(reg & 0xff, isp116x->addr_reg);
-+ isp116x_writew(reg & 0xff, isp116x->addr_reg);
- isp116x_delay(isp116x, 300);
- }
-
- static inline void isp116x_write_data16(struct isp116x *isp116x, u16 val)
- {
-- writew(val, isp116x->data_reg);
-+ isp116x_writew(val, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- }
-
- static inline void isp116x_raw_write_data16(struct isp116x *isp116x, u16 val)
- {
-- __raw_writew(val, isp116x->data_reg);
-+ isp116x_raw_writew(val, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- }
-
-@@ -376,7 +418,7 @@ static inline u16 isp116x_read_data16(st
- {
- u16 val;
-
-- val = readw(isp116x->data_reg);
-+ val = isp116x_readw(isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- return val;
- }
-@@ -385,16 +427,16 @@ static inline u16 isp116x_raw_read_data1
- {
- u16 val;
-
-- val = __raw_readw(isp116x->data_reg);
-+ val = isp116x_raw_readw(isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- return val;
- }
-
- static inline void isp116x_write_data32(struct isp116x *isp116x, u32 val)
- {
-- writew(val & 0xffff, isp116x->data_reg);
-+ isp116x_writew(val & 0xffff, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
-- writew(val >> 16, isp116x->data_reg);
-+ isp116x_writew(val >> 16, isp116x->data_reg);
- isp116x_delay(isp116x, 150);
- }
-
-@@ -402,9 +444,9 @@ static inline u32 isp116x_read_data32(st
- {
- u32 val;
-
-- val = (u32) readw(isp116x->data_reg);
-+ val = (u32) isp116x_readw(isp116x->data_reg);
- isp116x_delay(isp116x, 150);
-- val |= ((u32) readw(isp116x->data_reg)) << 16;
-+ val |= ((u32) isp116x_readw(isp116x->data_reg)) << 16;
- isp116x_delay(isp116x, 150);
- return val;
- }
+++ /dev/null
-#
-# Copyright (C) 2007-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=powerpc
-BOARD:=ppc44x
-BOARDNAME:=AMCC/IBM PPC44x
-FEATURES:=squashfs broken
-CPU_TYPE:=440
-MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
-
-KERNEL_PATCHVER:=3.18
-
-define Target/Description
- Build firmware images for AMCC/IBM PPC44x based boards.
-endef
-
-include $(INCLUDE_DIR)/target.mk
-
-KERNELNAME:=uImage cuImage.taishan
-
-$(eval $(call BuildTarget))
+++ /dev/null
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K shutdown
-ttyS0::askfirst:/usr/libexec/login.sh
-ttyS1::askfirst:/usr/libexec/login.sh
+++ /dev/null
-# CONFIG_40x is not set
-CONFIG_440GX=y
-CONFIG_44x=y
-CONFIG_460EX=y
-CONFIG_4xx=y
-CONFIG_4xx_SOC=y
-# CONFIG_ADVANCED_OPTIONS is not set
-# CONFIG_ARCHES is not set
-CONFIG_ARCH_DMA_ADDR_T_64BIT=y
-CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
-CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_ILOG2_U32=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_WALK_MEMORY=y
-CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MAY_HAVE_PC_FDC=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
-# CONFIG_ARCH_RANDOM is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-CONFIG_AUDIT_ARCH=y
-# CONFIG_BAMBOO is not set
-# CONFIG_BLUESTONE is not set
-CONFIG_BOOKE=y
-CONFIG_BOOKE_WDT=y
-CONFIG_BOUNCE=y
-CONFIG_CANYONLANDS=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd"
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CONSISTENT_SIZE=0x00200000
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-# CONFIG_CRYPTO_SHA1_PPC is not set
-# CONFIG_DEFAULT_UIMAGE is not set
-CONFIG_DTC=y
-# CONFIG_E200 is not set
-CONFIG_EARLY_PRINTK=y
-# CONFIG_EBONY is not set
-# CONFIG_EIGER is not set
-# CONFIG_EPAPR_BOOT is not set
-CONFIG_EXTRA_TARGETS="uImage"
-# CONFIG_FSL_ULI1575 is not set
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_BUG=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-# CONFIG_GENERIC_CSUM is not set
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_ISA_DMA=y
-CONFIG_GENERIC_NVRAM=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-# CONFIG_GENERIC_TBSYNC is not set
-CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_GE_FPGA is not set
-# CONFIG_GLACIER is not set
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAS_RAPIDIO is not set
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IOREMAP_PROT=y
-CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
-CONFIG_HAVE_LATENCYTOP_SUPPORT=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HW_RANDOM=y
-CONFIG_HZ=250
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_IBM_EMAC=y
-CONFIG_IBM_EMAC_EMAC4=y
-CONFIG_IBM_EMAC_POLL_WEIGHT=32
-CONFIG_IBM_EMAC_RGMII=y
-CONFIG_IBM_EMAC_RXB=128
-CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256
-CONFIG_IBM_EMAC_RX_SKB_HEADROOM=0
-CONFIG_IBM_EMAC_TAH=y
-CONFIG_IBM_EMAC_TXB=128
-CONFIG_IBM_EMAC_ZMII=y
-# CONFIG_ICON is not set
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_IOMMU_HELPER is not set
-# CONFIG_IPIC is not set
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_ISA_DMA_API=y
-# CONFIG_KATMAI is not set
-CONFIG_KERNEL_START=0xc0000000
-CONFIG_LIBFDT=y
-CONFIG_LOWMEM_SIZE=0x30000000
-# CONFIG_MATH_EMULATION is not set
-# CONFIG_MMIO_NVRAM is not set
-CONFIG_MODULES_USE_ELF_RELA=y
-# CONFIG_MPIC is not set
-# CONFIG_MPIC_U3_HT_IRQS is not set
-# CONFIG_MPIC_WEIRD is not set
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-# CONFIG_MTD_CFI_GEOMETRY is not set
-CONFIG_MTD_SPLIT_FIRMWARE=y
-CONFIG_MTD_SPLIT_UIMAGE_FW=y
-CONFIG_NEED_DMA_MAP_STATE=y
-# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NEED_SG_DMA_LENGTH=y
-# CONFIG_NONSTATIC_KERNEL is not set
-CONFIG_NOT_COHERENT_CACHE=y
-CONFIG_NR_IRQS=512
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND=y
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PAGE_OFFSET=0xc0000000
-CONFIG_PCI=y
-CONFIG_PCIEAER=y
-CONFIG_PCIEPORTBUS=y
-CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
-CONFIG_PCI_DOMAINS=y
-CONFIG_PCI_MSI=y
-CONFIG_PHYSICAL_START=0x00000000
-CONFIG_PHYS_64BIT=y
-CONFIG_PHYS_ADDR_T_64BIT=y
-CONFIG_PPC=y
-CONFIG_PPC32=y
-CONFIG_PPC44x_SIMPLE=y
-# CONFIG_PPC4xx_HSTA_MSI is not set
-CONFIG_PPC4xx_MSI=y
-# CONFIG_PPC4xx_OCM is not set
-CONFIG_PPC4xx_PCI_EXPRESS=y
-# CONFIG_PPC64 is not set
-# CONFIG_PPC_47x is not set
-# CONFIG_PPC_85xx is not set
-# CONFIG_PPC_8xx is not set
-# CONFIG_PPC_970_NAP is not set
-CONFIG_PPC_ADV_DEBUG_DACS=2
-CONFIG_PPC_ADV_DEBUG_DAC_RANGE=y
-CONFIG_PPC_ADV_DEBUG_DVCS=2
-CONFIG_PPC_ADV_DEBUG_IACS=4
-CONFIG_PPC_ADV_DEBUG_REGS=y
-# CONFIG_PPC_BOOK3S_32 is not set
-# CONFIG_PPC_CELL is not set
-# CONFIG_PPC_CELL_NATIVE is not set
-# CONFIG_PPC_COPRO_BASE is not set
-CONFIG_PPC_DCR=y
-# CONFIG_PPC_DCR_MMIO is not set
-CONFIG_PPC_DCR_NATIVE=y
-# CONFIG_PPC_DOORBELL is not set
-# CONFIG_PPC_EARLY_DEBUG is not set
-# CONFIG_PPC_EPAPR_HV_PIC is not set
-CONFIG_PPC_FPU=y
-# CONFIG_PPC_I8259 is not set
-# CONFIG_PPC_ICP_HV is not set
-# CONFIG_PPC_ICP_NATIVE is not set
-# CONFIG_PPC_ICS_RTAS is not set
-CONFIG_PPC_INDIRECT_PCI=y
-CONFIG_PPC_MMU_NOHASH=y
-# CONFIG_PPC_MM_SLICES is not set
-# CONFIG_PPC_MPC106 is not set
-CONFIG_PPC_MSI_BITMAP=y
-CONFIG_PPC_OF=y
-# CONFIG_PPC_P7_NAP is not set
-CONFIG_PPC_PCI_CHOICE=y
-# CONFIG_PPC_RTAS is not set
-CONFIG_PPC_UDBG_16550=y
-CONFIG_PPC_WERROR=y
-# CONFIG_PPC_XICS is not set
-# CONFIG_PQ2ADS is not set
-# CONFIG_PREEMPT_RCU is not set
-CONFIG_PTE_64BIT=y
-# CONFIG_RAINIER is not set
-CONFIG_RAS=y
-# CONFIG_RCU_STALL_COMMON is not set
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-# CONFIG_SAM440EP is not set
-CONFIG_SCHED_HRTICK=y
-# CONFIG_SCSI_DMA is not set
-# CONFIG_SEQUOIA is not set
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_FSL=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_OF_PLATFORM=y
-CONFIG_SPARSE_IRQ=y
-# CONFIG_SWIOTLB is not set
-CONFIG_SYSCTL_EXCEPTION_TRACE=y
-CONFIG_TAISHAN=y
-CONFIG_TASK_SIZE=0xc0000000
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_USB_SUPPORT=y
-# CONFIG_WARP is not set
-CONFIG_WORD_SIZE=32
-# CONFIG_XILINX_SYSACE is not set
-# CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_XZ_DEC_POWERPC=y
-# CONFIG_YOSEMITE is not set
+++ /dev/null
-#
-# Copyright (C) 2007-2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-JFFS2_BLOCKSIZE=256k
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-
-define Image/Prepare
- $(LINUX_DIR)/scripts/dtc/dtc -O dtb -R 4 -S 0x20000 $(DTS_DIR)/canyonlands.dts > $(KDIR)/openwrt-canyonlands.dtb
-endef
-
-define Image/BuildKernel
- cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
-endef
-
-define Image/Build
- $(call Image/Build/$(1),$(1))
-endef
-
-define Image/Build/jffs2-256k
- ( \
- dd if=$(KDIR)/uImage bs=2048k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-jffs2.img
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
- ( \
- dd if=$(KDIR)/cuImage.taishan bs=256k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-taishan-$(1).img
- ( \
- dd if=$(KDIR)/uImage bs=1920k conv=sync; \
- dd if=$(KDIR)/openwrt-canyonlands.dtb bs=128k conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
- ) > $(BIN_DIR)/$(IMG_PREFIX)-canyonlands-$(1).img
-endef
-
-$(eval $(call BuildImage))
+++ /dev/null
-From 1eb8a1b340e2f0a562b4987683bbaee4d620bf0a Mon Sep 17 00:00:00 2001
-From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Date: Mon, 9 Mar 2015 13:35:39 -0700
-Subject: [PATCH] crypto: amcc - remove incorrect __init/__exit markups
-
-Even if bus is not hot-pluggable, the devices can be bound and unbound
-from the driver via sysfs, so we should not be using __init/__exit
-annotations on probe() and remove() methods. The only exception is
-drivers registered with platform_driver_probe() which specifically
-disables sysfs bind/unbind attributes.
-
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- drivers/crypto/amcc/crypto4xx_core.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/crypto/amcc/crypto4xx_core.c
-+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1155,7 +1155,7 @@ struct crypto4xx_alg_common crypto4xx_al
- /**
- * Module Initialization Routine
- */
--static int __init crypto4xx_probe(struct platform_device *ofdev)
-+static int crypto4xx_probe(struct platform_device *ofdev)
- {
- int rc;
- struct resource res;
-@@ -1263,7 +1263,7 @@ err_alloc_dev:
- return rc;
- }
-
--static int __exit crypto4xx_remove(struct platform_device *ofdev)
-+static int crypto4xx_remove(struct platform_device *ofdev)
- {
- struct device *dev = &ofdev->dev;
- struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
-@@ -1292,7 +1292,7 @@ static struct platform_driver crypto4xx_
- .of_match_table = crypto4xx_match,
- },
- .probe = crypto4xx_probe,
-- .remove = __exit_p(crypto4xx_remove),
-+ .remove = crypto4xx_remove,
- };
-
- module_platform_driver(crypto4xx_driver);
+++ /dev/null
---- a/arch/powerpc/boot/dts/taishan.dts
-+++ b/arch/powerpc/boot/dts/taishan.dts
-@@ -194,16 +194,12 @@
- #address-cells = <1>;
- #size-cells = <1>;
- partition@0 {
-- label = "kernel";
-- reg = <0x0 0x180000>;
-+ label = "firmware";
-+ reg = <0x0 0x3e00000>;
- };
-- partition@180000 {
-- label = "root";
-- reg = <0x180000 0x200000>;
-- };
-- partition@380000 {
-- label = "user";
-- reg = <0x380000 0x3bc0000>;
-+ partition@3e00000 {
-+ label = "diagnostics";
-+ reg = <0x3e00000 0x140000>;
- };
- partition@3f40000 {
- label = "env";
---- a/arch/powerpc/boot/dts/canyonlands.dts
-+++ b/arch/powerpc/boot/dts/canyonlands.dts
-@@ -222,24 +222,12 @@
- #address-cells = <1>;
- #size-cells = <1>;
- partition@0 {
-- label = "kernel";
-- reg = <0x00000000 0x001e0000>;
-- };
-- partition@1e0000 {
-- label = "dtb";
-- reg = <0x001e0000 0x00020000>;
-+ label = "kernel+dtb";
-+ reg = <0x00000000 0x00200000>;
- };
- partition@200000 {
-- label = "ramdisk";
-- reg = <0x00200000 0x01400000>;
-- };
-- partition@1600000 {
-- label = "jffs2";
-- reg = <0x01600000 0x00400000>;
-- };
-- partition@1a00000 {
-- label = "user";
-- reg = <0x01a00000 0x02560000>;
-+ label = "rootfs";
-+ reg = <0x00200000 0x03d60000>;
- };
- partition@3f60000 {
- label = "env";
+++ /dev/null
---- a/arch/powerpc/boot/dts/taishan.dts
-+++ b/arch/powerpc/boot/dts/taishan.dts
-@@ -419,5 +419,6 @@
-
- chosen {
- linux,stdout-path = "/plb/opb/serial@40000300";
-+ bootargs = "rootfstype=squashfs noinitrd";
- };
- };
+++ /dev/null
-From: Jo-Philipp Wich <jo@mein.io>
-Date: Wed, 4 Jan 2017 10:35:00 +0100
-Subject: [PATCH] powerpc: boot: fix build with parallel make
-
-The powerpc boot wrapper Makefile is not parallel build safe, causing fixdep
-to fail reading dependency files of the addnote, hack-coff and mktree
-utilities when concurrently building different image targets.
-
-A typical failure looks like:
-
- Building modules, stage 2.
- HOSTCC arch/powerpc/boot/addnote
- HOSTCC arch/powerpc/boot/hack-coff
- DTC arch/powerpc/boot/taishan.dtb
- HOSTCC arch/powerpc/boot/addnote
- HOSTCC arch/powerpc/boot/hack-coff
- MODPOST 800 modules
- fixdep: error opening depfile: arch/powerpc/boot/.hack-coff.d: No such file or directory
- scripts/Makefile.host:91: recipe for target 'arch/powerpc/boot/hack-coff' failed
- make[5]: *** [arch/powerpc/boot/hack-coff] Error 2
- make[5]: *** Waiting for unfinished jobs....
- fixdep: error opening depfile: arch/powerpc/boot/.addnote.d: No such file or directory
- scripts/Makefile.host:91: recipe for target 'arch/powerpc/boot/addnote' failed
- make[5]: *** [arch/powerpc/boot/addnote] Error 2
- rm arch/powerpc/boot/taishan.dtb
- arch/powerpc/Makefile:263: recipe for target 'cuImage.taishan' failed
- make[4]: *** [cuImage.taishan] Error 2
- make[4]: *** Waiting for unfinished jobs....
-
-Add a GNU make specific .NOTPARALLEL pseudo rule to enforce sequential building
-of the addnote, hack-coff and mktree executables.
-
-Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-
---- a/arch/powerpc/boot/Makefile
-+++ b/arch/powerpc/boot/Makefile
-@@ -194,6 +194,8 @@ wrapper :=$(srctree)/$(src)/wrapper
- wrapperbits := $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
- $(wrapper) FORCE
-
-+.NOTPARALLEL: $(addprefix $(obj)/,addnote hack-coff mktree) $(wrapper)
-+
- #############
- # Bits for building various flavours of zImage
-
+++ /dev/null
-#
-# Copyright (C) 2009-2011 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:=xburst
-BOARDNAME:=Ingenic XBurst
-FEATURES:=targz nand ubifs audio
-SUBTARGETS:=qi_lb60
-
-KERNEL_PATCHVER:=3.18
-
-DEVICE_TYPE:=other
-
-define Target/Description
- Build firmware images for XBurst JZ47x0 based boards.
-endef
-
-include $(INCLUDE_DIR)/target.mk
-
-$(eval $(call BuildTarget))
+++ /dev/null
-#!/bin/sh
-
-. /lib/functions/uci-defaults.sh
-
-board_config_update
-
-ucidef_set_hostname "BenNanoNote"
-ucidef_set_ntpserver
-
-board_config_flush
-
-exit 0
+++ /dev/null
-config mount
- option target /card
- option device /dev/mmcblk0p1
- option fstype auto
- option options rw,sync
- option enabled 1
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-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 usb0
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
+++ /dev/null
-CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
-CONFIG_ARCH_DISCARD_MEMBLOCK=y
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-# CONFIG_ARCH_HAS_SG_CHAIN is not set
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-# CONFIG_BACKLIGHT_ADP8860 is not set
-# CONFIG_BACKLIGHT_ADP8870 is not set
-CONFIG_BACKLIGHT_CLASS_DEVICE=y
-# CONFIG_BACKLIGHT_GENERIC is not set
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-# CONFIG_BACKLIGHT_PWM is not set
-CONFIG_BATTERY_JZ4740=y
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CHARGER_GPIO=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CONFIGFS_FS=y
-CONFIG_CONSOLE_TRANSLATIONS=y
-CONFIG_CPU_GENERIC_DUMP_TLB=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_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y
-CONFIG_CPU_R4K_CACHE_TLB=y
-CONFIG_CPU_R4K_FPU=y
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-CONFIG_CRC16=y
-CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_DEFLATE=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
-CONFIG_CRYPTO_LZO=y
-CONFIG_CRYPTO_RNG2=y
-CONFIG_CRYPTO_WORKQUEUE=y
-CONFIG_DMADEVICES=y
-CONFIG_DMA_ENGINE=y
-CONFIG_DMA_JZ4740=y
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_DMA_VIRTUAL_CHANNELS=y
-CONFIG_DUMMY_CONSOLE=y
-# CONFIG_DW_DMAC_CORE is not set
-CONFIG_EARLY_PRINTK=y
-CONFIG_ENABLE_MUST_CHECK=y
-CONFIG_EXT4_FS=y
-CONFIG_FAT_FS=y
-CONFIG_FB=y
-CONFIG_FB_CMDLINE=y
-CONFIG_FB_JZ4740=y
-CONFIG_FB_SYS_COPYAREA=y
-CONFIG_FB_SYS_FILLRECT=y
-CONFIG_FB_SYS_IMAGEBLIT=y
-CONFIG_FONTS=y
-# CONFIG_FONT_10x18 is not set
-# CONFIG_FONT_6x10 is not set
-CONFIG_FONT_6x11=y
-# CONFIG_FONT_7x14 is not set
-# CONFIG_FONT_8x16 is not set
-# CONFIG_FONT_8x8 is not set
-# CONFIG_FONT_ACORN_8x8 is not set
-# CONFIG_FONT_MINI_4x6 is not set
-# CONFIG_FONT_PEARL_8x8 is not set
-# CONFIG_FONT_SUN12x22 is not set
-# CONFIG_FONT_SUN8x16 is not set
-CONFIG_FONT_SUPPORT=y
-CONFIG_FORCE_MAX_ZONEORDER=12
-CONFIG_FRAMEBUFFER_CONSOLE=y
-# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
-# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
-CONFIG_FREEZER=y
-CONFIG_FS_MBCACHE=y
-CONFIG_GENERIC_ATOMIC64=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_CMOS_UPDATE=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_CHIP=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_HARDWARE_WATCHPOINTS=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT_MAP=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=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_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_KERNEL_BZIP2=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZ4=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HW_CONSOLE=y
-CONFIG_HZ_PERIODIC=y
-CONFIG_I2C=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_INPUT=y
-CONFIG_INPUT_EVDEV=y
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_INPUT_MATRIXKMAP=y
-CONFIG_INPUT_MOUSE=y
-CONFIG_INPUT_MOUSEDEV=y
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-CONFIG_INPUT_PWM_BEEPER=y
-CONFIG_INPUT_UINPUT=y
-CONFIG_IRQ_CPU=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-CONFIG_JBD2=y
-CONFIG_JZ4740_QI_LB60=y
-CONFIG_KALLSYMS=y
-CONFIG_KEXEC=y
-CONFIG_KEYBOARD_GPIO=y
-CONFIG_KEYBOARD_MATRIX=y
-# CONFIG_LCD_AMS369FG06 is not set
-CONFIG_LCD_CLASS_DEVICE=y
-CONFIG_LCD_ILI8960=y
-# CONFIG_LCD_L4F00242T03 is not set
-# CONFIG_LCD_LD9040 is not set
-# CONFIG_LCD_LMS283GF05 is not set
-# CONFIG_LCD_LTV350QV is not set
-# CONFIG_LCD_PLATFORM is not set
-# CONFIG_LCD_S6E63M0 is not set
-# CONFIG_LCD_TDO24M is not set
-# CONFIG_LCD_VGG2432A4 is not set
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=2
-CONFIG_LZO_COMPRESS=y
-CONFIG_LZO_DECOMPRESS=y
-CONFIG_MACH_JZ4740=y
-CONFIG_MFD_CORE=y
-CONFIG_MFD_JZ4740_ADC=y
-CONFIG_MIPS=y
-# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-# CONFIG_MIPS_MACHINE is not set
-CONFIG_MMC=y
-CONFIG_MMC_BLOCK=y
-# CONFIG_MMC_BLOCK_BOUNCE is not set
-CONFIG_MMC_JZ4740=y
-CONFIG_MODULES_USE_ELF_REL=y
-# CONFIG_MOUSE_BCM5974 is not set
-# CONFIG_MOUSE_CYAPA is not set
-# CONFIG_MOUSE_PS2 is not set
-# CONFIG_MOUSE_SERIAL is not set
-# CONFIG_MOUSE_VSXXXAA is not set
-# CONFIG_MTD_CFI is not set
-# CONFIG_MTD_COMPLEX_MAPPINGS is not set
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_ECC=y
-CONFIG_MTD_NAND_JZ4740=y
-CONFIG_MTD_UBI=y
-CONFIG_MTD_UBI_BEB_LIMIT=20
-# CONFIG_MTD_UBI_BLOCK is not set
-# CONFIG_MTD_UBI_FASTMAP is not set
-# CONFIG_MTD_UBI_GLUEBI is not set
-CONFIG_MTD_UBI_WL_THRESHOLD=4096
-CONFIG_MUSB_PIO_ONLY=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NLS=y
-CONFIG_NLS_ASCII=y
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
-CONFIG_NLS_CODEPAGE_437=y
-CONFIG_NLS_CODEPAGE_737=y
-CONFIG_NLS_CODEPAGE_775=y
-CONFIG_NLS_CODEPAGE_850=y
-CONFIG_NLS_CODEPAGE_852=y
-CONFIG_NLS_CODEPAGE_855=y
-CONFIG_NLS_CODEPAGE_857=y
-CONFIG_NLS_CODEPAGE_860=y
-CONFIG_NLS_CODEPAGE_861=y
-CONFIG_NLS_CODEPAGE_862=y
-CONFIG_NLS_CODEPAGE_863=y
-CONFIG_NLS_CODEPAGE_864=y
-CONFIG_NLS_CODEPAGE_865=y
-CONFIG_NLS_CODEPAGE_866=y
-CONFIG_NLS_CODEPAGE_869=y
-CONFIG_NLS_CODEPAGE_874=y
-CONFIG_NLS_CODEPAGE_932=y
-CONFIG_NLS_CODEPAGE_936=y
-CONFIG_NLS_CODEPAGE_949=y
-CONFIG_NLS_CODEPAGE_950=y
-CONFIG_NLS_ISO8859_1=y
-CONFIG_NLS_ISO8859_13=y
-CONFIG_NLS_ISO8859_14=y
-CONFIG_NLS_ISO8859_15=y
-CONFIG_NLS_ISO8859_2=y
-CONFIG_NLS_ISO8859_3=y
-CONFIG_NLS_ISO8859_4=y
-CONFIG_NLS_ISO8859_5=y
-CONFIG_NLS_ISO8859_6=y
-CONFIG_NLS_ISO8859_7=y
-CONFIG_NLS_ISO8859_8=y
-CONFIG_NLS_ISO8859_9=y
-CONFIG_NLS_KOI8_R=y
-CONFIG_NLS_KOI8_U=y
-CONFIG_NLS_UTF8=y
-CONFIG_NOP_USB_XCEIV=y
-# CONFIG_NO_IOPORT_MAP is not set
-CONFIG_PAGEFLAGS_EXTENDED=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PM=y
-CONFIG_PM_CLK=y
-# CONFIG_PM_DEBUG is not set
-CONFIG_PM_SLEEP=y
-CONFIG_POWER_SUPPLY=y
-CONFIG_PREEMPT=y
-CONFIG_PREEMPT_COUNT=y
-# CONFIG_PREEMPT_NONE is not set
-CONFIG_PREEMPT_RCU=y
-CONFIG_PRINTK_TIME=y
-CONFIG_PWM=y
-CONFIG_PWM_JZ4740=y
-CONFIG_PWM_SYSFS=y
-# CONFIG_RCU_BOOST is not set
-CONFIG_RCU_CPU_STALL_VERBOSE=y
-CONFIG_RCU_STALL_COMMON=y
-CONFIG_REGMAP=y
-CONFIG_REGMAP_I2C=y
-CONFIG_REGMAP_MMIO=y
-CONFIG_REGMAP_SPI=y
-CONFIG_RTC_CLASS=y
-# CONFIG_RTC_DRV_CMOS is not set
-CONFIG_RTC_DRV_JZ4740=y
-# CONFIG_SCSI_DMA is not set
-CONFIG_SERIO=y
-CONFIG_SERIO_LIBPS2=y
-CONFIG_SND=y
-CONFIG_SND_COMPRESS_OFFLOAD=y
-CONFIG_SND_DMAENGINE_PCM=y
-# CONFIG_SND_EMU10K1_SEQ is not set
-CONFIG_SND_JACK=y
-CONFIG_SND_JZ4740_SOC=y
-CONFIG_SND_JZ4740_SOC_I2S=y
-CONFIG_SND_JZ4740_SOC_QI_LB60=y
-# CONFIG_SND_OPL3_LIB_SEQ is not set
-# CONFIG_SND_OPL4_LIB_SEQ is not set
-CONFIG_SND_PCM=y
-# CONFIG_SND_RAWMIDI_SEQ is not set
-# CONFIG_SND_SBAWE_SEQ is not set
-CONFIG_SND_SOC=y
-# CONFIG_SND_SOC_FSL_SSI is not set
-CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
-CONFIG_SND_SOC_I2C_AND_SPI=y
-# CONFIG_SND_SOC_IMX_AUDMUX is not set
-CONFIG_SND_SOC_JZ4740_CODEC=y
-CONFIG_SND_TIMER=y
-CONFIG_SOUND=y
-# CONFIG_SOUND_OSS_CORE is not set
-CONFIG_SPI=y
-CONFIG_SPI_BITBANG=y
-CONFIG_SPI_GPIO=y
-CONFIG_SPI_MASTER=y
-# CONFIG_SQUASHFS is not set
-# CONFIG_STAGING is not set
-CONFIG_SUSPEND=y
-CONFIG_SUSPEND_FREEZER=y
-# CONFIG_SYN_COOKIES is not set
-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_SYS_SUPPORTS_ZBOOT=y
-CONFIG_SYS_SUPPORTS_ZBOOT_UART16550=y
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_TREE_PREEMPT_RCU=y
-CONFIG_UBIFS_FS=y
-CONFIG_UBIFS_FS_ADVANCED_COMPR=y
-CONFIG_UBIFS_FS_LZO=y
-CONFIG_UBIFS_FS_ZLIB=y
-CONFIG_UNINLINE_SPIN_UNLOCK=y
-CONFIG_USB=y
-# CONFIG_USB_AUDIO is not set
-CONFIG_USB_COMMON=y
-# CONFIG_USB_EHCI_HCD is not set
-CONFIG_USB_ETH=y
-# CONFIG_USB_ETH_EEM is not set
-# CONFIG_USB_ETH_RNDIS is not set
-CONFIG_USB_F_ECM=y
-CONFIG_USB_F_SUBSET=y
-CONFIG_USB_GADGET=y
-CONFIG_USB_LIBCOMPOSITE=y
-# CONFIG_USB_MUSB_DUAL_ROLE is not set
-CONFIG_USB_MUSB_GADGET=y
-CONFIG_USB_MUSB_HDRC=y
-# CONFIG_USB_MUSB_HOST is not set
-CONFIG_USB_MUSB_JZ4740=y
-# CONFIG_USB_MUSB_TUSB6010 is not set
-# CONFIG_USB_MUSB_UX500 is not set
-CONFIG_USB_OTG_BLACKLIST_HUB=y
-CONFIG_USB_PHY=y
-CONFIG_USB_SUPPORT=y
-CONFIG_USB_U_ETHER=y
-CONFIG_VFAT_FS=y
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_VT_CONSOLE_SLEEP=y
-CONFIG_VT_HW_CONSOLE_BINDING=y
-# CONFIG_WATCHDOG is not set
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZONE_DMA_FLAG=0
+++ /dev/null
-#
-# Copyright (C) 2009-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-JFFS2_BLOCKSIZE=256k 512k
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-ifneq ($(CONFIG_TARGET_xburst_qi_lb60),)
-UBI_OPTS = -m 4096 -p 512KiB
-UBIFS_OPTS = -m 4096 -e 516096 -c 4095
-else
-UBI_OPTS = -m 2048 -p 128KiB -s 512
-UBIFS_OPTS = -m 2048 -e 126KiB -c 4096
-endif
-
-UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage.bin
-
-define MkImageGzip
- gzip -9n -c $(1) > $(1).gz
- mkimage -A mips -O linux -T kernel -a 0x80010000 -C gzip \
- -e 0x80010000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
- -d $(1).gz $(2)
-endef
-
-define Image/Prepare
- $(call MkImageGzip,$(KDIR)/vmlinux,$(KDIR)/uimage)
-endef
-
-define Image/BuildKernel
- cp $(KDIR)/uimage $(UIMAGE)
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
-endef
-
-define Image/Build
- dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
-endef
-
-$(eval $(call BuildImage))
+++ /dev/null
-[rootfs]
-# Volume mode (other option is static)
-mode=ubi
-# Source image
-image=root.ubifs
-# Volume ID in UBI image
-vol_id=0
-# Allow for dynamic resize
-vol_type=dynamic
-# Volume name
-vol_name=rootfs
-# Autoresize volume at first mount
-vol_flags=autoresize
-
+++ /dev/null
-
-
-SOUND_MENU:=Sound Support
-
-define KernelPackage/sound-soc-jz4740
- SUBMENU:=$(SOUND_MENU)
- DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN
- TITLE:=JZ4740 SoC sound support
- KCONFIG:=CONFIG_SND_JZ4740_SOC CONFIG_SND_JZ4740_SOC_I2S
- FILES:= \
- $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740.ko \
- $(LINUX_DIR)/sound/soc/jz4740/snd-soc-jz4740-i2s.ko
- AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740 snd-soc-jz4740-i2s)
-endef
-
-define KernelPackage/sound-soc-jz4740-codec
- SUBMENU:=$(SOUND_MENU)
- DEPENDS:=kmod-sound-soc-core @TARGET_xburst @BROKEN
- TITLE:=JZ4740 SoC internal codec support
- KCONFIG:=CONFIG_SND_SOC_JZ4740_CODEC
- FILES:=$(LINUX_DIR)/sound/soc/codecs/snd-soc-jz4740-codec.ko
- AUTOLOAD:=$(call AutoLoad,60,snd-soc-jz4740-codec)
-endef
-
-define KernelPackage/sound-soc-xburst/default
- SUBMENU:=$(SOUND_MENU)
- DEPENDS:=kmod-sound-soc-jz4740 kmod-sound-soc-jz4740-codec @TARGET_xburst_$(if $(4),$(4),$(3)) @BROKEN
- TITLE:=$(1) sound support
- KCONFIG:=CONFIG_SND_JZ4740_SOC_$(2)
- FILES:=$(LINUX_DIR)/sound/soc/jz4740/snd-soc-$(3).ko
- AUTOLOAD:=$(call AutoLoad,65,snd-soc-$(3))
-endef
-
-define KernelPackage/sound-soc-qilb60
-$(call KernelPackage/sound-soc-xburst/default,QI NanoNote,QI_LB60,qi-lb60,qi_lb60)
-endef
-
-$(eval $(call KernelPackage,sound-soc-jz4740))
-$(eval $(call KernelPackage,sound-soc-jz4740-codec))
-$(eval $(call KernelPackage,sound-soc-qilb60))
+++ /dev/null
-From b0eb5175e0de3e5134a36a7da382d8811562af12 Mon Sep 17 00:00:00 2001
-From: Lars-Peter Clausen <lars@metafoo.de>
-Date: Tue, 15 Mar 2011 12:49:15 +0100
-Subject: [PATCH 1/7] ubi: Read only the vid header instead of the whole page
-
----
- drivers/mtd/ubi/io.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/mtd/ubi/io.c
-+++ b/drivers/mtd/ubi/io.c
-@@ -1014,7 +1014,7 @@ int ubi_io_read_vid_hdr(struct ubi_devic
-
- p = (char *)vid_hdr - ubi->vid_hdr_shift;
- read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
-- ubi->vid_hdr_alsize);
-+ UBI_VID_HDR_SIZE + ubi->vid_hdr_shift);
- if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
- return read_err;
-
+++ /dev/null
-From 98d33db1c87e2447b9b203399d2f995e05ecdb52 Mon Sep 17 00:00:00 2001
-From: Lars-Peter Clausen <lars@metafoo.de>
-Date: Sat, 26 Feb 2011 15:30:07 +0100
-Subject: [PATCH 2/7] NAND: Optimize NAND_ECC_HW_OOB_FIRST read
-
-Avoid sending unnecessary READ commands to the chip.
----
- drivers/mtd/nand/nand_base.c | 17 +++++++++++++----
- 1 file changed, 13 insertions(+), 4 deletions(-)
-
---- a/drivers/mtd/nand/nand_base.c
-+++ b/drivers/mtd/nand/nand_base.c
-@@ -1360,9 +1360,16 @@ static int nand_read_page_hwecc_oob_firs
- unsigned int max_bitflips = 0;
-
- /* Read the OOB area first */
-- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
-- chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-- chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
-+ /* Read the OOB area first */
-+ if (mtd->writesize > 512) {
-+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
-+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, 0, -1);
-+ } else {
-+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
-+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
-+ }
-
- for (i = 0; i < chip->ecc.total; i++)
- ecc_code[i] = chip->oob_poi[eccpos[i]];
-@@ -1575,7 +1582,9 @@ static int nand_do_read_ops(struct mtd_i
- __func__, buf);
-
- read_retry:
-- chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
-+ if (chip->ecc.mode != NAND_ECC_HW_OOB_FIRST) {
-+ chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
-+ }
-
- /*
- * Now read the page into the buffer. Absent an error,
+++ /dev/null
-From 6031a240816d1c9a10f596d0648e586f6b878809 Mon Sep 17 00:00:00 2001
-From: Lars-Peter Clausen <lars@metafoo.de>
-Date: Tue, 15 Mar 2011 12:33:41 +0100
-Subject: [PATCH 3/7] NAND: Add support for subpage reads for
- NAND_ECC_HW_OOB_FIRST
-
----
- drivers/mtd/nand/nand_base.c | 77 +++++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 76 insertions(+), 1 deletion(-)
-
---- a/drivers/mtd/nand/nand_base.c
-+++ b/drivers/mtd/nand/nand_base.c
-@@ -1393,6 +1393,75 @@ static int nand_read_page_hwecc_oob_firs
- }
-
- /**
-+ * nand_read_subpage_hwecc_oob_first - [REPLACABLE] hw ecc based sub-page read function
-+ * @mtd: mtd info structure
-+ * @chip: nand chip info structure
-+ * @data_offs: offset of requested data within the page
-+ * @readlen: data length
-+ * @bufpoi: buffer to store read data
-+ * @page: page number to read
-+ *
-+ * Hardware ECC for large page chips, require OOB to be read first.
-+ * For this ECC mode, the write_page method is re-used from ECC_HW.
-+ * These methods read/write ECC from the OOB area, unlike the
-+ * ECC_HW_SYNDROME support with multiple ECC steps, follows the
-+ * "infix ECC" scheme and reads/writes ECC from the data area, by
-+ * overwriting the NAND manufacturer bad block markings.
-+ */
-+static int nand_read_subpage_hwecc_oob_first(struct mtd_info *mtd, struct nand_chip *chip,
-+ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi, int page)
-+{
-+ int start_step, end_step, num_steps;
-+ uint32_t *eccpos = chip->ecc.layout->eccpos;
-+ uint8_t *p;
-+ int data_col_addr;
-+ int eccsize = chip->ecc.size;
-+ int eccbytes = chip->ecc.bytes;
-+ uint8_t *ecc_code = chip->buffers->ecccode;
-+ uint8_t *ecc_calc = chip->buffers->ecccalc;
-+ int i;
-+
-+ /* Column address wihin the page aligned to ECC size */
-+ start_step = data_offs / chip->ecc.size;
-+ end_step = (data_offs + readlen - 1) / chip->ecc.size;
-+ num_steps = end_step - start_step + 1;
-+
-+ data_col_addr = start_step * chip->ecc.size;
-+
-+ /* Read the OOB area first */
-+ if (mtd->writesize > 512) {
-+ chip->cmdfunc(mtd, NAND_CMD_READ0, mtd->writesize, page);
-+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-+ chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_col_addr, -1);
-+ } else {
-+ chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
-+ chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-+ chip->cmdfunc(mtd, NAND_CMD_READ0, data_col_addr, page);
-+ }
-+
-+ for (i = 0; i < chip->ecc.total; i++)
-+ ecc_code[i] = chip->oob_poi[eccpos[i]];
-+
-+ p = bufpoi + data_col_addr;
-+
-+ for (i = eccbytes * start_step; num_steps; num_steps--, i += eccbytes, p += eccsize) {
-+ int stat;
-+
-+ chip->ecc.hwctl(mtd, NAND_ECC_READ);
-+ chip->read_buf(mtd, p, eccsize);
-+ chip->ecc.calculate(mtd, p, &ecc_calc[i]);
-+
-+ stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL);
-+ if (stat < 0)
-+ mtd->ecc_stats.failed++;
-+ else
-+ mtd->ecc_stats.corrected += stat;
-+ }
-+
-+ return 0;
-+}
-+
-+/**
- * nand_read_page_syndrome - [REPLACEABLE] hardware ECC syndrome based page read
- * @mtd: mtd info structure
- * @chip: nand chip info structure
-@@ -3950,8 +4019,14 @@ int nand_scan_tail(struct mtd_info *mtd)
- pr_warn("No ECC functions supplied; hardware ECC not possible\n");
- BUG();
- }
-- if (!ecc->read_page)
-+
-+ if (!ecc->read_page) {
- ecc->read_page = nand_read_page_hwecc_oob_first;
-+ if (!ecc->read_subpage) {
-+ ecc->read_subpage = nand_read_subpage_hwecc_oob_first;
-+ chip->options |= NAND_SUBPAGE_READ;
-+ }
-+ }
-
- case NAND_ECC_HW:
- /* Use standard hwecc read page function? */
+++ /dev/null
-From 1a1095927d224403af8ad57c354cc64521bf3081 Mon Sep 17 00:00:00 2001
-From: Paul Cercueil <paul@crapouillou.net>
-Date: Sat, 16 Jun 2012 19:36:31 +0200
-Subject: [PATCH 4/7] ASoC: JZ4740: delay activation of the DAC to work around
- a sound bug.
-
-A proper fix of that bug would require a big rewrite of the driver,
-which (I hope) will be done eventually.
----
- sound/soc/codecs/jz4740.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
---- a/sound/soc/codecs/jz4740.c
-+++ b/sound/soc/codecs/jz4740.c
-@@ -249,12 +249,15 @@ static int jz4740_codec_set_bias_level(s
- case SND_SOC_BIAS_ON:
- break;
- case SND_SOC_BIAS_PREPARE:
-- mask = JZ4740_CODEC_1_VREF_DISABLE |
-- JZ4740_CODEC_1_VREF_AMP_DISABLE |
-- JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M;
-+ mask = JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M;
- value = 0;
-
- regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value);
-+
-+ msleep(500);
-+ mask = JZ4740_CODEC_1_VREF_DISABLE |
-+ JZ4740_CODEC_1_VREF_AMP_DISABLE;
-+ regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, 0);
- break;
- case SND_SOC_BIAS_STANDBY:
- /* The only way to clear the suspend flag is to reset the codec */
+++ /dev/null
-From f05b1ecd7e4fde7e69320a4b7be461636e982991 Mon Sep 17 00:00:00 2001
-From: Paul Cercueil <paul@crapouillou.net>
-Date: Thu, 13 Sep 2012 00:09:20 +0200
-Subject: [PATCH 5/7] RTC: JZ4740: Init the "regulator" register on startup.
-
-This register controls the accuracy of the RTC. uC/OS-II use
-the RTC as a 100Hz clock, and writes a completely wrong value
-on that register, that we have to overwrite if we want a working
-real-time clock.
-
-Signed-off-by: Paul Cercueil <paul@crapouillou.net>
----
- drivers/rtc/rtc-jz4740.c | 17 +++++++++++++++++
- 1 file changed, 17 insertions(+)
-
---- a/drivers/rtc/rtc-jz4740.c
-+++ b/drivers/rtc/rtc-jz4740.c
-@@ -15,6 +15,7 @@
- */
-
- #include <linux/io.h>
-+#include <linux/clk.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/platform_device.h>
-@@ -216,6 +217,7 @@ static int jz4740_rtc_probe(struct platf
- struct jz4740_rtc *rtc;
- uint32_t scratchpad;
- struct resource *mem;
-+ struct clk *rtc_clk;
-
- rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
- if (!rtc)
-@@ -263,6 +265,21 @@ static int jz4740_rtc_probe(struct platf
- }
- }
-
-+ rtc_clk = clk_get(&pdev->dev, "rtc");
-+ if (IS_ERR(rtc_clk)) {
-+ dev_err(&pdev->dev, "Failed to get RTC clock\n");
-+ return PTR_ERR(rtc_clk);
-+ }
-+
-+ /* TODO: initialize the ADJC bits (25:16) to fine-tune
-+ * the accuracy of the RTC */
-+ ret = jz4740_rtc_reg_write(rtc, JZ_REG_RTC_REGULATOR,
-+ (clk_get_rate(rtc_clk) - 1) & 0xffff);
-+ clk_put(rtc_clk);
-+
-+ if (ret)
-+ dev_warn(&pdev->dev, "Could not update RTC regulator register\n");
-+
- return 0;
- }
-
+++ /dev/null
-From 8741ead92bc93e66740237e51b88b8690ebcbba3 Mon Sep 17 00:00:00 2001
-From: Lars-Peter Clausen <lars@metafoo.de>
-Date: Sun, 1 Aug 2010 21:19:40 +0200
-Subject: [PATCH 6/7] Add ili8960 lcd driver
-
-Includes the following changes from the jz-3.5 branch:
-- Use module_spi_driver
-- Use devm_kzalloc
-- Use kstrtoul
-
-Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
----
- drivers/video/backlight/Kconfig | 7 +
- drivers/video/backlight/Makefile | 1 +
- drivers/video/backlight/ili8960.c | 262 +++++++++++++++++++++++++++++++++++++
- 3 files changed, 270 insertions(+)
- create mode 100644 drivers/video/backlight/ili8960.c
-
---- a/drivers/video/backlight/Kconfig
-+++ b/drivers/video/backlight/Kconfig
-@@ -59,6 +59,13 @@ config LCD_LTV350QV
-
- The LTV350QV panel is present on all ATSTK1000 boards.
-
-+config LCD_ILI8960
-+ tristate "Ilitek ili8960 LCD driver"
-+ depends on LCD_CLASS_DEVICE && SPI
-+ default n
-+ help
-+ Driver for the Ilitek ili8960 LCD controller chip.
-+
- config LCD_ILI922X
- tristate "ILI Technology ILI9221/ILI9222 support"
- depends on SPI
---- a/drivers/video/backlight/Makefile
-+++ b/drivers/video/backlight/Makefile
-@@ -5,6 +5,7 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lcd.o
- obj-$(CONFIG_LCD_CORGI) += corgi_lcd.o
- obj-$(CONFIG_LCD_HP700) += jornada720_lcd.o
- obj-$(CONFIG_LCD_HX8357) += hx8357.o
-+obj-$(CONFIG_LCD_ILI8960) += ili8960.o
- obj-$(CONFIG_LCD_ILI922X) += ili922x.o
- obj-$(CONFIG_LCD_ILI9320) += ili9320.o
- obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o
---- /dev/null
-+++ b/drivers/video/backlight/ili8960.c
-@@ -0,0 +1,262 @@
-+/*
-+ * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
-+ * Driver for Ilitek ili8960 LCD
-+ *
-+ * 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.
-+ *
-+ * 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.
-+ *
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/spi/spi.h>
-+#include <linux/lcd.h>
-+#include <linux/delay.h>
-+
-+struct ili8960 {
-+ struct spi_device *spi;
-+ struct lcd_device *lcd;
-+ bool enabled;
-+ unsigned int brightness;
-+};
-+
-+#define ILI8960_REG_BRIGHTNESS 0x03
-+#define ILI8960_REG_POWER 0x05
-+#define ILI8960_REG_CONTRAST 0x0d
-+
-+static int ili8960_write_reg(struct spi_device *spi, uint8_t reg,
-+ uint8_t data)
-+{
-+ uint8_t buf[2];
-+ buf[0] = ((reg & 0x40) << 1) | (reg & 0x3f);
-+ buf[1] = data;
-+
-+ return spi_write(spi, buf, sizeof(buf));
-+}
-+
-+static int ili8960_programm_power(struct spi_device *spi, bool enabled)
-+{
-+ int ret;
-+
-+ if (enabled)
-+ mdelay(20);
-+
-+ ret = ili8960_write_reg(spi, ILI8960_REG_POWER, enabled ? 0xc7 : 0xc6);
-+
-+ if (!enabled)
-+ mdelay(20);
-+
-+ return ret;
-+}
-+
-+static int ili8960_set_power(struct lcd_device *lcd, int power)
-+{
-+ struct ili8960 *ili8960 = lcd_get_data(lcd);
-+
-+ switch (power) {
-+ case FB_BLANK_UNBLANK:
-+ ili8960->enabled = true;
-+ break;
-+ default:
-+ return 0;
-+ }
-+
-+ return ili8960_programm_power(ili8960->spi, ili8960->enabled);
-+}
-+
-+static int ili8960_early_set_power(struct lcd_device *lcd, int power)
-+{
-+ struct ili8960 *ili8960 = lcd_get_data(lcd);
-+
-+ switch (power) {
-+ case FB_BLANK_UNBLANK:
-+ return 0;
-+ default:
-+ ili8960->enabled = false;
-+ break;
-+ }
-+
-+ return ili8960_programm_power(ili8960->spi, ili8960->enabled);
-+}
-+
-+static int ili8960_get_power(struct lcd_device *lcd)
-+{
-+ struct ili8960 *ili8960 = lcd_get_data(lcd);
-+ return ili8960->enabled ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
-+}
-+
-+static int ili8960_set_contrast(struct lcd_device *lcd, int contrast)
-+{
-+ struct ili8960 *ili8960 = lcd_get_data(lcd);
-+
-+ return ili8960_write_reg(ili8960->spi, ILI8960_REG_CONTRAST, contrast);
-+}
-+
-+static int ili8960_set_mode(struct lcd_device *lcd, struct fb_videomode *mode)
-+{
-+ if (mode->xres != 320 && mode->yres != 240)
-+ return -EINVAL;
-+
-+ return 0;
-+}
-+
-+static int ili8960_set_brightness(struct ili8960 *ili8960, int brightness)
-+{
-+ int ret;
-+
-+ ret = ili8960_write_reg(ili8960->spi, ILI8960_REG_BRIGHTNESS, brightness);
-+
-+ if (ret == 0)
-+ ili8960->brightness = brightness;
-+
-+ return ret;
-+}
-+
-+static ssize_t ili8960_show_brightness(struct device *dev,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct lcd_device *ld = to_lcd_device(dev);
-+ struct ili8960 *ili8960 = lcd_get_data(ld);
-+
-+ return sprintf(buf, "%u\n", ili8960->brightness);
-+}
-+
-+static ssize_t ili8960_store_brightness(struct device *dev,
-+ struct device_attribute *attr, const char *buf, size_t count)
-+{
-+ struct lcd_device *ld = to_lcd_device(dev);
-+ struct ili8960 *ili8960 = lcd_get_data(ld);
-+ unsigned long brightness;
-+ int ret;
-+
-+ ret = kstrtoul(buf, 0, &brightness);
-+ if (ret)
-+ return ret;
-+
-+ if (brightness > 255)
-+ return -EINVAL;
-+
-+ ili8960_set_brightness(ili8960, brightness);
-+
-+ return count;
-+}
-+
-+
-+static DEVICE_ATTR(brightness, 0644, ili8960_show_brightness,
-+ ili8960_store_brightness);
-+
-+static struct lcd_ops ili8960_lcd_ops = {
-+ .set_power = ili8960_set_power,
-+ .early_set_power = ili8960_early_set_power,
-+ .get_power = ili8960_get_power,
-+ .set_contrast = ili8960_set_contrast,
-+ .set_mode = ili8960_set_mode,
-+};
-+
-+static int ili8960_probe(struct spi_device *spi)
-+{
-+ int ret;
-+ struct ili8960 *ili8960;
-+
-+ ili8960 = devm_kzalloc(&spi->dev, sizeof(*ili8960), GFP_KERNEL);
-+ if (!ili8960)
-+ return -ENOMEM;
-+
-+ spi->bits_per_word = 8;
-+ spi->mode = SPI_MODE_3;
-+
-+ ret = spi_setup(spi);
-+ if (ret) {
-+ dev_err(&spi->dev, "Failed to setup spi\n");
-+ return ret;
-+ }
-+
-+ ili8960->spi = spi;
-+
-+ ili8960->lcd = lcd_device_register("ili8960-lcd", &spi->dev, ili8960,
-+ &ili8960_lcd_ops);
-+
-+ if (IS_ERR(ili8960->lcd)) {
-+ ret = PTR_ERR(ili8960->lcd);
-+ dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret);
-+ return ret;
-+ }
-+
-+ ili8960->lcd->props.max_contrast = 255;
-+
-+ ret = device_create_file(&ili8960->lcd->dev, &dev_attr_brightness);
-+ if (ret)
-+ goto err_unregister_lcd;
-+
-+ ili8960_programm_power(ili8960->spi, true);
-+ ili8960->enabled = true;
-+
-+ spi_set_drvdata(spi, ili8960);
-+
-+ ili8960_write_reg(spi, 0x13, 0x01);
-+
-+ return 0;
-+err_unregister_lcd:
-+ lcd_device_unregister(ili8960->lcd);
-+ return ret;
-+}
-+
-+static int ili8960_remove(struct spi_device *spi)
-+{
-+ struct ili8960 *ili8960 = spi_get_drvdata(spi);
-+
-+ device_remove_file(&ili8960->lcd->dev, &dev_attr_brightness);
-+ lcd_device_unregister(ili8960->lcd);
-+
-+ spi_set_drvdata(spi, NULL);
-+ return 0;
-+}
-+
-+#ifdef CONFIG_PM
-+
-+static int ili8960_suspend(struct spi_device *spi, pm_message_t state)
-+{
-+ struct ili8960 *ili8960 = spi_get_drvdata(spi);
-+
-+ if (ili8960->enabled)
-+ ili8960_programm_power(ili8960->spi, false);
-+
-+ return 0;
-+}
-+
-+static int ili8960_resume(struct spi_device *spi)
-+{
-+ struct ili8960 *ili8960 = spi_get_drvdata(spi);
-+
-+ if (ili8960->enabled)
-+ ili8960_programm_power(ili8960->spi, true);
-+
-+ return 0;
-+}
-+
-+#else
-+#define ili8960_suspend NULL
-+#define ili8960_resume NULL
-+#endif
-+
-+static struct spi_driver ili8960_driver = {
-+ .driver = {
-+ .name = "ili8960",
-+ .owner = THIS_MODULE,
-+ },
-+ .probe = ili8960_probe,
-+ .remove = ili8960_remove,
-+ .suspend = ili8960_suspend,
-+ .resume = ili8960_resume,
-+};
-+module_spi_driver(ili8960_driver);
-+
-+MODULE_AUTHOR("Lars-Peter Clausen");
-+MODULE_LICENSE("GPL");
-+MODULE_DESCRIPTION("LCD driver for Ilitek ili8960");
-+MODULE_ALIAS("spi:ili8960");
+++ /dev/null
-From 4371d60ae342c76708c4317e06fb7dcf0159c2f1 Mon Sep 17 00:00:00 2001
-From: Lars-Peter Clausen <lars@metafoo.de>
-Date: Wed, 13 Oct 2010 01:17:24 +0200
-Subject: [PATCH 7/7] qi_lb60: Don't use 3-wire spi mode for the display for
- now
-
-The spi_gpio driver does not support 3-wire mode.
----
- arch/mips/jz4740/board-qi_lb60.c | 1 -
- 1 file changed, 1 deletion(-)
-
---- a/arch/mips/jz4740/board-qi_lb60.c
-+++ b/arch/mips/jz4740/board-qi_lb60.c
-@@ -312,7 +312,6 @@ static struct spi_board_info qi_lb60_spi
- .chip_select = 0,
- .bus_num = 1,
- .max_speed_hz = 30 * 1000,
-- .mode = SPI_3WIRE,
- },
- };
-
+++ /dev/null
-# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-CONFIG_INPUT_MATRIXKMAP=y
-CONFIG_KEYBOARD_GPIO=y
-CONFIG_KEYBOARD_MATRIX=y
-CONFIG_LCD_CLASS_DEVICE=y
-CONFIG_LCD_ILI8960=y
-# CONFIG_LCD_L4F00242T03 is not set
-# CONFIG_LCD_LMS283GF05 is not set
-# CONFIG_LCD_LTV350QV is not set
-# CONFIG_LCD_PLATFORM is not set
-# CONFIG_LCD_TDO24M is not set
-# CONFIG_LCD_VGG2432A4 is not set
-CONFIG_LOGO=y
-# CONFIG_LOGO_LINUX_CLUT224 is not set
-# CONFIG_LOGO_LINUX_MONO is not set
-# CONFIG_LOGO_LINUX_VGA16 is not set
-CONFIG_REGMAP_SPI=y
-CONFIG_SND_HWDEP=y
-CONFIG_SND_MIXER_OSS=y
-CONFIG_SND_PCM_OSS=y
-CONFIG_SND_SEQUENCER=y
-# CONFIG_SND_SEQUENCER_OSS is not set
-CONFIG_SND_SEQ_DUMMY=y
-# CONFIG_SND_VIRMIDI is not set
-CONFIG_SOUND_OSS_CORE=y
-CONFIG_SOUND_OSS_CORE_PRECLAIM=y
-CONFIG_SPI=y
-CONFIG_SPI_BITBANG=y
-CONFIG_SPI_GPIO=y
-CONFIG_SPI_MASTER=y
-# CONFIG_USB_FUSB300 is not set
-CONFIG_USB_JZ4740=y
+++ /dev/null
-BOARDNAME:=QI Ben Nanonote (qi_lb60)
+++ /dev/null
-#
-# Copyright (C) 2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=arm
-BOARD:=zynq
-BOARDNAME:=Xilinx Zynq 7000 SoCs
-FEATURES:=fpu gpio rtc usb usbgadget targz
-CPU_TYPE:=cortex-a9
-CPU_SUBTYPE:=neon
-MAINTAINER:=Jason Wu <jason.wu.misc@gmail.com>
-
-# future support SUBTARGETS: for both zynq and zynqmp
-
-define Target/Description
- Build firmware image for Zynq 7000 SoC devices.
-endef
-
-KERNEL_PATCHVER:=4.4
-
-include $(INCLUDE_DIR)/target.mk
-
-KERNELNAME:=zImage dtbs
-
-DEFAULT_PACKAGES += uboot-envtools
-
-$(eval $(call BuildTarget))
+++ /dev/null
-define Package/base-files/install-target
- rm -f $(1)/etc/config/network
-endef
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2015 OpenWrt.org
-
-. /lib/functions/uci-defaults.sh
-
-board_config_update
-
-case "$(board_name)" in
- xlnx,zynq-zc702|xlnx,zynq-zed|xlnx,zynq-zybo)
- ucidef_set_interface_lan 'eth0'
- ;;
-esac
-
-board_config_flush
-
-exit 0
+++ /dev/null
-# Copyright (C) 2015 OpenWrt.org
-
-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 proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
- option ip6assign 60
-
-config globals globals
- option ula_prefix auto
+++ /dev/null
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K shutdown
-::askconsole:/usr/libexec/login.sh
+++ /dev/null
-CONFIG_ADVISE_SYSCALLS=y
-CONFIG_ALIGNMENT_TRAP=y
-# CONFIG_AMBA_PL08X is not set
-# CONFIG_APM_EMULATION is not set
-CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
-CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
-CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
-CONFIG_ARCH_HAS_SG_CHAIN=y
-CONFIG_ARCH_HAS_TICK_BROADCAST=y
-CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
-CONFIG_ARCH_HIBERNATION_POSSIBLE=y
-CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
-CONFIG_ARCH_MULTIPLATFORM=y
-# CONFIG_ARCH_MULTI_CPU_AUTO is not set
-CONFIG_ARCH_MULTI_V6_V7=y
-CONFIG_ARCH_MULTI_V7=y
-CONFIG_ARCH_NR_GPIO=1024
-CONFIG_ARCH_REQUIRE_GPIOLIB=y
-# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
-# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
-CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
-CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
-CONFIG_ARCH_SUPPORTS_UPROBES=y
-CONFIG_ARCH_SUSPEND_POSSIBLE=y
-CONFIG_ARCH_USE_BUILTIN_BSWAP=y
-CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
-CONFIG_ARCH_VEXPRESS=y
-CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y
-# CONFIG_ARCH_VEXPRESS_SPC is not set
-CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
-CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
-CONFIG_ARCH_ZYNQ=y
-CONFIG_ARM=y
-CONFIG_ARM_AMBA=y
-CONFIG_ARM_CCI=y
-CONFIG_ARM_CCI400_COMMON=y
-CONFIG_ARM_CCI400_PMU=y
-CONFIG_ARM_CCI_PMU=y
-# CONFIG_ARM_CHARLCD is not set
-CONFIG_ARM_CPU_SUSPEND=y
-CONFIG_ARM_ERRATA_643719=y
-CONFIG_ARM_ERRATA_720789=y
-CONFIG_ARM_ERRATA_754322=y
-CONFIG_ARM_ERRATA_754327=y
-CONFIG_ARM_ERRATA_764369=y
-CONFIG_ARM_ERRATA_775420=y
-CONFIG_ARM_GIC=y
-CONFIG_ARM_GLOBAL_TIMER=y
-CONFIG_ARM_HAS_SG_CHAIN=y
-CONFIG_ARM_HEAVY_MB=y
-CONFIG_ARM_L1_CACHE_SHIFT=6
-CONFIG_ARM_L1_CACHE_SHIFT_6=y
-# CONFIG_ARM_LPAE is not set
-CONFIG_ARM_PATCH_PHYS_VIRT=y
-# CONFIG_ARM_PL172_MPMC is not set
-CONFIG_ARM_PMU=y
-# CONFIG_ARM_SMMU is not set
-# CONFIG_ARM_SP805_WATCHDOG is not set
-CONFIG_ARM_THUMB=y
-# CONFIG_ARM_THUMBEE is not set
-CONFIG_ARM_TIMER_SP804=y
-CONFIG_ARM_UNWIND=y
-CONFIG_ARM_VIRT_EXT=y
-CONFIG_ARM_ZYNQ_CPUIDLE=y
-CONFIG_ATAGS=y
-CONFIG_AUTO_ZRELADDR=y
-# CONFIG_AXI_DMAC is not set
-# CONFIG_BLK_CGROUP is not set
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_COUNT=16
-CONFIG_BLK_DEV_RAM_SIZE=16384
-CONFIG_BLK_DEV_SD=y
-CONFIG_BOUNCE=y
-CONFIG_BUILD_BIN2C=y
-CONFIG_CACHE_L2X0=y
-CONFIG_CADENCE_TTC_TIMER=y
-CONFIG_CADENCE_WATCHDOG=y
-CONFIG_CAN=y
-# CONFIG_CAN_8DEV_USB is not set
-CONFIG_CAN_BCM=y
-CONFIG_CAN_CALC_BITTIMING=y
-# CONFIG_CAN_CC770 is not set
-# CONFIG_CAN_C_CAN is not set
-CONFIG_CAN_DEV=y
-# CONFIG_CAN_EMS_USB is not set
-# CONFIG_CAN_ESD_USB2 is not set
-# CONFIG_CAN_FLEXCAN is not set
-# CONFIG_CAN_GRCAN is not set
-CONFIG_CAN_GW=y
-# CONFIG_CAN_KVASER_USB is not set
-# CONFIG_CAN_LEDS is not set
-# CONFIG_CAN_MCP251X is not set
-# CONFIG_CAN_PEAK_USB is not set
-CONFIG_CAN_RAW=y
-# CONFIG_CAN_SJA1000 is not set
-# CONFIG_CAN_SOFTING is not set
-# CONFIG_CAN_TI_HECC is not set
-CONFIG_CAN_XILINXCAN=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-CONFIG_CHR_DEV_SG=y
-CONFIG_CLKDEV_LOOKUP=y
-CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y
-CONFIG_CLKSRC_MMIO=y
-CONFIG_CLKSRC_OF=y
-CONFIG_CLKSRC_PROBE=y
-CONFIG_CLKSRC_VERSATILE=y
-CONFIG_CLK_SP810=y
-CONFIG_CLK_VEXPRESS_OSC=y
-CONFIG_CLONE_BACKWARDS=y
-CONFIG_CMA=y
-CONFIG_CMA_ALIGNMENT=8
-CONFIG_CMA_AREAS=7
-# CONFIG_CMA_DEBUG is not set
-# CONFIG_CMA_DEBUGFS is not set
-CONFIG_CMA_SIZE_MBYTES=16
-# CONFIG_CMA_SIZE_SEL_MAX is not set
-CONFIG_CMA_SIZE_SEL_MBYTES=y
-# CONFIG_CMA_SIZE_SEL_MIN is not set
-# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
-CONFIG_CMDLINE="console=ttyPS0,115200n8 root=/dev/ram rw initrd=0x00800000,16M earlyprintk"
-CONFIG_CMDLINE_FROM_BOOTLOADER=y
-CONFIG_COMMON_CLK=y
-# CONFIG_COMMON_CLK_AXI_CLKGEN is not set
-CONFIG_COMMON_CLK_SI570=y
-CONFIG_COMMON_CLK_VERSATILE=y
-CONFIG_COMPAT_BRK=y
-CONFIG_CONNECTOR=y
-CONFIG_CONSOLE_TRANSLATIONS=y
-CONFIG_COREDUMP=y
-# CONFIG_CPUFREQ_DT is not set
-# CONFIG_CPUSETS is not set
-CONFIG_CPU_32v6K=y
-CONFIG_CPU_32v7=y
-CONFIG_CPU_ABRT_EV7=y
-# CONFIG_CPU_BIG_ENDIAN is not set
-# CONFIG_CPU_BPREDICT_DISABLE is not set
-CONFIG_CPU_CACHE_V7=y
-CONFIG_CPU_CACHE_VIPT=y
-CONFIG_CPU_COPY_V6=y
-CONFIG_CPU_CP15=y
-CONFIG_CPU_CP15_MMU=y
-CONFIG_CPU_FREQ=y
-# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
-CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
-CONFIG_CPU_FREQ_GOV_COMMON=y
-CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
-CONFIG_CPU_FREQ_GOV_ONDEMAND=y
-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
-CONFIG_CPU_FREQ_GOV_POWERSAVE=y
-CONFIG_CPU_FREQ_GOV_USERSPACE=y
-CONFIG_CPU_FREQ_STAT=y
-CONFIG_CPU_FREQ_STAT_DETAILS=y
-CONFIG_CPU_HAS_ASID=y
-# CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_IDLE=y
-CONFIG_CPU_IDLE_GOV_LADDER=y
-CONFIG_CPU_IDLE_GOV_MENU=y
-CONFIG_CPU_PABRT_V7=y
-CONFIG_CPU_PM=y
-CONFIG_CPU_RMAP=y
-CONFIG_CPU_THERMAL=y
-CONFIG_CPU_TLB_V7=y
-CONFIG_CPU_V7=y
-CONFIG_CRC16=y
-# CONFIG_CRC32_SARWATE is not set
-CONFIG_CRC32_SLICEBY8=y
-CONFIG_CROSS_MEMORY_ATTACH=y
-CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_HASH2=y
-CONFIG_CRYPTO_HW=y
-CONFIG_DCACHE_WORD_ACCESS=y
-# CONFIG_DEBUG_FS is not set
-CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
-# CONFIG_DEBUG_UART_8250 is not set
-# CONFIG_DEBUG_USER is not set
-CONFIG_DEFAULT_CFQ=y
-# CONFIG_DEFAULT_DEADLINE is not set
-CONFIG_DEFAULT_IOSCHED="cfq"
-CONFIG_DMADEVICES=y
-CONFIG_DMA_CMA=y
-CONFIG_DMA_ENGINE=y
-CONFIG_DMA_OF=y
-CONFIG_DMA_SHARED_BUFFER=y
-CONFIG_DRM=y
-# CONFIG_DRM_AMDGPU is not set
-# CONFIG_DRM_ARMADA is not set
-# CONFIG_DRM_AST is not set
-# CONFIG_DRM_BOCHS is not set
-CONFIG_DRM_BRIDGE=y
-# CONFIG_DRM_CIRRUS_QEMU is not set
-# CONFIG_DRM_EXYNOS is not set
-CONFIG_DRM_FBDEV_EMULATION=y
-# CONFIG_DRM_FSL_DCU is not set
-# CONFIG_DRM_I2C_ADV7511 is not set
-# CONFIG_DRM_I2C_CH7006 is not set
-# CONFIG_DRM_I2C_NXP_TDA998X is not set
-# CONFIG_DRM_I2C_SIL164 is not set
-CONFIG_DRM_KMS_FB_HELPER=y
-CONFIG_DRM_KMS_HELPER=y
-# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
-# CONFIG_DRM_MGA is not set
-# CONFIG_DRM_MGAG200 is not set
-# CONFIG_DRM_NOUVEAU is not set
-# CONFIG_DRM_NXP_PTN3460 is not set
-# CONFIG_DRM_PARADE_PS8622 is not set
-# CONFIG_DRM_QXL is not set
-# CONFIG_DRM_R128 is not set
-# CONFIG_DRM_RADEON is not set
-# CONFIG_DRM_SAVAGE is not set
-# CONFIG_DRM_STI is not set
-# CONFIG_DRM_TDFX is not set
-# CONFIG_DRM_TILCDC is not set
-# CONFIG_DRM_UDL is not set
-# CONFIG_DRM_VGEM is not set
-# CONFIG_DRM_VIA is not set
-CONFIG_DTC=y
-CONFIG_DUMMY_CONSOLE=y
-# CONFIG_DW_DMAC_PCI is not set
-CONFIG_E1000E=y
-CONFIG_EDAC=y
-CONFIG_EDAC_ATOMIC_SCRUB=y
-# CONFIG_EDAC_DEBUG is not set
-CONFIG_EDAC_LEGACY_SYSFS=y
-CONFIG_EDAC_MM_EDAC=y
-CONFIG_EDAC_SUPPORT=y
-# CONFIG_EDAC_SYNOPSYS is not set
-CONFIG_EEPROM_AT24=y
-CONFIG_EEPROM_AT25=y
-CONFIG_ELF_CORE=y
-CONFIG_ENABLE_MUST_CHECK=y
-CONFIG_EXPORTFS=y
-CONFIG_EXT4_FS=y
-CONFIG_EXTCON=y
-# CONFIG_EXTCON_ADC_JACK is not set
-CONFIG_FAT_FS=y
-CONFIG_FB=y
-CONFIG_FB_CFB_COPYAREA=y
-CONFIG_FB_CFB_FILLRECT=y
-CONFIG_FB_CFB_IMAGEBLIT=y
-CONFIG_FB_CMDLINE=y
-CONFIG_FB_SYS_COPYAREA=y
-CONFIG_FB_SYS_FILLRECT=y
-CONFIG_FB_SYS_FOPS=y
-CONFIG_FB_SYS_IMAGEBLIT=y
-# CONFIG_FB_XILINX is not set
-CONFIG_FHANDLE=y
-CONFIG_FIRMWARE_IN_KERNEL=y
-CONFIG_FIX_EARLYCON_MEM=y
-CONFIG_FREEZER=y
-CONFIG_FS_MBCACHE=y
-CONFIG_GENERIC_ALLOCATOR=y
-CONFIG_GENERIC_CLOCKEVENTS=y
-CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
-CONFIG_GENERIC_IDLE_POLL_SETUP=y
-CONFIG_GENERIC_IO=y
-CONFIG_GENERIC_IRQ_SHOW=y
-CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
-CONFIG_GENERIC_MSI_IRQ=y
-CONFIG_GENERIC_PCI_IOMAP=y
-CONFIG_GENERIC_PINCONF=y
-CONFIG_GENERIC_SCHED_CLOCK=y
-CONFIG_GENERIC_SMP_IDLE_THREAD=y
-CONFIG_GENERIC_STRNCPY_FROM_USER=y
-CONFIG_GENERIC_STRNLEN_USER=y
-CONFIG_GPIOLIB=y
-CONFIG_GPIOLIB_IRQCHIP=y
-CONFIG_GPIO_DEVRES=y
-CONFIG_GPIO_GENERIC=y
-CONFIG_GPIO_GENERIC_PLATFORM=y
-CONFIG_GPIO_SYSFS=y
-CONFIG_GPIO_ZYNQ=y
-CONFIG_GRACE_PERIOD=y
-CONFIG_HANDLE_DOMAIN_IRQ=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_HAS_DMA=y
-CONFIG_HAS_IOMEM=y
-# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
-CONFIG_HAVE_ARCH_AUDITSYSCALL=y
-CONFIG_HAVE_ARCH_BITREVERSE=y
-CONFIG_HAVE_ARCH_JUMP_LABEL=y
-CONFIG_HAVE_ARCH_KGDB=y
-CONFIG_HAVE_ARCH_PFN_VALID=y
-CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-CONFIG_HAVE_ARCH_TRACEHOOK=y
-CONFIG_HAVE_ARM_SCU=y
-CONFIG_HAVE_ARM_TWD=y
-# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
-CONFIG_HAVE_BPF_JIT=y
-CONFIG_HAVE_CC_STACKPROTECTOR=y
-CONFIG_HAVE_CLK=y
-CONFIG_HAVE_CLK_PREPARE=y
-CONFIG_HAVE_CONTEXT_TRACKING=y
-CONFIG_HAVE_C_RECORDMCOUNT=y
-CONFIG_HAVE_DEBUG_KMEMLEAK=y
-CONFIG_HAVE_DMA_API_DEBUG=y
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_HAVE_DMA_CONTIGUOUS=y
-CONFIG_HAVE_DYNAMIC_FTRACE=y
-CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
-CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
-CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
-CONFIG_HAVE_FUNCTION_TRACER=y
-CONFIG_HAVE_GENERIC_DMA_COHERENT=y
-CONFIG_HAVE_HW_BREAKPOINT=y
-CONFIG_HAVE_IDE=y
-CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
-CONFIG_HAVE_KERNEL_GZIP=y
-CONFIG_HAVE_KERNEL_LZ4=y
-CONFIG_HAVE_KERNEL_LZMA=y
-CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KERNEL_XZ=y
-CONFIG_HAVE_MEMBLOCK=y
-CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
-CONFIG_HAVE_NET_DSA=y
-CONFIG_HAVE_OPROFILE=y
-CONFIG_HAVE_OPTPROBES=y
-CONFIG_HAVE_PATA_PLATFORM=y
-CONFIG_HAVE_PERF_EVENTS=y
-CONFIG_HAVE_PERF_REGS=y
-CONFIG_HAVE_PERF_USER_STACK_DUMP=y
-CONFIG_HAVE_PROC_CPU=y
-CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
-CONFIG_HAVE_SMP=y
-CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
-CONFIG_HAVE_UID16=y
-CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
-CONFIG_HDMI=y
-CONFIG_HID=y
-CONFIG_HID_GENERIC=y
-CONFIG_HID_MICROSOFT=y
-CONFIG_HIGHMEM=y
-# CONFIG_HIGHPTE is not set
-CONFIG_HOTPLUG_CPU=y
-CONFIG_HWMON=y
-CONFIG_HW_CONSOLE=y
-CONFIG_HZ_FIXED=0
-CONFIG_I2C=y
-CONFIG_I2C_ALGOBIT=y
-CONFIG_I2C_BOARDINFO=y
-CONFIG_I2C_CADENCE=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_COMPAT=y
-CONFIG_I2C_HELPER_AUTO=y
-CONFIG_I2C_MUX=y
-# CONFIG_I2C_MUX_GPIO is not set
-# CONFIG_I2C_MUX_PCA9541 is not set
-CONFIG_I2C_MUX_PCA954x=y
-CONFIG_ICST=y
-CONFIG_IIO=y
-CONFIG_IIO_BUFFER=y
-CONFIG_IIO_KFIFO_BUF=y
-CONFIG_IIO_TRIGGER=y
-CONFIG_IIO_TRIGGERED_BUFFER=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_INPUT=y
-CONFIG_INPUT_EVDEV=y
-CONFIG_INPUT_KEYBOARD=y
-# CONFIG_INPUT_MISC is not set
-CONFIG_INPUT_MOUSE=y
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-CONFIG_INPUT_POLLDEV=y
-CONFIG_INPUT_SPARSEKMAP=y
-CONFIG_IOMMU_HELPER=y
-# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set
-CONFIG_IOMMU_SUPPORT=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_RARP=y
-CONFIG_IRQCHIP=y
-CONFIG_IRQ_DOMAIN=y
-CONFIG_IRQ_DOMAIN_HIERARCHY=y
-CONFIG_IRQ_FORCED_THREADING=y
-CONFIG_IRQ_WORK=y
-# CONFIG_ISDN is not set
-CONFIG_JBD2=y
-# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
-# CONFIG_JFFS2_FS_XATTR is not set
-# CONFIG_JFFS2_LZMA is not set
-CONFIG_JFFS2_ZLIB=y
-CONFIG_KERNEL_GZIP=y
-# CONFIG_KERNEL_MODE_NEON is not set
-# CONFIG_KERNEL_XZ is not set
-CONFIG_KEYBOARD_ATKBD=y
-CONFIG_KEYBOARD_GPIO=y
-CONFIG_KEYBOARD_GPIO_POLLED=y
-CONFIG_LEDS_GPIO=y
-CONFIG_LEDS_TRIGGER_BACKLIGHT=y
-CONFIG_LEDS_TRIGGER_CAMERA=y
-CONFIG_LEDS_TRIGGER_CPU=y
-CONFIG_LEDS_TRIGGER_GPIO=y
-CONFIG_LEDS_TRIGGER_HEARTBEAT=y
-# CONFIG_LEDS_TRIGGER_NETDEV is not set
-CONFIG_LEDS_TRIGGER_ONESHOT=y
-CONFIG_LEDS_TRIGGER_TRANSIENT=y
-CONFIG_LIBFDT=y
-CONFIG_LOCKD=y
-CONFIG_LOCK_SPIN_ON_OWNER=y
-CONFIG_MACB=y
-CONFIG_MARVELL_PHY=y
-CONFIG_MDIO_BITBANG=y
-CONFIG_MDIO_BOARDINFO=y
-# CONFIG_MDIO_GPIO is not set
-CONFIG_MEDIA_CAMERA_SUPPORT=y
-CONFIG_MEDIA_CONTROLLER=y
-CONFIG_MEDIA_SUPPORT=y
-# CONFIG_MEMCG is not set
-CONFIG_MEMORY=y
-CONFIG_MEMORY_ISOLATION=y
-CONFIG_MFD_CORE=y
-CONFIG_MFD_SYSCON=y
-CONFIG_MFD_VEXPRESS_SYSREG=y
-CONFIG_MIGHT_HAVE_CACHE_L2X0=y
-CONFIG_MIGHT_HAVE_PCI=y
-CONFIG_MIGRATION=y
-CONFIG_MMC=y
-CONFIG_MMC_BLOCK=y
-CONFIG_MMC_SDHCI=y
-CONFIG_MMC_SDHCI_OF_ARASAN=y
-# CONFIG_MMC_SDHCI_PCI is not set
-CONFIG_MMC_SDHCI_PLTFM=y
-# CONFIG_MMC_TIFM_SD is not set
-CONFIG_MODULES_TREE_LOOKUP=y
-CONFIG_MODULES_USE_ELF_REL=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-# CONFIG_MODULE_STRIPPED is not set
-# CONFIG_MOUSE_BCM5974 is not set
-# CONFIG_MOUSE_CYAPA is not set
-# CONFIG_MOUSE_ELAN_I2C is not set
-CONFIG_MOUSE_PS2=y
-CONFIG_MOUSE_PS2_ALPS=y
-CONFIG_MOUSE_PS2_CYPRESS=y
-# CONFIG_MOUSE_PS2_ELANTECH is not set
-CONFIG_MOUSE_PS2_FOCALTECH=y
-CONFIG_MOUSE_PS2_LOGIPS2PP=y
-CONFIG_MOUSE_PS2_SYNAPTICS=y
-# CONFIG_MOUSE_PS2_TOUCHKIT is not set
-CONFIG_MOUSE_PS2_TRACKPOINT=y
-# CONFIG_MOUSE_SERIAL is not set
-# CONFIG_MOUSE_VSXXXAA is not set
-CONFIG_MSDOS_FS=y
-# CONFIG_MTD_CFI_INTELEXT is not set
-CONFIG_MTD_CMDLINE_PARTS=y
-# CONFIG_MTD_COMPLEX_MAPPINGS is not set
-CONFIG_MTD_M25P80=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_ECC=y
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_SPI_NOR=y
-CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
-# CONFIG_MTD_SPLIT is not set
-CONFIG_MTD_SPLIT_FIRMWARE=y
-# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set
-CONFIG_MULTI_IRQ_HANDLER=y
-CONFIG_MUTEX_SPIN_ON_OWNER=y
-CONFIG_NEED_DMA_MAP_STATE=y
-CONFIG_NEON=y
-# CONFIG_NET_CLS_CGROUP is not set
-CONFIG_NET_FLOW_LIMIT=y
-CONFIG_NET_PACKET_ENGINE=y
-CONFIG_NET_PTP_CLASSIFY=y
-# CONFIG_NET_VENDOR_CIRRUS is not set
-# CONFIG_NET_VENDOR_FARADAY is not set
-# CONFIG_NET_VENDOR_MARVELL is not set
-# CONFIG_NET_VENDOR_MICREL is not set
-# CONFIG_NET_VENDOR_MICROCHIP is not set
-# CONFIG_NET_VENDOR_NATSEMI is not set
-# CONFIG_NET_VENDOR_SEEQ is not set
-# CONFIG_NET_VENDOR_SMSC is not set
-# CONFIG_NET_VENDOR_STMICRO is not set
-# CONFIG_NET_VENDOR_VIA is not set
-CONFIG_NFS_FS=y
-CONFIG_NFS_V2=y
-CONFIG_NLS=y
-CONFIG_NLS_ASCII=y
-CONFIG_NLS_CODEPAGE_437=y
-CONFIG_NLS_ISO8859_1=y
-CONFIG_NOP_USB_XCEIV=y
-CONFIG_NO_BOOTMEM=y
-CONFIG_NO_HZ=y
-CONFIG_NO_HZ_COMMON=y
-CONFIG_NO_HZ_IDLE=y
-CONFIG_NO_IOPORT_MAP=y
-CONFIG_NR_CPUS=4
-CONFIG_OF=y
-CONFIG_OF_ADDRESS=y
-CONFIG_OF_ADDRESS_PCI=y
-CONFIG_OF_EARLY_FLATTREE=y
-CONFIG_OF_FLATTREE=y
-CONFIG_OF_GPIO=y
-CONFIG_OF_IRQ=y
-CONFIG_OF_MDIO=y
-CONFIG_OF_MTD=y
-CONFIG_OF_NET=y
-CONFIG_OF_PCI=y
-CONFIG_OF_PCI_IRQ=y
-CONFIG_OF_RESERVED_MEM=y
-CONFIG_OLD_SIGACTION=y
-CONFIG_OLD_SIGSUSPEND3=y
-CONFIG_OUTER_CACHE=y
-CONFIG_OUTER_CACHE_SYNC=y
-# CONFIG_OVERLAY_FS is not set
-CONFIG_PAGE_OFFSET=0xC0000000
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_PCI=y
-CONFIG_PCIE_XILINX=y
-# CONFIG_PCI_DOMAINS_GENERIC is not set
-CONFIG_PCI_MSI=y
-CONFIG_PCI_REALLOC_ENABLE_AUTO=y
-CONFIG_PERF_EVENTS=y
-CONFIG_PERF_USE_VMALLOC=y
-CONFIG_PGTABLE_LEVELS=2
-CONFIG_PHYLIB=y
-CONFIG_PINCTRL=y
-# CONFIG_PINCTRL_SINGLE is not set
-CONFIG_PINCTRL_ZYNQ=y
-CONFIG_PL310_ERRATA_588369=y
-CONFIG_PL310_ERRATA_727915=y
-CONFIG_PL310_ERRATA_753970=y
-CONFIG_PL310_ERRATA_769419=y
-CONFIG_PL330_DMA=y
-CONFIG_PLAT_VERSATILE=y
-CONFIG_PM=y
-CONFIG_PMBUS=y
-CONFIG_PM_CLK=y
-# CONFIG_PM_DEBUG is not set
-CONFIG_PM_SLEEP=y
-CONFIG_PM_SLEEP_SMP=y
-CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_VEXPRESS=y
-CONFIG_POWER_SUPPLY=y
-CONFIG_PPS=y
-CONFIG_PREEMPT=y
-CONFIG_PREEMPT_COUNT=y
-# CONFIG_PREEMPT_NONE is not set
-CONFIG_PREEMPT_RCU=y
-CONFIG_PROC_EVENTS=y
-# CONFIG_PROC_STRIPPED is not set
-CONFIG_PTP_1588_CLOCK=y
-CONFIG_R8169=y
-CONFIG_RAS=y
-CONFIG_RATIONAL=y
-# CONFIG_RCU_BOOST is not set
-CONFIG_RCU_STALL_COMMON=y
-CONFIG_RD_BZIP2=y
-CONFIG_RD_GZIP=y
-CONFIG_RD_LZ4=y
-CONFIG_RD_LZMA=y
-CONFIG_RD_LZO=y
-CONFIG_RD_XZ=y
-CONFIG_REGMAP=y
-CONFIG_REGMAP_I2C=y
-CONFIG_REGMAP_MMIO=y
-CONFIG_REGMAP_SPI=y
-CONFIG_REGULATOR=y
-CONFIG_REGULATOR_FIXED_VOLTAGE=y
-# CONFIG_REGULATOR_VEXPRESS is not set
-CONFIG_RFS_ACCEL=y
-CONFIG_ROOT_NFS=y
-CONFIG_RPS=y
-CONFIG_RTC_CLASS=y
-# CONFIG_RTC_DRV_CMOS is not set
-CONFIG_RTC_DRV_PCF8563=y
-CONFIG_RWSEM_SPIN_ON_OWNER=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-# CONFIG_SCHED_INFO is not set
-CONFIG_SCHED_MC=y
-CONFIG_SCHED_SMT=y
-CONFIG_SCSI=y
-# CONFIG_SENSORS_ADM1275 is not set
-# CONFIG_SENSORS_LM25066 is not set
-# CONFIG_SENSORS_LTC2978 is not set
-# CONFIG_SENSORS_MAX16064 is not set
-# CONFIG_SENSORS_MAX20751 is not set
-# CONFIG_SENSORS_MAX34440 is not set
-# CONFIG_SENSORS_MAX8688 is not set
-CONFIG_SENSORS_PMBUS=y
-# CONFIG_SENSORS_TPS40422 is not set
-CONFIG_SENSORS_UCD9000=y
-CONFIG_SENSORS_UCD9200=y
-# CONFIG_SENSORS_ZL6100 is not set
-# CONFIG_SERIAL_8250 is not set
-# CONFIG_SERIAL_AMBA_PL010 is not set
-# CONFIG_SERIAL_AMBA_PL011 is not set
-CONFIG_SERIAL_XILINX_PS_UART=y
-CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
-CONFIG_SERIO=y
-CONFIG_SERIO_LIBPS2=y
-CONFIG_SERIO_SERPORT=y
-CONFIG_SMP=y
-CONFIG_SMP_ON_UP=y
-CONFIG_SND=y
-CONFIG_SND_ARM=y
-# CONFIG_SND_ARMAACI is not set
-CONFIG_SND_COMPRESS_OFFLOAD=y
-CONFIG_SND_DMAENGINE_PCM=y
-CONFIG_SND_JACK=y
-CONFIG_SND_PCM=y
-CONFIG_SND_SOC=y
-CONFIG_SND_SOC_ADI=y
-CONFIG_SND_SOC_ADI_AXI_I2S=y
-CONFIG_SND_SOC_ADI_AXI_SPDIF=y
-CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM=y
-CONFIG_SND_SOC_I2C_AND_SPI=y
-CONFIG_SND_SPI=y
-CONFIG_SND_SUPPORT_OLD_API=y
-CONFIG_SOC_BUS=y
-CONFIG_SOUND=y
-CONFIG_SPARSE_IRQ=y
-CONFIG_SPI=y
-CONFIG_SPI_BITBANG=y
-CONFIG_SPI_CADENCE=y
-CONFIG_SPI_MASTER=y
-CONFIG_SPI_XILINX=y
-CONFIG_SRAM=y
-CONFIG_SRCU=y
-# CONFIG_STAGING is not set
-# CONFIG_STRIP_ASM_SYMS is not set
-CONFIG_SUNRPC=y
-# CONFIG_SUNXI_SRAM is not set
-CONFIG_SUSPEND=y
-CONFIG_SUSPEND_FREEZER=y
-CONFIG_SWIOTLB=y
-CONFIG_SWP_EMULATE=y
-# CONFIG_SYN_COOKIES is not set
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_SYSFS_SYSCALL=y
-CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-# CONFIG_TCP_CONG_ADVANCED is not set
-# CONFIG_TEXTSEARCH is not set
-CONFIG_THERMAL=y
-CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
-CONFIG_THERMAL_GOV_STEP_WISE=y
-CONFIG_THERMAL_HWMON=y
-CONFIG_THERMAL_OF=y
-# CONFIG_THUMB2_KERNEL is not set
-CONFIG_TICK_CPU_ACCOUNTING=y
-CONFIG_TIMER_STATS=y
-# CONFIG_TMPFS_XATTR is not set
-CONFIG_UIO=y
-# CONFIG_UIO_AEC is not set
-# CONFIG_UIO_CIF is not set
-# CONFIG_UIO_DMEM_GENIRQ is not set
-# CONFIG_UIO_MF624 is not set
-# CONFIG_UIO_NETX is not set
-# CONFIG_UIO_PCI_GENERIC is not set
-CONFIG_UIO_PDRV_GENIRQ=y
-# CONFIG_UIO_PRUSS is not set
-# CONFIG_UIO_SERCOS3 is not set
-CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
-CONFIG_UNINLINE_SPIN_UNLOCK=y
-CONFIG_USB=y
-# CONFIG_USB_AUDIO is not set
-CONFIG_USB_CHIPIDEA=y
-# CONFIG_USB_CHIPIDEA_DEBUG is not set
-CONFIG_USB_CHIPIDEA_HOST=y
-CONFIG_USB_CHIPIDEA_OF=y
-CONFIG_USB_CHIPIDEA_PCI=y
-CONFIG_USB_CHIPIDEA_UDC=y
-CONFIG_USB_COMMON=y
-# CONFIG_USB_CONFIGFS_ACM is not set
-# CONFIG_USB_CONFIGFS_ECM is not set
-# CONFIG_USB_CONFIGFS_ECM_SUBSET is not set
-# CONFIG_USB_CONFIGFS_EEM is not set
-# CONFIG_USB_CONFIGFS_F_FS is not set
-# CONFIG_USB_CONFIGFS_F_HID is not set
-# CONFIG_USB_CONFIGFS_F_LB_SS is not set
-# CONFIG_USB_CONFIGFS_F_MIDI is not set
-# CONFIG_USB_CONFIGFS_F_PRINTER is not set
-# CONFIG_USB_CONFIGFS_F_UAC1 is not set
-# CONFIG_USB_CONFIGFS_F_UAC2 is not set
-# CONFIG_USB_CONFIGFS_F_UVC is not set
-CONFIG_USB_CONFIGFS_MASS_STORAGE=y
-# CONFIG_USB_CONFIGFS_NCM is not set
-# CONFIG_USB_CONFIGFS_OBEX is not set
-# CONFIG_USB_CONFIGFS_RNDIS is not set
-# CONFIG_USB_CONFIGFS_SERIAL is not set
-CONFIG_USB_EHCI_HCD=y
-# CONFIG_USB_EHCI_HCD_PLATFORM is not set
-CONFIG_USB_EHCI_PCI=y
-# CONFIG_USB_EHCI_TT_NEWSCHED is not set
-# CONFIG_USB_ETH is not set
-CONFIG_USB_GADGET=y
-CONFIG_USB_GADGET_XILINX=y
-CONFIG_USB_HID=y
-CONFIG_USB_NET_DRIVERS=y
-CONFIG_USB_OTG=y
-CONFIG_USB_OTG_FSM=y
-CONFIG_USB_PHY=y
-CONFIG_USB_STORAGE=y
-CONFIG_USB_SUPPORT=y
-# CONFIG_USB_UHCI_HCD is not set
-CONFIG_USB_ULPI=y
-CONFIG_USB_ULPI_VIEWPORT=y
-# CONFIG_USB_ZERO_HNPTEST is not set
-CONFIG_USELIB=y
-# CONFIG_USERIO is not set
-CONFIG_USE_OF=y
-# CONFIG_V4L_PLATFORM_DRIVERS is not set
-CONFIG_VECTORS_BASE=0xffff0000
-CONFIG_VEXPRESS_CONFIG=y
-CONFIG_VEXPRESS_SYSCFG=y
-CONFIG_VFAT_FS=y
-CONFIG_VFP=y
-CONFIG_VFPv3=y
-CONFIG_VGA_ARB=y
-CONFIG_VGA_ARB_MAX_GPUS=16
-# CONFIG_VIDEO_ADP1653 is not set
-# CONFIG_VIDEO_AS3645A is not set
-CONFIG_VIDEO_DEV=y
-# CONFIG_VIDEO_LM3560 is not set
-# CONFIG_VIDEO_LM3646 is not set
-CONFIG_VIDEO_V4L2=y
-# CONFIG_VIDEO_V4L2_SUBDEV_API is not set
-CONFIG_VITESSE_PHY=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_VT_CONSOLE_SLEEP=y
-# CONFIG_VT_HW_CONSOLE_BINDING is not set
-CONFIG_WATCHDOG_CORE=y
-# CONFIG_WEXT_PRIV is not set
-# CONFIG_WEXT_SPY is not set
-# CONFIG_WIRELESS_EXT is not set
-# CONFIG_WL_TI is not set
-# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set
-CONFIG_XILINX_EMACLITE=y
-CONFIG_XILINX_VDMA=y
-CONFIG_XILINX_WATCHDOG=y
-CONFIG_XILINX_XADC=y
-CONFIG_XPS=y
-CONFIG_XZ_DEC_ARM=y
-CONFIG_XZ_DEC_ARMTHUMB=y
-CONFIG_XZ_DEC_BCJ=y
-CONFIG_XZ_DEC_IA64=y
-CONFIG_XZ_DEC_POWERPC=y
-CONFIG_XZ_DEC_SPARC=y
-CONFIG_XZ_DEC_X86=y
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZONE_DMA_FLAG=0
+++ /dev/null
-#
-# Copyright (C) 2015 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
-
-#################################################
-# Images
-#################################################
-
-# $(1): rootfs contents directory
-define Image/mkfs/cpio
- ( cd $(call mkfs_target_dir,$(1))/; find . | cpio -o -H newc | gzip -9n > $@ )
-endef
-
-# $(1): zynq board id
-define Build/dtb
- $(call Image/BuildDTB,$(DTS_DIR)/zynq-$(1).dts,$@.dtb)
-endef
-
-define Build/uRamdisk
- # Create uboot cpio.gz
- mkimage -A arm -T ramdisk -C gzip -n "$(PROFILE) OpenWRT rootfs" \
- -d $(IMAGE_ROOTFS) $@.new
- mv $@.new $@
-endef
-
-# $(1): FIT name/description
-define Build/fit
- # create FIT image with rootfs
- ./mkits.sh \
- -D $(1) -o $@.its -k $(IMAGE_KERNEL) -d $(IMAGE_KERNEL).dtb \
- -C none -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) \
- -A $(ARCH) -v $(LINUX_VERSION) -r $(IMAGE_ROOTFS) -z gzip
-
- PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@
-endef
-
-#################################################
-# Devices
-#################################################
-
-# default kernel load address
-KERNEL_LOADADDR=0x8000
-KERNEL_ENTRY=0x8000
-
-TARGET_FILESYSTEMS += cpio
-
-# $(1): canonical device name
-# $(2): lowercase device id
-define ZynqDevice
- define Device/$(1)
- DEVICE_TITLE := $(1) development board
- KERNEL := dtb $(2) | kernel-bin | uImage none
- KERNEL_NAME = zImage
- IMAGES := uramdisk.image.gz fit.itb
- IMAGE/uramdisk.image.gz := uRamdisk
- IMAGE/fit.itb := fit $(2)
- IMAGE_NAME = $$$$(IMG_PREFIX)-$(2)-$$$$(2)
- endef
- TARGET_DEVICES += $(1)
-endef
-
-$(eval $(call ZynqDevice,ZC702,zc702))
-$(eval $(call ZynqDevice,ZedBoard,zed))
-$(eval $(call ZynqDevice,ZYBO,zybo))
-
-$(eval $(call BuildImage))
+++ /dev/null
-#!/bin/bash
-#
-# Licensed under the terms of the GNU GPL License version 2 or later.
-#
-# Author: Peter Tyser <ptyser@xes-inc.com>
-#
-# U-Boot firmware supports the booting of images in the Flattened Image
-# Tree (FIT) format. The FIT format uses a device tree structure to
-# describe a kernel image, device tree blob, ramdisk, etc. This script
-# creates an Image Tree Source (.its file) which can be passed to the
-# 'mkimage' utility to generate an Image Tree Blob (.itb file). The .itb
-# file can then be booted by U-Boot (or other bootloaders which support
-# FIT images). See doc/uImage.FIT/howto.txt in U-Boot source code for
-# additional information on FIT images.
-#
-
-usage() {
- echo "Usage: `basename $0` -A arch -C comp -a addr -e entry" \
- "-v version -k kernel [-D name -d dtb] -o its_file"
- echo -e "\t-A ==> set architecture to 'arch'"
- echo -e "\t-C ==> set compression type 'comp'"
- echo -e "\t-a ==> set load address to 'addr' (hex)"
- echo -e "\t-e ==> set entry point to 'entry' (hex)"
- echo -e "\t-v ==> set kernel version to 'version'"
- echo -e "\t-k ==> include kernel image 'kernel'"
- echo -e "\t-D ==> human friendly Device Tree Blob 'name'"
- echo -e "\t-d ==> include Device Tree Blob 'dtb'"
- echo -e "\t-r ==> include ramdisk"
- echo -e "\t-z ==> ramdisk compression type"
- echo -e "\t-o ==> create output file 'its_file'"
- exit 1
-}
-
-while getopts ":A:a:C:D:d:e:k:o:v:r:z:" OPTION
-do
- case $OPTION in
- A ) ARCH=$OPTARG;;
- a ) LOAD_ADDR=$OPTARG;;
- C ) COMPRESS=$OPTARG;;
- D ) DEVICE=$OPTARG;;
- d ) DTB=$OPTARG;;
- e ) ENTRY_ADDR=$OPTARG;;
- k ) KERNEL=$OPTARG;;
- o ) OUTPUT=$OPTARG;;
- v ) VERSION=$OPTARG;;
- r ) RAMDISK=$OPTARG;;
- z ) RD_COMPRESS=$OPTARG;;
- * ) echo "Invalid option passed to '$0' (options:$@)"
- usage;;
- esac
-done
-
-# Make sure user entered all required parameters
-if [ -z "${ARCH}" ] || [ -z "${COMPRESS}" ] || [ -z "${LOAD_ADDR}" ] || \
- [ -z "${ENTRY_ADDR}" ] || [ -z "${VERSION}" ] || [ -z "${KERNEL}" ] || \
- [ -z "${OUTPUT}" ]; then
- usage
-fi
-
-ARCH_UPPER=`echo $ARCH | tr '[:lower:]' '[:upper:]'`
-
-# Conditionally create fdt information
-if [ -n "${DTB}" ]; then
- FDT="
- fdt@1 {
- description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\";
- data = /incbin/(\"${DTB}\");
- type = \"flat_dt\";
- arch = \"${ARCH}\";
- compression = \"none\";
- hash@1 {
- algo = \"crc32\";
- };
- hash@2 {
- algo = \"sha1\";
- };
- };
-"
- CONF=" fdt = \"fdt@1\";"
-fi
-
-# Conditionally create ramdisk node
-if [ -n "${RAMDISK}" ]; then
- RD_COMPRESS=${RD_COMPRESS:-none}
- RD="
- ramdisk@1 {
- description = \"${ARCH_UPPER} OpenWrt ${DEVICE} ramdisk\";
- data = /incbin/(\"${RAMDISK}\");
- type = \"ramdisk\";
- arch = \"${ARCH}\";
- os = \"linux\";
- compression = \"${RD_COMPRESS}\";
- hash@1 {
- algo = \"crc32\";
- };
- hash@2 {
- algo = \"sha1\";
- };
- };
-"
- if [ -z "${CONF}" ]; then
- CONF=" ramdisk = \"ramdisk@1\";"
- else
- CONF="$CONF
- ramdisk = \"ramdisk@1\";"
- fi
-fi
-
-# Create a default, fully populated DTS file
-DATA="/dts-v1/;
-
-/ {
- description = \"${ARCH_UPPER} OpenWrt FIT (Flattened Image Tree)\";
- #address-cells = <1>;
-
- images {
- kernel@1 {
- description = \"${ARCH_UPPER} OpenWrt Linux-${VERSION}\";
- data = /incbin/(\"${KERNEL}\");
- type = \"kernel\";
- arch = \"${ARCH}\";
- os = \"linux\";
- compression = \"${COMPRESS}\";
- load = <${LOAD_ADDR}>;
- entry = <${ENTRY_ADDR}>;
- hash@1 {
- algo = \"crc32\";
- };
- hash@2 {
- algo = \"sha1\";
- };
- };
-
-${RD}
-${FDT}
-
- };
-
- configurations {
- default = \"config@1\";
- config@1 {
- description = \"OpenWrt\";
- kernel = \"kernel@1\";
-${CONF}
- };
- };
-};"
-
-# Write .its file to disk
-echo "$DATA" > ${OUTPUT}