some cleanups: - fix CPUID detection - update MTD map for checks and sysupgrade - enable subtargets (Generic&NFS) for simpler development - generic cleanups (e.g. from linux checkpatch.pl)

SVN-Revision: 13295
This commit is contained in:
Thomas Langer 2008-11-20 18:31:00 +00:00
parent 88dd889314
commit 1bc6841c8d
14 changed files with 307 additions and 204 deletions

View file

@ -10,6 +10,7 @@ ARCH:=mips
BOARD:=ifxmips BOARD:=ifxmips
BOARDNAME:=Infineon Mips BOARDNAME:=Infineon Mips
FEATURES:=squashfs jffs2 FEATURES:=squashfs jffs2
SUBTARGETS:=generic nfs
LINUX_VERSION:=2.6.26.8 LINUX_VERSION:=2.6.26.8
include $(INCLUDE_DIR)/target.mk include $(INCLUDE_DIR)/target.mk

View file

@ -0,0 +1,25 @@
PART_NAME=linux
platform_check_image() {
[ "$ARGC" -gt 1 ] && return 1
case "$(get_magic_word "$1")" in
# .trx files
2705) return 0;;
*)
echo "Invalid image type"
return 1
;;
esac
}
# use default for platform_do_upgrade()
disable_watchdog() {
killall watchdog
( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
echo 'Could not disable watchdog'
return 1
}
}
append sysupgrade_pre_upgrade disable_watchdog

View file

@ -132,7 +132,7 @@ CONFIG_MTD_CFI_NOSWAP=y
# CONFIG_MTD_CFI_STAA is not set # CONFIG_MTD_CFI_STAA is not set
CONFIG_MTD_CFI_UTIL=y CONFIG_MTD_CFI_UTIL=y
CONFIG_MTD_CHAR=y CONFIG_MTD_CHAR=y
# CONFIG_MTD_CMDLINE_PARTS is not set CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_COMPLEX_MAPPINGS=y CONFIG_MTD_COMPLEX_MAPPINGS=y
# CONFIG_MTD_CONCAT is not set # CONFIG_MTD_CONCAT is not set
# CONFIG_MTD_DEBUG is not set # CONFIG_MTD_DEBUG is not set
@ -154,10 +154,7 @@ CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_PARTITIONS=y CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_PCI is not set # CONFIG_MTD_PCI is not set
# CONFIG_MTD_PHRAM is not set # CONFIG_MTD_PHRAM is not set
CONFIG_MTD_PHYSMAP=y # CONFIG_MTD_PHYSMAP is not set
CONFIG_MTD_PHYSMAP_BANKWIDTH=0
CONFIG_MTD_PHYSMAP_LEN=0x0
CONFIG_MTD_PHYSMAP_START=0x0
# CONFIG_MTD_PLATRAM is not set # CONFIG_MTD_PLATRAM is not set
# CONFIG_MTD_PMC551 is not set # CONFIG_MTD_PMC551 is not set
# CONFIG_MTD_RAM is not set # CONFIG_MTD_RAM is not set
@ -177,7 +174,7 @@ CONFIG_PAGE_SIZE_4KB=y
CONFIG_PCI=y CONFIG_PCI=y
# CONFIG_PCIPCWATCHDOG is not set # CONFIG_PCIPCWATCHDOG is not set
CONFIG_PCI_DOMAINS=y CONFIG_PCI_DOMAINS=y
CONFIG_PCSPKR_PLATFORM=y # CONFIG_PCSPKR_PLATFORM is not set
# CONFIG_PMC_MSP is not set # CONFIG_PMC_MSP is not set
# CONFIG_PMC_YOSEMITE is not set # CONFIG_PMC_YOSEMITE is not set
# CONFIG_PNX8550_JBS is not set # CONFIG_PNX8550_JBS is not set
@ -206,6 +203,7 @@ CONFIG_SERIAL_IFXMIPS=y
# CONFIG_SPARSEMEM_STATIC is not set # CONFIG_SPARSEMEM_STATIC is not set
# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set # CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
CONFIG_SSB_POSSIBLE=y CONFIG_SSB_POSSIBLE=y
# CONFIG_SWAP is not set
CONFIG_SWAP_IO_SPACE=y CONFIG_SWAP_IO_SPACE=y
CONFIG_SYSVIPC_SYSCTL=y CONFIG_SYSVIPC_SYSCTL=y
CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_HAS_CPU_MIPS32_R1=y
@ -224,13 +222,11 @@ CONFIG_TRAD_SIGNALS=y
CONFIG_USB=m CONFIG_USB=m
# CONFIG_USB_DWC_HCD is not set # CONFIG_USB_DWC_HCD is not set
# CONFIG_USB_EHCI_HCD is not set # CONFIG_USB_EHCI_HCD is not set
# CONFIG_USB_ISIGHTFW is not set
CONFIG_USB_SUPPORT=y CONFIG_USB_SUPPORT=y
# CONFIG_USB_UHCI_HCD is not set # CONFIG_USB_UHCI_HCD is not set
# CONFIG_VGASTATE is not set # CONFIG_VGASTATE is not set
# CONFIG_VIA_RHINE is not set # CONFIG_VIA_RHINE is not set
CONFIG_VIDEO_MEDIA=m CONFIG_VIDEO_MEDIA=m
CONFIG_VIDEO_V4L1=m
CONFIG_VIDEO_V4L2=m CONFIG_VIDEO_V4L2=m
CONFIG_VIDEO_V4L2_COMMON=m CONFIG_VIDEO_V4L2_COMMON=m
CONFIG_ZONE_DMA_FLAG=0 CONFIG_ZONE_DMA_FLAG=0

View file

@ -27,23 +27,23 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/reboot.h>
#include <linux/time.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/io.h>
#include <asm/gpio.h>
#include <asm/ifxmips/ifxmips.h> #include <asm/ifxmips/ifxmips.h>
#define MAX_BOARD_NAME_LEN 32 #define MAX_BOARD_NAME_LEN 32
#define MAX_IFXMIPS_DEVS 9 #define MAX_IFXMIPS_DEVS 9
#define SYSTEM_DANUBE "Danube" #define SYSTEM_DANUBE "Danube"
#define SYSTEM_DANUBE_CHIPID1 0x10129083 #define SYSTEM_DANUBE_CHIPID1 0x00129083
#define SYSTEM_DANUBE_CHIPID2 0x3012B083 #define SYSTEM_DANUBE_CHIPID2 0x0012B083
#define SYSTEM_TWINPASS "Twinpass" #define SYSTEM_TWINPASS "Twinpass"
#define SYSTEM_TWINPASS_CHIPID 0x3012D083 #define SYSTEM_TWINPASS_CHIPID 0x0012D083
enum { enum {
EASY50712, EASY50712,
@ -54,7 +54,7 @@ enum {
extern int ifxmips_pci_external_clock; extern int ifxmips_pci_external_clock;
static unsigned int chiprev; static unsigned int chiprev;
static int cmdline_mac = 0; static int cmdline_mac;
char board_name[MAX_BOARD_NAME_LEN + 1] = { 0 }; char board_name[MAX_BOARD_NAME_LEN + 1] = { 0 };
struct ifxmips_board { struct ifxmips_board {
@ -73,14 +73,12 @@ struct ifxmips_board {
spinlock_t ebu_lock = SPIN_LOCK_UNLOCKED; spinlock_t ebu_lock = SPIN_LOCK_UNLOCKED;
EXPORT_SYMBOL_GPL(ebu_lock); EXPORT_SYMBOL_GPL(ebu_lock);
static unsigned char ifxmips_mii_mac[6]; static unsigned char ifxmips_ethaddr[6];
static int ifxmips_brn = 0; static int ifxmips_brn;
static struct gpio_led_platform_data ifxmips_led_data; static struct gpio_led_platform_data ifxmips_led_data;
static struct platform_device static struct platform_device ifxmips_led = {
ifxmips_led =
{
.id = 0, .id = 0,
.name = "ifxmips_led", .name = "ifxmips_led",
.dev = { .dev = {
@ -88,49 +86,39 @@ ifxmips_led =
} }
}; };
static struct platform_device static struct platform_device ifxmips_gpio = {
ifxmips_gpio =
{
.id = 0, .id = 0,
.name = "ifxmips_gpio", .name = "ifxmips_gpio",
.num_resources = 1, .num_resources = 1,
}; };
static struct platform_device static struct platform_device ifxmips_mii = {
ifxmips_mii =
{
.id = 0, .id = 0,
.name = "ifxmips_mii0", .name = "ifxmips_mii0",
.dev = { .dev = {
.platform_data = ifxmips_mii_mac, .platform_data = ifxmips_ethaddr,
} }
}; };
static struct platform_device static struct platform_device ifxmips_wdt = {
ifxmips_wdt =
{
.id = 0, .id = 0,
.name = "ifxmips_wdt", .name = "ifxmips_wdt",
}; };
static struct resource static struct resource ifxmips_mtd_resource = {
ifxmips_mtd_resource = {
.start = IFXMIPS_FLASH_START, .start = IFXMIPS_FLASH_START,
.end = IFXMIPS_FLASH_START + IFXMIPS_FLASH_MAX - 1, .end = IFXMIPS_FLASH_START + IFXMIPS_FLASH_MAX - 1,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}; };
static struct platform_device static struct platform_device ifxmips_mtd = {
ifxmips_mtd =
{
.id = 0, .id = 0,
.name = "ifxmips_mtd", .name = "ifxmips_mtd",
.num_resources = 1, .num_resources = 1,
.resource = &ifxmips_mtd_resource, .resource = &ifxmips_mtd_resource,
}; };
static struct platform_device static struct platform_device ifxmips_gpio_dev = {
ifxmips_gpio_dev = {
.name = "GPIODEV", .name = "GPIODEV",
.id = -1, .id = -1,
.num_resources = 1, .num_resources = 1,
@ -189,15 +177,15 @@ static struct gpio_led easy4010_leds[] = {
{ .name = "ifx:green:test3", .gpio = 3,}, { .name = "ifx:green:test3", .gpio = 3,},
}; };
static struct ifxmips_board boards[] = static struct ifxmips_board boards[] = {
{
{ {
.type = EASY50712, .type = EASY50712,
.name = "EASY50712", .name = "EASY50712",
.system_type = SYSTEM_DANUBE_CHIPID1, .system_type = SYSTEM_DANUBE_CHIPID1,
.devs = easy50712_devs, .devs = easy50712_devs,
.reset_resource = {.name = "reset", .start = 1, .end = 15,}, .reset_resource = {.name = "reset", .start = 1, .end = 15,},
.gpiodev_resource = {.name = "gpio", .start = (1 << 0) | (1 << 1), .gpiodev_resource = { .name = "gpio",
.start = (1 << 0) | (1 << 1),
.end = (1 << 0) | (1 << 1)}, .end = (1 << 0) | (1 << 1)},
.ifxmips_leds = easy50712_leds, .ifxmips_leds = easy50712_leds,
}, { }, {
@ -206,7 +194,8 @@ static struct ifxmips_board boards[] =
.system_type = SYSTEM_TWINPASS_CHIPID, .system_type = SYSTEM_TWINPASS_CHIPID,
.devs = easy4010_devs, .devs = easy4010_devs,
.reset_resource = {.name = "reset", .start = 1, .end = 15}, .reset_resource = {.name = "reset", .start = 1, .end = 15},
.gpiodev_resource = {.name = "gpio", .start = (1 << 0) | (1 << 1), .gpiodev_resource = { .name = "gpio",
.start = (1 << 0) | (1 << 1),
.end = (1 << 0) | (1 << 1)}, .end = (1 << 0) | (1 << 1)},
.ifxmips_leds = easy4010_leds, .ifxmips_leds = easy4010_leds,
}, { }, {
@ -220,12 +209,11 @@ static struct ifxmips_board boards[] =
}, },
}; };
const char* const char *get_system_type(void)
get_system_type(void)
{ {
chiprev = ifxmips_r32(IFXMIPS_MPS_CHIPID); chiprev = (ifxmips_r32(IFXMIPS_MPS_CHIPID) & 0x0FFFFFFF);
switch(chiprev)
{ switch (chiprev) {
case SYSTEM_DANUBE_CHIPID1: case SYSTEM_DANUBE_CHIPID1:
case SYSTEM_DANUBE_CHIPID2: case SYSTEM_DANUBE_CHIPID2:
return SYSTEM_DANUBE; return SYSTEM_DANUBE;
@ -237,57 +225,59 @@ get_system_type(void)
return BOARD_SYSTEM_TYPE; return BOARD_SYSTEM_TYPE;
} }
static int __init static int __init ifxmips_set_board_type(char *str)
ifxmips_set_board_type(char *str)
{ {
str = strchr(str, '='); str = strchr(str, '=');
if(!str) if (!str)
goto out; goto out;
str++; str++;
if(strlen(str) > MAX_BOARD_NAME_LEN) if (strlen(str) > MAX_BOARD_NAME_LEN)
goto out; goto out;
strncpy(board_name, str, MAX_BOARD_NAME_LEN); strncpy(board_name, str, MAX_BOARD_NAME_LEN);
printk("bootloader told us, that this is a %s board\n", board_name); printk(KERN_INFO "bootloader told us, that this is a %s board\n",
board_name);
out: out:
return 1; return 1;
} }
__setup("ifxmips_board", ifxmips_set_board_type); __setup("ifxmips_board", ifxmips_set_board_type);
static int __init static int __init ifxmips_set_ethaddr(char *str)
ifxmips_set_mii0_mac(char *str)
{ {
#define IS_HEX(x) \ #define IS_HEX(x) \
(((x >='0' && x <= '9') || (x >='a' && x <= 'f') || (x >='A' && x <= 'F'))?(1):(0)) (((x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') \
|| (x >= 'A' && x <= 'F'))?(1):(0))
int i; int i;
str = strchr(str, '='); str = strchr(str, '=');
if(!str) if (!str)
goto out; goto out;
str++; str++;
if(strlen(str) != 17) if (strlen(str) != 17)
goto out; goto out;
for(i = 0; i < 6; i++) for (i = 0; i < 6; i++) {
{ if (!IS_HEX(str[3 * i]) || !IS_HEX(str[(3 * i) + 1]))
if(!IS_HEX(str[3 * i]) || !IS_HEX(str[(3 * i) + 1]))
goto out; goto out;
if((i != 5) && (str[(3 * i) + 2] != ':')) if ((i != 5) && (str[(3 * i) + 2] != ':'))
goto out; goto out;
ifxmips_mii_mac[i] = simple_strtoul(&str[3 * i], NULL, 16); ifxmips_ethaddr[i] = strict_strtoul(&str[3 * i], NULL, 16);
} }
if(is_valid_ether_addr(ifxmips_mii_mac)) if (is_valid_ether_addr(ifxmips_ethaddr))
cmdline_mac = 1; cmdline_mac = 1;
out: out:
return 1; return 1;
} }
__setup("mii0_mac", ifxmips_set_mii0_mac); __setup("ethaddr", ifxmips_set_ethaddr);
int int ifxmips_find_brn_block(void)
ifxmips_find_brn_block(void){ {
unsigned char temp[8]; unsigned char temp[8];
memcpy_fromio(temp, (void*)KSEG1ADDR(IFXMIPS_FLASH_START + 0x800000 - 0x10000), 8); memcpy_fromio(temp,
if(memcmp(temp, "BRN-BOOT", 8) == 0) (void *)KSEG1ADDR(IFXMIPS_FLASH_START + 0x800000 - 0x10000), 8);
{ if (memcmp(temp, "BRN-BOOT", 8) == 0) {
if(!cmdline_mac) if (!cmdline_mac)
memcpy_fromio(ifxmips_mii_mac, (void*)KSEG1ADDR(IFXMIPS_FLASH_START + 0x800000 - 0x10000 + 0x16), 6); memcpy_fromio(ifxmips_ethaddr,
(void *)KSEG1ADDR(IFXMIPS_FLASH_START +
0x800000 - 0x10000 + 0x16), 6);
if (is_valid_ether_addr(ifxmips_ethaddr))
cmdline_mac = 1; cmdline_mac = 1;
return 1; return 1;
} else { } else {
@ -295,42 +285,39 @@ ifxmips_find_brn_block(void){
} }
} }
int int ifxmips_has_brn_block(void)
ifxmips_has_brn_block(void)
{ {
return ifxmips_brn; return ifxmips_brn;
} }
EXPORT_SYMBOL(ifxmips_has_brn_block); EXPORT_SYMBOL(ifxmips_has_brn_block);
struct ifxmips_board* struct ifxmips_board *ifxmips_find_board(void)
ifxmips_find_board(void)
{ {
int i; int i;
if(!*board_name) if (!*board_name)
return 0; return 0;
for(i = 0; i < ARRAY_SIZE(boards); i++) for (i = 0; i < ARRAY_SIZE(boards); i++)
if((boards[i].system_type == chiprev) && (!strcmp(boards[i].name, board_name))) if ((boards[i].system_type == chiprev) &&
(!strcmp(boards[i].name, board_name)))
return &boards[i]; return &boards[i];
return 0; return 0;
} }
int __init int __init ifxmips_init_devices(void)
ifxmips_init_devices(void)
{ {
struct ifxmips_board *board = ifxmips_find_board(); struct ifxmips_board *board = ifxmips_find_board();
chiprev = ifxmips_r32(IFXMIPS_MPS_CHIPID); chiprev = (ifxmips_r32(IFXMIPS_MPS_CHIPID) & 0x0FFFFFFF);
ifxmips_brn = ifxmips_find_brn_block(); ifxmips_brn = ifxmips_find_brn_block();
if(!cmdline_mac) if (!cmdline_mac)
random_ether_addr(ifxmips_mii_mac); random_ether_addr(ifxmips_ethaddr);
if(!board) if (!board) {
{ switch (chiprev) {
switch(chiprev)
{
case SYSTEM_DANUBE_CHIPID1: case SYSTEM_DANUBE_CHIPID1:
case SYSTEM_DANUBE_CHIPID2: case SYSTEM_DANUBE_CHIPID2:
default:
board = &boards[0]; board = &boards[0];
break; break;
case SYSTEM_TWINPASS_CHIPID: case SYSTEM_TWINPASS_CHIPID:
@ -339,8 +326,7 @@ ifxmips_init_devices(void)
} }
} }
switch(board->type) switch (board->type) {
{
case EASY50712: case EASY50712:
board->num_devs = ARRAY_SIZE(easy50712_devs); board->num_devs = ARRAY_SIZE(easy50712_devs);
ifxmips_led_data.num_leds = ARRAY_SIZE(easy50712_leds); ifxmips_led_data.num_leds = ARRAY_SIZE(easy50712_leds);
@ -368,13 +354,14 @@ ifxmips_init_devices(void)
#endif #endif
ifxmips_led_data.leds = board->ifxmips_leds; ifxmips_led_data.leds = board->ifxmips_leds;
printk("%s:%s[%d]adding %d devs\n", __FILE__, __func__, __LINE__, board->num_devs); printk(KERN_INFO "%s:%s[%d]adding %d devs\n",
__FILE__, __func__, __LINE__, board->num_devs);
ifxmips_gpio.resource = &board->reset_resource; ifxmips_gpio.resource = &board->reset_resource;
ifxmips_gpio_dev.resource = &board->gpiodev_resource; ifxmips_gpio_dev.resource = &board->gpiodev_resource;
if(board->pci_external_clock) if (board->pci_external_clock)
ifxmips_pci_external_clock = 1; ifxmips_pci_external_clock = 1;
printk("using board definition %s\n", board->name); printk(KERN_INFO "using board definition %s\n", board->name);
return platform_add_devices(board->devs, board->num_devs); return platform_add_devices(board->devs, board->num_devs);
} }

View file

@ -173,7 +173,7 @@ pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin){
} }
} }
int int __init
pcibios_init(void) pcibios_init(void)
{ {
extern int pci_probe_only; extern int pci_probe_only;

View file

@ -20,7 +20,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/io.h> #include <linux/io.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
@ -32,126 +32,143 @@
#include <linux/magic.h> #include <linux/magic.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
static struct map_info #ifndef CONFIG_MTD_PARTITIONS
ifxmips_map = { #error Please enable CONFIG_MTD_PARTITIONS
.name = "ifxmips_mtd", #endif
static struct map_info ifxmips_map = {
.name = "ifx-nor",
.bankwidth = 2, .bankwidth = 2,
.size = 0x400000, .size = 0x400000,
}; };
static map_word static map_word ifxmips_read16(struct map_info *map, unsigned long adr)
ifxmips_read16(struct map_info * map, unsigned long adr)
{ {
unsigned long flags; unsigned long flags;
map_word temp; map_word temp;
spin_lock_irqsave(&ebu_lock, flags); spin_lock_irqsave(&ebu_lock, flags);
adr ^= 2; adr ^= 2;
temp.x[0] = *((__u16*)(map->virt + adr)); temp.x[0] = *((__u16 *)(map->virt + adr));
spin_unlock_irqrestore(&ebu_lock, flags); spin_unlock_irqrestore(&ebu_lock, flags);
return temp; return temp;
} }
static void static void ifxmips_write16(struct map_info *map, map_word d, unsigned long adr)
ifxmips_write16(struct map_info *map, map_word d, unsigned long adr)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ebu_lock, flags); spin_lock_irqsave(&ebu_lock, flags);
adr ^= 2; adr ^= 2;
*((__u16*)(map->virt + adr)) = d.x[0]; *((__u16 *)(map->virt + adr)) = d.x[0];
spin_unlock_irqrestore(&ebu_lock, flags); spin_unlock_irqrestore(&ebu_lock, flags);
} }
void void ifxmips_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
ifxmips_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
{ {
unsigned char *p; unsigned char *p;
unsigned char *to_8; unsigned char *to_8;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ebu_lock, flags); spin_lock_irqsave(&ebu_lock, flags);
from = (unsigned long)(from + map->virt); from = (unsigned long)(from + map->virt);
p = (unsigned char*) from; p = (unsigned char *) from;
to_8 = (unsigned char*) to; to_8 = (unsigned char *) to;
while(len--) while (len--)
*to_8++ = *p++; *to_8++ = *p++;
spin_unlock_irqrestore(&ebu_lock, flags); spin_unlock_irqrestore(&ebu_lock, flags);
} }
void void ifxmips_copy_to(struct map_info *map,
ifxmips_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) unsigned long to,
const void *from,
ssize_t len)
{ {
unsigned char *p = (unsigned char*)from; unsigned char *p = (unsigned char *)from;
unsigned char *to_8; unsigned char *to_8;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ebu_lock, flags); spin_lock_irqsave(&ebu_lock, flags);
to += (unsigned long) map->virt; to += (unsigned long) map->virt;
to_8 = (unsigned char*)to; to_8 = (unsigned char *)to;
while(len--) while (len--)
*p++ = *to_8++; *p++ = *to_8++;
spin_unlock_irqrestore(&ebu_lock, flags); spin_unlock_irqrestore(&ebu_lock, flags);
} }
static struct mtd_partition static struct mtd_partition ifxmips_partitions[] = {
ifxmips_partitions[] = {
{ {
name:"uboot", .name = "uboot",
offset:0x00000000, .offset = 0x00000000,
size:0x00020000, .size = 0x00020000,
}, },
{ {
name:"uboot_env", .name = "uboot_env",
offset:0x00020000, .offset = 0x00020000,
size:0x00010000, .size = 0x00010000,
}, },
{ {
name:"kernel", .name = "kernel",
offset:0x00030000, .offset = 0x00030000,
size:0x0, .size = 0x0,
}, },
{ {
name:"rootfs", .name = "rootfs",
offset:0x0, .offset = 0x0,
size:0x0, .size = 0x0,
}, },
{ {
name:"board_config", .name = "board_config",
offset:0x0, .offset = 0x0,
size:0x0, .size = 0x0,
}, },
}; };
int static struct mtd_partition ifxmips_meta_partition = {
find_uImage_size(unsigned long start_offset){ .name = "linux",
.offset = 0x00030000,
.size = 0x0,
};
static const char *part_probe_types[] = { "cmdlinepart", NULL };
int find_uImage_size(unsigned long start_offset)
{
unsigned long magic;
unsigned long temp; unsigned long temp;
ifxmips_copy_from(&ifxmips_map, &magic, start_offset, 4);
if (!(ntohl(magic) == 0x27051956)) {
printk(KERN_INFO "ifxmips_mtd: invalid magic (0x%08X) of kernel at 0x%08lx \n", ntohl(magic), start_offset);
return 0;
}
ifxmips_copy_from(&ifxmips_map, &temp, start_offset + 12, 4); ifxmips_copy_from(&ifxmips_map, &temp, start_offset + 12, 4);
printk(KERN_INFO "ifxmips_mtd: kernel size is %ld \n", temp + 0x40); printk(KERN_INFO "ifxmips_mtd: kernel size is %ld \n", temp + 0x40);
return temp + 0x40; return temp + 0x40;
} }
int int find_brn_block(unsigned long start_offset)
find_brn_block(unsigned long start_offset){ {
unsigned char temp[9]; unsigned char temp[9];
ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 8); ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 8);
temp[8] = '\0'; temp[8] = '\0';
printk(KERN_INFO "data in brn block %s\n", temp); printk(KERN_INFO "data in brn block %s\n", temp);
if(memcmp(temp, "BRN-BOOT", 8) == 0) if (memcmp(temp, "BRN-BOOT", 8) == 0)
return 1; return 1;
else else
return 0; return 0;
} }
int int detect_squashfs_partition(unsigned long start_offset)
detect_squashfs_partition(unsigned long start_offset){ {
unsigned long temp; unsigned long temp;
ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 4); ifxmips_copy_from(&ifxmips_map, &temp, start_offset, 4);
return (temp == SQUASHFS_MAGIC); return temp == SQUASHFS_MAGIC;
} }
static int static int ifxmips_mtd_probe(struct platform_device *dev)
ifxmips_mtd_probe(struct platform_device *dev)
{ {
struct mtd_info *ifxmips_mtd = NULL; struct mtd_info *ifxmips_mtd = NULL;
struct mtd_partition *parts = NULL; struct mtd_partition *parts = NULL;
unsigned long uimage_size; unsigned long uimage_size;
int err, i;
int kernel_part = 2, rootfs_part = 3;
int num_parts = ARRAY_SIZE(ifxmips_partitions);
ifxmips_w32(0x1d7ff, IFXMIPS_EBU_BUSCON0); ifxmips_w32(0x1d7ff, IFXMIPS_EBU_BUSCON0);
@ -163,51 +180,74 @@ ifxmips_mtd_probe(struct platform_device *dev)
ifxmips_map.size = dev->resource->end - ifxmips_map.phys + 1; ifxmips_map.size = dev->resource->end - ifxmips_map.phys + 1;
ifxmips_map.virt = ioremap_nocache(ifxmips_map.phys, ifxmips_map.size); ifxmips_map.virt = ioremap_nocache(ifxmips_map.phys, ifxmips_map.size);
if(!ifxmips_map.virt) if (!ifxmips_map.virt) {
{
printk(KERN_WARNING "ifxmips_mtd: failed to ioremap!\n"); printk(KERN_WARNING "ifxmips_mtd: failed to ioremap!\n");
return -EIO; return -EIO;
} }
ifxmips_mtd = (struct mtd_info *) do_map_probe("cfi_probe", &ifxmips_map); ifxmips_mtd = (struct mtd_info *) do_map_probe("cfi_probe", &ifxmips_map);
if(!ifxmips_mtd) if (!ifxmips_mtd) {
{
iounmap(ifxmips_map.virt); iounmap(ifxmips_map.virt);
printk(KERN_WARNING "ifxmips_mtd: probing failed\n"); printk(KERN_WARNING "ifxmips_mtd: probing failed\n");
return -ENXIO; return -ENXIO;
} }
ifxmips_mtd->owner = THIS_MODULE; ifxmips_mtd->owner = THIS_MODULE;
uimage_size = find_uImage_size(ifxmips_partitions[2].offset);
if(detect_squashfs_partition(ifxmips_partitions[2].offset + uimage_size)) err = parse_mtd_partitions(ifxmips_mtd, part_probe_types, &parts, 0);
{ if (err > 0) {
printk(KERN_INFO "ifxmips_mtd: found %d partitions from cmdline\n", err);
num_parts = err;
kernel_part = 0;
rootfs_part = 0;
for (i = 0; i < num_parts; i++) {
if (strcmp(parts[i].name, "kernel") == 0)
kernel_part = i;
if (strcmp(parts[i].name, "rootfs") == 0)
rootfs_part = i;
}
} else {
parts = &ifxmips_partitions[0];
}
/* dynamic size detection only if rootfs-part follows kernel-part */
if (kernel_part+1 == rootfs_part) {
uimage_size = find_uImage_size(parts[kernel_part].offset);
if (detect_squashfs_partition(parts[kernel_part].offset + uimage_size)) {
printk(KERN_INFO "ifxmips_mtd: found a squashfs following the uImage\n"); printk(KERN_INFO "ifxmips_mtd: found a squashfs following the uImage\n");
} else { } else {
uimage_size &= ~0xffff; uimage_size &= ~0xffff;
uimage_size += 0x10000; uimage_size += 0x10000;
} }
parts = &ifxmips_partitions[0]; parts[kernel_part].size = uimage_size;
ifxmips_partitions[2].size = uimage_size; parts[rootfs_part].offset = parts[kernel_part].offset + parts[kernel_part].size;
ifxmips_partitions[3].offset = ifxmips_partitions[2].offset + ifxmips_partitions[2].size; parts[rootfs_part].size = ((ifxmips_mtd->size >> 20) * 1024 * 1024) - parts[rootfs_part].offset;
ifxmips_partitions[3].size = ((ifxmips_mtd->size >> 20) * 1024 * 1024) - ifxmips_partitions[3].offset;
if(ifxmips_has_brn_block()) ifxmips_meta_partition.offset = parts[kernel_part].offset;
{ ifxmips_meta_partition.size = parts[kernel_part].size + parts[rootfs_part].size;
ifxmips_partitions[3].size -= ifxmips_mtd->erasesize;
ifxmips_partitions[4].offset = ifxmips_mtd->size - ifxmips_mtd->erasesize;
ifxmips_partitions[4].size = ifxmips_mtd->erasesize;
add_mtd_partitions(ifxmips_mtd, parts, 5);
} else {
add_mtd_partitions(ifxmips_mtd, parts, 4);
} }
printk(KERN_INFO "ifxmips_mtd: added ifxmips flash with %dMB\n", ifxmips_mtd->size >> 20); if (err <= 0) {
if (ifxmips_has_brn_block()) {
parts[4].size -= ifxmips_mtd->erasesize;
parts[5].offset = ifxmips_mtd->size - ifxmips_mtd->erasesize;
parts[5].size = ifxmips_mtd->erasesize;
} else {
num_parts--;
}
}
add_mtd_partitions(ifxmips_mtd, parts, num_parts);
add_mtd_partitions(ifxmips_mtd, &ifxmips_meta_partition, 1);
printk(KERN_INFO "ifxmips_mtd: added %s flash with %dMB\n",
ifxmips_map.name, ifxmips_mtd->size >> 20);
return 0; return 0;
} }
static struct static struct platform_driver ifxmips_mtd_driver = {
platform_driver ifxmips_mtd_driver = {
.probe = ifxmips_mtd_probe, .probe = ifxmips_mtd_probe,
.driver = { .driver = {
.name = "ifxmips_mtd", .name = "ifxmips_mtd",
@ -215,17 +255,15 @@ platform_driver ifxmips_mtd_driver = {
}, },
}; };
int __init int __init init_ifxmips_mtd(void)
init_ifxmips_mtd(void)
{ {
int ret = platform_driver_register(&ifxmips_mtd_driver); int ret = platform_driver_register(&ifxmips_mtd_driver);
if(ret) if (ret)
printk(KERN_INFO "ifxmips_mtd: error registering platfom driver!"); printk(KERN_INFO "ifxmips_mtd: error registering platfom driver!");
return ret; return ret;
} }
static void __exit static void __exit cleanup_ifxmips_mtd(void)
cleanup_ifxmips_mtd(void)
{ {
platform_driver_unregister(&ifxmips_mtd_driver); platform_driver_unregister(&ifxmips_mtd_driver);
} }

View file

@ -22,7 +22,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
@ -32,9 +32,9 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <asm/checksum.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/delay.h> #include <linux/delay.h>
#include <asm/checksum.h>
#include <asm/ifxmips/ifxmips.h> #include <asm/ifxmips/ifxmips.h>
#include <asm/ifxmips/ifxmips_dma.h> #include <asm/ifxmips/ifxmips_dma.h>
#include <asm/ifxmips/ifxmips_pmu.h> #include <asm/ifxmips/ifxmips_pmu.h>
@ -83,9 +83,9 @@ ifxmips_ifxmips_mii_open(struct net_device *dev)
struct dma_device_info* dma_dev = priv->dma_device; struct dma_device_info* dma_dev = priv->dma_device;
int i; int i;
for(i = 0; i < dma_dev->max_rx_chan_num; i++) for (i = 0; i < dma_dev->max_rx_chan_num; i++)
{ {
if((dma_dev->rx_chan[i])->control == IFXMIPS_DMA_CH_ON) if ((dma_dev->rx_chan[i])->control == IFXMIPS_DMA_CH_ON)
(dma_dev->rx_chan[i])->open(dma_dev->rx_chan[i]); (dma_dev->rx_chan[i])->open(dma_dev->rx_chan[i]);
} }
netif_start_queue(dev); netif_start_queue(dev);
@ -98,7 +98,7 @@ ifxmips_mii_release(struct net_device *dev){
struct dma_device_info* dma_dev = priv->dma_device; struct dma_device_info* dma_dev = priv->dma_device;
int i; int i;
for(i = 0; i < dma_dev->max_rx_chan_num; i++) for (i = 0; i < dma_dev->max_rx_chan_num; i++)
dma_dev->rx_chan[i]->close(dma_dev->rx_chan[i]); dma_dev->rx_chan[i]->close(dma_dev->rx_chan[i]);
netif_stop_queue(dev); netif_stop_queue(dev);
return 0; return 0;
@ -114,7 +114,7 @@ ifxmips_mii_hw_receive(struct net_device* dev,struct dma_device_info* dma_dev)
len = dma_device_read(dma_dev, &buf, (void**)&skb); len = dma_device_read(dma_dev, &buf, (void**)&skb);
if(len >= ETHERNET_PACKET_DMA_BUFFER_SIZE) if (len >= ETHERNET_PACKET_DMA_BUFFER_SIZE)
{ {
printk(KERN_INFO "ifxmips_mii0: packet too large %d\n",len); printk(KERN_INFO "ifxmips_mii0: packet too large %d\n",len);
goto ifxmips_mii_hw_receive_err_exit; goto ifxmips_mii_hw_receive_err_exit;
@ -122,13 +122,13 @@ ifxmips_mii_hw_receive(struct net_device* dev,struct dma_device_info* dma_dev)
/* remove CRC */ /* remove CRC */
len -= 4; len -= 4;
if(skb == NULL) if (skb == NULL)
{ {
printk(KERN_INFO "ifxmips_mii0: cannot restore pointer\n"); printk(KERN_INFO "ifxmips_mii0: cannot restore pointer\n");
goto ifxmips_mii_hw_receive_err_exit; goto ifxmips_mii_hw_receive_err_exit;
} }
if(len > (skb->end - skb->tail)) if (len > (skb->end - skb->tail))
{ {
printk(KERN_INFO "ifxmips_mii0: BUG, len:%d end:%p tail:%p\n", printk(KERN_INFO "ifxmips_mii0: BUG, len:%d end:%p tail:%p\n",
(len+4), skb->end, skb->tail); (len+4), skb->end, skb->tail);
@ -145,9 +145,9 @@ ifxmips_mii_hw_receive(struct net_device* dev,struct dma_device_info* dma_dev)
return 0; return 0;
ifxmips_mii_hw_receive_err_exit: ifxmips_mii_hw_receive_err_exit:
if(len == 0) if (len == 0)
{ {
if(skb) if (skb)
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
priv->stats.rx_errors++; priv->stats.rx_errors++;
priv->stats.rx_dropped++; priv->stats.rx_dropped++;
@ -185,7 +185,7 @@ ifxmips_mii_tx(struct sk_buff *skb, struct net_device *dev)
wmb(); wmb();
if(ifxmips_mii_hw_tx(data, len, dev) != len) if (ifxmips_mii_hw_tx(data, len, dev) != len)
{ {
dev_kfree_skb_any(skb); dev_kfree_skb_any(skb);
priv->stats.tx_errors++; priv->stats.tx_errors++;
@ -205,7 +205,7 @@ ifxmips_mii_tx_timeout(struct net_device *dev)
struct ifxmips_mii_priv* priv = (struct ifxmips_mii_priv*)dev->priv; struct ifxmips_mii_priv* priv = (struct ifxmips_mii_priv*)dev->priv;
priv->stats.tx_errors++; priv->stats.tx_errors++;
for(i = 0; i < priv->dma_device->max_tx_chan_num; i++) for (i = 0; i < priv->dma_device->max_tx_chan_num; i++)
priv->dma_device->tx_chan[i]->disable_irq(priv->dma_device->tx_chan[i]); priv->dma_device->tx_chan[i]->disable_irq(priv->dma_device->tx_chan[i]);
netif_wake_queue(dev); netif_wake_queue(dev);
return; return;
@ -233,7 +233,7 @@ dma_intr_handler(struct dma_device_info* dma_dev, int status)
break; break;
case TRANSMIT_CPT_INT: case TRANSMIT_CPT_INT:
for(i = 0; i < dma_dev->max_tx_chan_num; i++) for (i = 0; i < dma_dev->max_tx_chan_num; i++)
dma_dev->tx_chan[i]->disable_irq(dma_dev->tx_chan[i]); dma_dev->tx_chan[i]->disable_irq(dma_dev->tx_chan[i]);
netif_wake_queue(ifxmips_mii0_dev); netif_wake_queue(ifxmips_mii0_dev);
@ -250,7 +250,7 @@ ifxmips_etop_dma_buffer_alloc(int len, int *byte_offset, void **opt)
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
skb = dev_alloc_skb(ETHERNET_PACKET_DMA_BUFFER_SIZE); skb = dev_alloc_skb(ETHERNET_PACKET_DMA_BUFFER_SIZE);
if(skb == NULL) if (skb == NULL)
return NULL; return NULL;
buffer = (unsigned char*)(skb->data); buffer = (unsigned char*)(skb->data);
@ -266,7 +266,7 @@ ifxmips_etop_dma_buffer_free(unsigned char *dataptr, void *opt)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
if(opt == NULL) if (opt == NULL)
{ {
kfree(dataptr); kfree(dataptr);
} else { } else {
@ -298,7 +298,7 @@ ifxmips_mii_dev_init(struct net_device *dev)
memset(dev->priv, 0, sizeof(struct ifxmips_mii_priv)); memset(dev->priv, 0, sizeof(struct ifxmips_mii_priv));
priv = dev->priv; priv = dev->priv;
priv->dma_device = dma_device_reserve("PPE"); priv->dma_device = dma_device_reserve("PPE");
if(!priv->dma_device){ if (!priv->dma_device){
BUG(); BUG();
return -ENODEV; return -ENODEV;
} }
@ -307,14 +307,14 @@ ifxmips_mii_dev_init(struct net_device *dev)
priv->dma_device->intr_handler = &dma_intr_handler; priv->dma_device->intr_handler = &dma_intr_handler;
priv->dma_device->max_rx_chan_num = 4; priv->dma_device->max_rx_chan_num = 4;
for(i = 0; i < priv->dma_device->max_rx_chan_num; i++) for (i = 0; i < priv->dma_device->max_rx_chan_num; i++)
{ {
priv->dma_device->rx_chan[i]->packet_size = ETHERNET_PACKET_DMA_BUFFER_SIZE; priv->dma_device->rx_chan[i]->packet_size = ETHERNET_PACKET_DMA_BUFFER_SIZE;
priv->dma_device->rx_chan[i]->control = IFXMIPS_DMA_CH_ON; priv->dma_device->rx_chan[i]->control = IFXMIPS_DMA_CH_ON;
} }
for(i = 0; i < priv->dma_device->max_tx_chan_num; i++) for (i = 0; i < priv->dma_device->max_tx_chan_num; i++)
if(i == 0) if (i == 0)
priv->dma_device->tx_chan[i]->control = IFXMIPS_DMA_CH_ON; priv->dma_device->tx_chan[i]->control = IFXMIPS_DMA_CH_ON;
else else
priv->dma_device->tx_chan[i]->control = IFXMIPS_DMA_CH_OFF; priv->dma_device->tx_chan[i]->control = IFXMIPS_DMA_CH_OFF;
@ -322,7 +322,7 @@ ifxmips_mii_dev_init(struct net_device *dev)
dma_device_register(priv->dma_device); dma_device_register(priv->dma_device);
printk(KERN_INFO "ifxmips_mii0: using mac="); printk(KERN_INFO "ifxmips_mii0: using mac=");
for(i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
dev->dev_addr[i] = mac_addr[i]; dev->dev_addr[i] = mac_addr[i];
printk("%02X%c", dev->dev_addr[i], (i == 5)?('\n'):(':')); printk("%02X%c", dev->dev_addr[i], (i == 5)?('\n'):(':'));
@ -336,9 +336,9 @@ ifxmips_mii_chip_init(int mode)
ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_DMA); ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_DMA);
ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_PPE); ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_PPE);
if(mode == REV_MII_MODE) if (mode == REV_MII_MODE)
ifxmips_w32_mask(PPE32_MII_MASK, PPE32_MII_REVERSE, IFXMIPS_PPE32_CFG); ifxmips_w32_mask(PPE32_MII_MASK, PPE32_MII_REVERSE, IFXMIPS_PPE32_CFG);
else if(mode == MII_MODE) else if (mode == MII_MODE)
ifxmips_w32_mask(PPE32_MII_MASK, PPE32_MII_NORMAL, IFXMIPS_PPE32_CFG); ifxmips_w32_mask(PPE32_MII_MASK, PPE32_MII_NORMAL, IFXMIPS_PPE32_CFG);
ifxmips_w32(PPE32_PLEN_UNDER | PPE32_PLEN_OVER, IFXMIPS_PPE32_IG_PLEN_CTRL); ifxmips_w32(PPE32_PLEN_UNDER | PPE32_PLEN_OVER, IFXMIPS_PPE32_IG_PLEN_CTRL);
ifxmips_w32(PPE32_CGEN, IFXMIPS_PPE32_ENET_MAC_CFG); ifxmips_w32(PPE32_CGEN, IFXMIPS_PPE32_ENET_MAC_CFG);

View file

@ -0,0 +1,5 @@
BOARDNAME:=Generic
define Target/Description
Build standard images for Infineon CPE devices
endef

View file

@ -0,0 +1,7 @@
# 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

View file

@ -0,0 +1,3 @@
echo "- init nfs -"
exec /sbin/init

View file

@ -0,0 +1,16 @@
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MD5=y
CONFIG_IP_PNP=y
# CONFIG_IP_PNP_BOOTP is not set
# CONFIG_IP_PNP_DHCP is not set
# CONFIG_IP_PNP_RARP is not set
CONFIG_LOCKD=y
CONFIG_NFS_FS=y
CONFIG_ROOT_NFS=y
CONFIG_RPCSEC_GSS_KRB5=y
CONFIG_SUNRPC=y
CONFIG_SUNRPC_GSS=y

View file

@ -0,0 +1,8 @@
BOARDNAME:=NFS Root
FEATURES:=tgz
DEVICE_TYPE:=modem
define Target/Description
Build images for Infineon CPE devices for NFS boot
endef

View file

@ -0,0 +1,17 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Profile/None
NAME:=Generic, No WiFi
PACKAGES:=
endef
define Profile/None/Description
Package set without WiFi support
endef
$(eval $(call Profile,None))