finally move buildroot-ng to trunk
This commit is contained in:
9549
target/linux/ar7-2.4/patches/000-ar7_support.patch
Normal file
9549
target/linux/ar7-2.4/patches/000-ar7_support.patch
Normal file
File diff suppressed because it is too large
Load Diff
307
target/linux/ar7-2.4/patches/001-flash_map.patch
Normal file
307
target/linux/ar7-2.4/patches/001-flash_map.patch
Normal file
@@ -0,0 +1,307 @@
|
||||
diff -urN linux.old/drivers/mtd/maps/ar7-flash.c linux.dev/drivers/mtd/maps/ar7-flash.c
|
||||
--- linux.old/drivers/mtd/maps/ar7-flash.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux.dev/drivers/mtd/maps/ar7-flash.c 2005-07-22 04:35:26.624453992 +0200
|
||||
@@ -0,0 +1,267 @@
|
||||
+/*
|
||||
+ * $Id$
|
||||
+ *
|
||||
+ * Normal mappings of chips in physical memory
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <asm/io.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <linux/mtd/map.h>
|
||||
+#include <linux/config.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
+#include <linux/squashfs_fs.h>
|
||||
+
|
||||
+#define WINDOW_ADDR CONFIG_MTD_AR7_START
|
||||
+#define WINDOW_SIZE CONFIG_MTD_AR7_LEN
|
||||
+#define BUSWIDTH CONFIG_MTD_AR7_BUSWIDTH
|
||||
+
|
||||
+#include <asm/mips-boards/prom.h>
|
||||
+extern char *prom_getenv(char *name);
|
||||
+
|
||||
+static int create_mtd_partitions(void);
|
||||
+static void __exit ar7_mtd_cleanup(void);
|
||||
+
|
||||
+#define MAX_NUM_PARTITIONS 5
|
||||
+static struct mtd_partition ar7_partinfo[MAX_NUM_PARTITIONS];
|
||||
+
|
||||
+static struct mtd_info *ar7_mtd_info;
|
||||
+
|
||||
+__u8 ar7_read8(struct map_info *map, unsigned long ofs)
|
||||
+{
|
||||
+ return __raw_readb(map->map_priv_1 + ofs);
|
||||
+}
|
||||
+
|
||||
+__u16 ar7_read16(struct map_info *map, unsigned long ofs)
|
||||
+{
|
||||
+ return __raw_readw(map->map_priv_1 + ofs);
|
||||
+}
|
||||
+
|
||||
+__u32 ar7_read32(struct map_info *map, unsigned long ofs)
|
||||
+{
|
||||
+ return __raw_readl(map->map_priv_1 + ofs);
|
||||
+}
|
||||
+
|
||||
+void ar7_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
|
||||
+{
|
||||
+ memcpy_fromio(to, map->map_priv_1 + from, len);
|
||||
+}
|
||||
+
|
||||
+void ar7_write8(struct map_info *map, __u8 d, unsigned long adr)
|
||||
+{
|
||||
+ __raw_writeb(d, map->map_priv_1 + adr);
|
||||
+ mb();
|
||||
+}
|
||||
+
|
||||
+void ar7_write16(struct map_info *map, __u16 d, unsigned long adr)
|
||||
+{
|
||||
+ __raw_writew(d, map->map_priv_1 + adr);
|
||||
+ mb();
|
||||
+}
|
||||
+
|
||||
+void ar7_write32(struct map_info *map, __u32 d, unsigned long adr)
|
||||
+{
|
||||
+ __raw_writel(d, map->map_priv_1 + adr);
|
||||
+ mb();
|
||||
+}
|
||||
+
|
||||
+void ar7_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
|
||||
+{
|
||||
+ memcpy_toio(map->map_priv_1 + to, from, len);
|
||||
+}
|
||||
+
|
||||
+struct map_info ar7_map = {
|
||||
+ name: "Physically mapped flash",
|
||||
+ size: WINDOW_SIZE,
|
||||
+ buswidth: BUSWIDTH,
|
||||
+ read8: ar7_read8,
|
||||
+ read16: ar7_read16,
|
||||
+ read32: ar7_read32,
|
||||
+ copy_from: ar7_copy_from,
|
||||
+ write8: ar7_write8,
|
||||
+ write16: ar7_write16,
|
||||
+ write32: ar7_write32,
|
||||
+ copy_to: ar7_copy_to
|
||||
+};
|
||||
+
|
||||
+int __init ar7_mtd_init(void)
|
||||
+{
|
||||
+ int partitions;
|
||||
+
|
||||
+ printk(KERN_NOTICE "ar7 flash device: 0x%lx at 0x%lx.\n", (unsigned long)WINDOW_SIZE, (unsigned long)WINDOW_ADDR);
|
||||
+ ar7_map.map_priv_1 = (unsigned long)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
|
||||
+
|
||||
+ if (!ar7_map.map_priv_1) {
|
||||
+ printk("Failed to ioremap\n");
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ ar7_mtd_info = do_map_probe("cfi_probe", &ar7_map);
|
||||
+ if (!ar7_mtd_info)
|
||||
+ {
|
||||
+ ar7_mtd_cleanup();
|
||||
+ return -ENXIO;
|
||||
+ }
|
||||
+
|
||||
+ ar7_mtd_info->module = THIS_MODULE;
|
||||
+
|
||||
+ if (!(partitions = create_mtd_partitions()))
|
||||
+ add_mtd_device(ar7_mtd_info);
|
||||
+ else
|
||||
+ add_mtd_partitions(ar7_mtd_info, ar7_partinfo, partitions);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static char *strdup(char *str)
|
||||
+{
|
||||
+ int n = strlen(str)+1;
|
||||
+ char *s = kmalloc(n, GFP_KERNEL);
|
||||
+ if (!s) return NULL;
|
||||
+ return strcpy(s, str);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int create_mtd_partitions(void)
|
||||
+{
|
||||
+ unsigned int offset;
|
||||
+ unsigned int size;
|
||||
+ unsigned int found = 0;
|
||||
+ unsigned int p = 0;
|
||||
+ unsigned char *flash_base;
|
||||
+ unsigned char *flash_end;
|
||||
+ char *env_ptr;
|
||||
+ char *base_ptr;
|
||||
+ char *end_ptr;
|
||||
+ unsigned int adam2_size = 0x20000;
|
||||
+ unsigned int config_offset = WINDOW_SIZE;
|
||||
+ unsigned int rootfs_start = 0xe0000;
|
||||
+
|
||||
+ printk("Parsing ADAM2 partition map...\n");
|
||||
+
|
||||
+ do {
|
||||
+ char env_name[20];
|
||||
+
|
||||
+ /* get base and end addresses of flash file system from environment */
|
||||
+ sprintf(env_name, "mtd%1u", p);
|
||||
+ printk("Looking for mtd device :%s:\n", env_name);
|
||||
+
|
||||
+ env_ptr = prom_getenv(env_name);
|
||||
+ if(env_ptr == NULL) {
|
||||
+ /* No more partitions to find */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Extract the start and stop addresses of the partition */
|
||||
+ base_ptr = strtok(env_ptr, ",");
|
||||
+ end_ptr = strtok(NULL, ",");
|
||||
+ if ((base_ptr == NULL) || (end_ptr == NULL)) {
|
||||
+ printk("ADAM2 partition error: Invalid %s start,end.\n", env_name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ flash_base = (unsigned char*) simple_strtol(base_ptr, NULL, 0);
|
||||
+ flash_end = (unsigned char*) simple_strtol(end_ptr, NULL, 0);
|
||||
+ if((!flash_base) || (!flash_end)) {
|
||||
+ printk("ADAM2 partition error: Invalid %s start,end.\n", env_name);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ offset = virt_to_bus(flash_base) - WINDOW_ADDR;
|
||||
+ size = flash_end - flash_base;
|
||||
+ printk("Found a %s image (0x%x), with size (0x%x).\n",env_name, offset, size);
|
||||
+
|
||||
+
|
||||
+ if (offset == 0) {
|
||||
+ printk("Assuming adam2 size of 0x%x\n", size);
|
||||
+ adam2_size = size; // boot loader
|
||||
+ } else if (offset > 0x120000) {
|
||||
+ if (config_offset > offset)
|
||||
+ config_offset = offset; // reserved at the end of the flash chip
|
||||
+ } else if (offset > 0x30000) {
|
||||
+ printk("Assuming default rootfs offset of 0x%x\n", offset);
|
||||
+ rootfs_start = offset; // probably root fs
|
||||
+ }
|
||||
+
|
||||
+ p++;
|
||||
+ } while (p < MAX_NUM_PARTITIONS);
|
||||
+
|
||||
+ p = 0;
|
||||
+
|
||||
+ ar7_partinfo[p].name = strdup("adam2");
|
||||
+ ar7_partinfo[p].offset = 0;
|
||||
+ ar7_partinfo[p].size = adam2_size;
|
||||
+ ar7_partinfo[p++].mask_flags = 0;
|
||||
+
|
||||
+ ar7_partinfo[p].name = strdup("linux");
|
||||
+ ar7_partinfo[p].offset = adam2_size;
|
||||
+ ar7_partinfo[p].size = config_offset - adam2_size;
|
||||
+ ar7_partinfo[p++].mask_flags = 0;
|
||||
+
|
||||
+ if (ar7_read32(&ar7_map, adam2_size) == 0xfeedfa42) {
|
||||
+ rootfs_start = ar7_read32(&ar7_map, adam2_size + 4) + adam2_size + 28;
|
||||
+ printk("Setting new rootfs offset to %08x\n", rootfs_start);
|
||||
+ }
|
||||
+
|
||||
+ ar7_partinfo[p].name = strdup("rootfs");
|
||||
+ ar7_partinfo[p].offset = rootfs_start;
|
||||
+ ar7_partinfo[p].size = config_offset - rootfs_start;
|
||||
+
|
||||
+ ar7_partinfo[p++].mask_flags = 0;
|
||||
+
|
||||
+ ar7_partinfo[p].name = strdup("config");
|
||||
+ ar7_partinfo[p].offset = config_offset;
|
||||
+ ar7_partinfo[p].size = WINDOW_SIZE - config_offset;
|
||||
+ ar7_partinfo[p++].mask_flags = 0;
|
||||
+
|
||||
+ if (ar7_read32(&ar7_map, rootfs_start) == SQUASHFS_MAGIC) {
|
||||
+ int newsize, newoffset;
|
||||
+ struct squashfs_super_block sb;
|
||||
+
|
||||
+ ar7_copy_from(&ar7_map, &sb, rootfs_start, sizeof(sb));
|
||||
+ printk("Squashfs detected (size = 0x%08x)\n", sb.bytes_used);
|
||||
+
|
||||
+ newoffset = rootfs_start + sb.bytes_used;
|
||||
+
|
||||
+ if ((newoffset % ar7_mtd_info->erasesize) > 0)
|
||||
+ newoffset += ar7_mtd_info->erasesize - (newoffset % ar7_mtd_info->erasesize);
|
||||
+
|
||||
+ ar7_partinfo[p - 2].size = newoffset - rootfs_start;
|
||||
+
|
||||
+ ar7_partinfo[p].name = strdup("OpenWrt");
|
||||
+ ar7_partinfo[p].offset = newoffset;
|
||||
+ ar7_partinfo[p].size = config_offset - newoffset;
|
||||
+ ar7_partinfo[p++].mask_flags = 0;
|
||||
+ } else {
|
||||
+ printk("Unknown filesystem. Moving rootfs partition to next erase block");
|
||||
+ if ((rootfs_start % ar7_mtd_info->erasesize) > 0) {
|
||||
+ ar7_partinfo[p - 2].offset += ar7_mtd_info->erasesize - (rootfs_start % ar7_mtd_info->erasesize);
|
||||
+ ar7_partinfo[p - 2].size -= ar7_mtd_info->erasesize - (rootfs_start % ar7_mtd_info->erasesize);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return p;
|
||||
+}
|
||||
+
|
||||
+static void __exit ar7_mtd_cleanup(void)
|
||||
+{
|
||||
+ if (ar7_mtd_info) {
|
||||
+ del_mtd_partitions(ar7_mtd_info);
|
||||
+ del_mtd_device(ar7_mtd_info);
|
||||
+ map_destroy(ar7_mtd_info);
|
||||
+ }
|
||||
+
|
||||
+ if (ar7_map.map_priv_1) {
|
||||
+ iounmap((void *)ar7_map.map_priv_1);
|
||||
+ ar7_map.map_priv_1 = 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+module_init(ar7_mtd_init);
|
||||
+module_exit(ar7_mtd_cleanup);
|
||||
+
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_AUTHOR("Felix Fietkau");
|
||||
+MODULE_DESCRIPTION("AR7 CFI map driver");
|
||||
diff -urN linux.old/drivers/mtd/maps/Config.in linux.dev/drivers/mtd/maps/Config.in
|
||||
--- linux.old/drivers/mtd/maps/Config.in 2005-07-21 05:36:32.414242296 +0200
|
||||
+++ linux.dev/drivers/mtd/maps/Config.in 2005-07-21 06:29:04.067118232 +0200
|
||||
@@ -48,6 +48,21 @@
|
||||
fi
|
||||
|
||||
if [ "$CONFIG_MIPS" = "y" ]; then
|
||||
+ if [ "$CONFIG_AR7" = "y" ]; then
|
||||
+ dep_tristate ' Flash chip mapping on Texas Instruments AR7' CONFIG_MTD_AR7 $CONFIG_MTD_CFI $CONFIG_MTD_PARTITIONS
|
||||
+ dep_bool ' Use defaults for Texas Instruments AR7' CONFIG_MTD_AR7_DEFAULTS $CONFIG_MTD_AR7
|
||||
+ if [ "$CONFIG_MTD_AR7" = "y" -o "$CONFIG_MTD_AR7" = "m" ]; then
|
||||
+ if [ "$CONFIG_MTD_AR7_DEFAULTS" = "y" ]; then
|
||||
+ define_hex CONFIG_MTD_AR7_START 0x10000000
|
||||
+ define_hex CONFIG_MTD_AR7_LEN 0x400000
|
||||
+ define_int CONFIG_MTD_AR7_BUSWIDTH 2
|
||||
+ else
|
||||
+ hex ' Physical start address of flash mapping' CONFIG_MTD_AR7_START 0x10000000
|
||||
+ hex ' Physical length of flash mapping' CONFIG_MTD_AR7_LEN 0x400000
|
||||
+ int ' Bus width in octets' CONFIG_MTD_AR7_BUSWIDTH 2
|
||||
+ fi
|
||||
+ fi
|
||||
+ fi
|
||||
dep_tristate ' Pb1000 MTD support' CONFIG_MTD_PB1000 $CONFIG_MIPS_PB1000
|
||||
dep_tristate ' Pb1500 MTD support' CONFIG_MTD_PB1500 $CONFIG_MIPS_PB1500
|
||||
dep_tristate ' Pb1100 MTD support' CONFIG_MTD_PB1100 $CONFIG_MIPS_PB1100
|
||||
diff -urN linux.old/drivers/mtd/maps/Makefile linux.dev/drivers/mtd/maps/Makefile
|
||||
--- linux.old/drivers/mtd/maps/Makefile 2005-07-21 05:36:32.414242296 +0200
|
||||
+++ linux.dev/drivers/mtd/maps/Makefile 2005-07-21 06:56:33.265401984 +0200
|
||||
@@ -10,6 +10,7 @@
|
||||
endif
|
||||
|
||||
# Chip mappings
|
||||
+obj-$(CONFIG_MTD_AR7) += ar7-flash.o
|
||||
obj-$(CONFIG_MTD_CDB89712) += cdb89712.o
|
||||
obj-$(CONFIG_MTD_ARM_INTEGRATOR)+= integrator-flash.o
|
||||
obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o
|
||||
1915
target/linux/ar7-2.4/patches/002-led_driver.patch
Normal file
1915
target/linux/ar7-2.4/patches/002-led_driver.patch
Normal file
File diff suppressed because it is too large
Load Diff
13341
target/linux/ar7-2.4/patches/003-net_driver_cpmac.patch
Normal file
13341
target/linux/ar7-2.4/patches/003-net_driver_cpmac.patch
Normal file
File diff suppressed because it is too large
Load Diff
27232
target/linux/ar7-2.4/patches/004-atm_driver.patch
Normal file
27232
target/linux/ar7-2.4/patches/004-atm_driver.patch
Normal file
File diff suppressed because it is too large
Load Diff
392
target/linux/ar7-2.4/patches/005-wdt_driver.patch
Normal file
392
target/linux/ar7-2.4/patches/005-wdt_driver.patch
Normal file
@@ -0,0 +1,392 @@
|
||||
diff -ruN linux-2.4.30-patch006/drivers/char/ar7_wdt.c linux-2.4.30-patch007/drivers/char/ar7_wdt.c
|
||||
--- linux-2.4.30-patch006/drivers/char/ar7_wdt.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-2.4.30-patch007/drivers/char/ar7_wdt.c 2005-10-27 09:39:40.000000000 +0200
|
||||
@@ -0,0 +1,335 @@
|
||||
+/* linux/drivers/char/ar7_wdt.c
|
||||
+
|
||||
+ TI AR7 watch dog timer support
|
||||
+
|
||||
+ Copyright (c) 2005 Enrik Berkhan <Enrik.Berkhan@akk.org>
|
||||
+
|
||||
+ Som code taken from:
|
||||
+ National Semiconductor SCx200 Watchdog support
|
||||
+ Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
|
||||
+
|
||||
+ 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.
|
||||
+
|
||||
+ The author(s) of this software shall not be held liable for damages
|
||||
+ of any nature resulting due to the use of this software. This
|
||||
+ software is provided AS-IS with no warranties. */
|
||||
+
|
||||
+#include <linux/config.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/errno.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/miscdevice.h>
|
||||
+#include <linux/watchdog.h>
|
||||
+#include <linux/notifier.h>
|
||||
+#include <linux/reboot.h>
|
||||
+#include <linux/ioport.h>
|
||||
+
|
||||
+#include <asm/uaccess.h>
|
||||
+
|
||||
+#include <asm/ar7/avalanche_misc.h>
|
||||
+#include <asm/ar7/sangam.h>
|
||||
+
|
||||
+#define NAME "ar7_wdt"
|
||||
+#define LONGNAME "TI AR7 Watchdog Timer"
|
||||
+
|
||||
+MODULE_AUTHOR("Enrik Berkhan <Enrik.Berkhan@akk.org>");
|
||||
+MODULE_DESCRIPTION(LONGNAME);
|
||||
+MODULE_LICENSE("GPL");
|
||||
+
|
||||
+#ifndef CONFIG_WATCHDOG_NOWAYOUT
|
||||
+#define CONFIG_WATCHDOG_NOWAYOUT 0
|
||||
+#endif
|
||||
+
|
||||
+static int margin = 60;
|
||||
+MODULE_PARM(margin, "i");
|
||||
+MODULE_PARM_DESC(margin, "Watchdog margin in seconds (1 - ~68)");
|
||||
+
|
||||
+static int nowayout = CONFIG_WATCHDOG_NOWAYOUT;
|
||||
+MODULE_PARM(nowayout, "i");
|
||||
+MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
|
||||
+
|
||||
+typedef struct {
|
||||
+ uint32_t kick_lock;
|
||||
+ uint32_t kick;
|
||||
+ uint32_t change_lock;
|
||||
+ uint32_t change ;
|
||||
+ uint32_t disable_lock;
|
||||
+ uint32_t disable;
|
||||
+ uint32_t prescale_lock;
|
||||
+ uint32_t prescale;
|
||||
+} ar7_wdt_t;
|
||||
+
|
||||
+volatile ar7_wdt_t *ar7_wdt = (ar7_wdt_t *)AVALANCHE_WATCHDOG_TIMER_BASE;
|
||||
+
|
||||
+static struct semaphore open_semaphore;
|
||||
+static unsigned expect_close;
|
||||
+
|
||||
+/* XXX correct? assumed to be sysfreq/2. get this dynamically ... */
|
||||
+#define vbus_freq 62500000
|
||||
+
|
||||
+/* XXX currently fixed, allows max margin ~68.72 secs */
|
||||
+#define prescale_value 0xFFFF
|
||||
+
|
||||
+static void ar7_wdt_kick(uint32_t value)
|
||||
+{
|
||||
+ ar7_wdt->kick_lock = 0x5555;
|
||||
+ if ((ar7_wdt->kick_lock & 3) == 1) {
|
||||
+ ar7_wdt->kick_lock = 0xAAAA;
|
||||
+ if ((ar7_wdt->kick_lock & 3) == 3) {
|
||||
+ ar7_wdt->kick = value;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ printk(KERN_ERR NAME "failed to unlock WDT kick reg\n");
|
||||
+}
|
||||
+
|
||||
+static void ar7_wdt_prescale(uint32_t value)
|
||||
+{
|
||||
+ ar7_wdt->prescale_lock = 0x5A5A;
|
||||
+ if ((ar7_wdt->prescale_lock & 3) == 1) {
|
||||
+ ar7_wdt->prescale_lock = 0xA5A5;
|
||||
+ if ((ar7_wdt->prescale_lock & 3) == 3) {
|
||||
+ ar7_wdt->prescale = value;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ printk(KERN_ERR NAME "failed to unlock WDT prescale reg\n");
|
||||
+}
|
||||
+
|
||||
+static void ar7_wdt_change(uint32_t value)
|
||||
+{
|
||||
+ ar7_wdt->change_lock = 0x6666;
|
||||
+ if ((ar7_wdt->change_lock & 3) == 1) {
|
||||
+ ar7_wdt->change_lock = 0xBBBB;
|
||||
+ if ((ar7_wdt->change_lock & 3) == 3) {
|
||||
+ ar7_wdt->change = value;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ printk(KERN_ERR NAME "failed to unlock WDT change reg\n");
|
||||
+}
|
||||
+
|
||||
+static void ar7_wdt_disable(uint32_t value)
|
||||
+{
|
||||
+ ar7_wdt->disable_lock = 0x7777;
|
||||
+ if ((ar7_wdt->disable_lock & 3) == 1) {
|
||||
+ ar7_wdt->disable_lock = 0xCCCC;
|
||||
+ if ((ar7_wdt->disable_lock & 3) == 2) {
|
||||
+ ar7_wdt->disable_lock = 0xDDDD;
|
||||
+ if ((ar7_wdt->disable_lock & 3) == 3) {
|
||||
+ ar7_wdt->disable = value;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ printk(KERN_ERR NAME "failed to unlock WDT disable reg\n");
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+static void ar7_wdt_update_margin(int new_margin)
|
||||
+{
|
||||
+ uint32_t change;
|
||||
+
|
||||
+ change = new_margin * (vbus_freq / prescale_value);
|
||||
+ if (change < 1) change = 1;
|
||||
+ if (change > 0xFFFF) change = 0xFFFF;
|
||||
+ ar7_wdt_change(change);
|
||||
+ margin = change * prescale_value / vbus_freq;
|
||||
+ printk(KERN_INFO NAME
|
||||
+ ": timer margin %d seconds (prescale %d, change %d, freq %d)\n",
|
||||
+ margin, prescale_value, change, vbus_freq);
|
||||
+}
|
||||
+
|
||||
+static void ar7_wdt_enable_wdt(void)
|
||||
+{
|
||||
+ printk(KERN_DEBUG NAME ": enabling watchdog timer\n");
|
||||
+ ar7_wdt_disable(1);
|
||||
+ ar7_wdt_kick(1);
|
||||
+}
|
||||
+
|
||||
+static void ar7_wdt_disable_wdt(void)
|
||||
+{
|
||||
+ printk(KERN_DEBUG NAME ": disabling watchdog timer\n");
|
||||
+ ar7_wdt_disable(0);
|
||||
+}
|
||||
+
|
||||
+static int ar7_wdt_open(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ /* only allow one at a time */
|
||||
+ if (down_trylock(&open_semaphore))
|
||||
+ return -EBUSY;
|
||||
+ ar7_wdt_enable_wdt();
|
||||
+ expect_close = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ar7_wdt_release(struct inode *inode, struct file *file)
|
||||
+{
|
||||
+ if (!expect_close) {
|
||||
+ printk(KERN_WARNING NAME ": watchdog device closed unexpectedly, will not disable the watchdog timer\n");
|
||||
+ } else if (!nowayout) {
|
||||
+ ar7_wdt_disable_wdt();
|
||||
+ }
|
||||
+ up(&open_semaphore);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ar7_wdt_notify_sys(struct notifier_block *this,
|
||||
+ unsigned long code, void *unused)
|
||||
+{
|
||||
+ if (code == SYS_HALT || code == SYS_POWER_OFF)
|
||||
+ if (!nowayout)
|
||||
+ ar7_wdt_disable_wdt();
|
||||
+
|
||||
+ return NOTIFY_DONE;
|
||||
+}
|
||||
+
|
||||
+static struct notifier_block ar7_wdt_notifier =
|
||||
+{
|
||||
+ .notifier_call = ar7_wdt_notify_sys
|
||||
+};
|
||||
+
|
||||
+static ssize_t ar7_wdt_write(struct file *file, const char *data,
|
||||
+ size_t len, loff_t *ppos)
|
||||
+{
|
||||
+ if (ppos != &file->f_pos)
|
||||
+ return -ESPIPE;
|
||||
+
|
||||
+ /* check for a magic close character */
|
||||
+ if (len)
|
||||
+ {
|
||||
+ size_t i;
|
||||
+
|
||||
+ ar7_wdt_kick(1);
|
||||
+
|
||||
+ 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;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+static int ar7_wdt_ioctl(struct inode *inode, struct file *file,
|
||||
+ unsigned int cmd, unsigned long arg)
|
||||
+{
|
||||
+ static struct watchdog_info ident = {
|
||||
+ .identity = LONGNAME,
|
||||
+ .firmware_version = 1,
|
||||
+ .options = (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING),
|
||||
+ };
|
||||
+ int new_margin;
|
||||
+
|
||||
+ 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:
|
||||
+ if (put_user(0, (int *)arg))
|
||||
+ return -EFAULT;
|
||||
+ return 0;
|
||||
+ case WDIOC_KEEPALIVE:
|
||||
+ ar7_wdt_kick(1);
|
||||
+ return 0;
|
||||
+ case WDIOC_SETTIMEOUT:
|
||||
+ if (get_user(new_margin, (int *)arg))
|
||||
+ return -EFAULT;
|
||||
+ if (new_margin < 1)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ ar7_wdt_update_margin(new_margin);
|
||||
+ ar7_wdt_kick(1);
|
||||
+
|
||||
+ case WDIOC_GETTIMEOUT:
|
||||
+ if (put_user(margin, (int *)arg))
|
||||
+ return -EFAULT;
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static struct file_operations ar7_wdt_fops = {
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .write = ar7_wdt_write,
|
||||
+ .ioctl = ar7_wdt_ioctl,
|
||||
+ .open = ar7_wdt_open,
|
||||
+ .release = ar7_wdt_release,
|
||||
+};
|
||||
+
|
||||
+static struct miscdevice ar7_wdt_miscdev = {
|
||||
+ .minor = WATCHDOG_MINOR,
|
||||
+ .name = "watchdog",
|
||||
+ .fops = &ar7_wdt_fops,
|
||||
+};
|
||||
+
|
||||
+static __initdata char *last_initiator[] = {
|
||||
+ [HARDWARE_RESET] = "hardware reset",
|
||||
+ [SOFTWARE_RESET0] = "SW0 software reset",
|
||||
+ [SOFTWARE_RESET1] = "SW1 software reset",
|
||||
+ [WATCHDOG_RESET] = "watchdog"
|
||||
+};
|
||||
+
|
||||
+static int __init ar7_wdt_init(void)
|
||||
+{
|
||||
+ int r;
|
||||
+
|
||||
+ if (!request_mem_region(AVALANCHE_WATCHDOG_TIMER_BASE,
|
||||
+ sizeof(ar7_wdt_t), LONGNAME)) {
|
||||
+ printk(KERN_WARNING NAME ": watchdog I/O region busy\n");
|
||||
+ return -EBUSY;
|
||||
+ }
|
||||
+
|
||||
+ printk(KERN_INFO NAME ": last system reset initiated by %s\n",
|
||||
+ last_initiator[avalanche_get_sys_last_reset_status()]);
|
||||
+
|
||||
+
|
||||
+ ar7_wdt_disable_wdt();
|
||||
+ ar7_wdt_prescale(prescale_value);
|
||||
+ ar7_wdt_update_margin(margin);
|
||||
+
|
||||
+ sema_init(&open_semaphore, 1);
|
||||
+
|
||||
+ r = misc_register(&ar7_wdt_miscdev);
|
||||
+ if (r) {
|
||||
+ printk(KERN_ERR NAME ": unable to register misc device\n");
|
||||
+ release_mem_region(AVALANCHE_WATCHDOG_TIMER_BASE,
|
||||
+ sizeof(ar7_wdt_t));
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ r = register_reboot_notifier(&ar7_wdt_notifier);
|
||||
+ if (r) {
|
||||
+ printk(KERN_ERR NAME ": unable to register reboot notifier\n");
|
||||
+ misc_deregister(&ar7_wdt_miscdev);
|
||||
+ release_mem_region(AVALANCHE_WATCHDOG_TIMER_BASE,
|
||||
+ sizeof(ar7_wdt_t));
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __exit ar7_wdt_cleanup(void)
|
||||
+{
|
||||
+ unregister_reboot_notifier(&ar7_wdt_notifier);
|
||||
+ misc_deregister(&ar7_wdt_miscdev);
|
||||
+ release_mem_region(AVALANCHE_WATCHDOG_TIMER_BASE, sizeof(ar7_wdt_t));
|
||||
+}
|
||||
+
|
||||
+module_init(ar7_wdt_init);
|
||||
+module_exit(ar7_wdt_cleanup);
|
||||
diff -ruN linux-2.4.30-patch006/drivers/char/Config.in linux-2.4.30-patch007/drivers/char/Config.in
|
||||
--- linux-2.4.30-patch006/drivers/char/Config.in 2005-10-27 11:25:29.000000000 +0200
|
||||
+++ linux-2.4.30-patch007/drivers/char/Config.in 2005-10-27 11:17:32.000000000 +0200
|
||||
@@ -251,6 +251,9 @@
|
||||
bool 'Watchdog Timer Support' CONFIG_WATCHDOG
|
||||
if [ "$CONFIG_WATCHDOG" != "n" ]; then
|
||||
bool ' Disable watchdog shutdown on close' CONFIG_WATCHDOG_NOWAYOUT
|
||||
+ if [ "$CONFIG_AR7" = "y" ] ; then
|
||||
+ tristate ' TI AR7 Watchdog Timer' CONFIG_AR7_WDT
|
||||
+ else
|
||||
tristate ' Acquire SBC Watchdog Timer' CONFIG_ACQUIRE_WDT
|
||||
tristate ' Advantech SBC Watchdog Timer' CONFIG_ADVANTECH_WDT
|
||||
tristate ' ALi M7101 PMU on ALi 1535D+ Watchdog Timer' CONFIG_ALIM1535_WDT
|
||||
@@ -271,7 +274,6 @@
|
||||
tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT
|
||||
dep_tristate ' SC1200 Watchdog Timer (EXPERIMENTAL)' CONFIG_SC1200_WDT $CONFIG_EXPERIMENTAL
|
||||
tristate ' NatSemi SCx200 Watchdog' CONFIG_SCx200_WDT
|
||||
- tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG
|
||||
tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT
|
||||
tristate ' WDT Watchdog timer' CONFIG_WDT
|
||||
tristate ' WDT PCI Watchdog timer' CONFIG_WDTPCI
|
||||
@@ -282,6 +284,8 @@
|
||||
fi
|
||||
fi
|
||||
tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
|
||||
+ fi
|
||||
+ tristate ' Software Watchdog' CONFIG_SOFT_WATCHDOG
|
||||
if [ "$CONFIG_SGI_IP22" = "y" ]; then
|
||||
dep_tristate ' Indy/I2 Hardware Watchdog' CONFIG_INDYDOG $CONFIG_SGI_IP22
|
||||
fi
|
||||
diff -ruN linux-2.4.30-patch006/drivers/char/Makefile linux-2.4.30-patch007/drivers/char/Makefile
|
||||
--- linux-2.4.30-patch006/drivers/char/Makefile 2005-10-27 11:19:38.000000000 +0200
|
||||
+++ linux-2.4.30-patch007/drivers/char/Makefile 2005-10-27 09:39:40.000000000 +0200
|
||||
@@ -342,6 +342,7 @@
|
||||
obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
|
||||
obj-$(CONFIG_INDYDOG) += indydog.o
|
||||
obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
|
||||
+obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
|
||||
|
||||
subdir-$(CONFIG_MWAVE) += mwave
|
||||
ifeq ($(CONFIG_MWAVE),y)
|
||||
diff -ruN linux-2.4.30-patch006/include/asm-mips/ar7/sangam.h linux-2.4.30-patch007/include/asm-mips/ar7/sangam.h
|
||||
--- linux-2.4.30-patch006/include/asm-mips/ar7/sangam.h 2005-10-27 11:25:51.000000000 +0200
|
||||
+++ linux-2.4.30-patch007/include/asm-mips/ar7/sangam.h 2005-10-27 11:13:37.000000000 +0200
|
||||
@@ -152,7 +152,7 @@
|
||||
#define AVALANCHE_EMIF_SDRAM_CFG (AVALANCHE_EMIF_CONTROL_BASE + 0x8)
|
||||
#define AVALANCHE_RST_CTRL_PRCR (KSEG1ADDR(0x08611600))
|
||||
#define AVALANCHE_RST_CTRL_SWRCR (KSEG1ADDR(0x08611604))
|
||||
-#define AVALANCHE_RST_CTRL_RSR (KSEG1ADDR(0x08611600))
|
||||
+#define AVALANCHE_RST_CTRL_RSR (KSEG1ADDR(0x08611608))
|
||||
|
||||
#define AVALANCHE_POWER_CTRL_PDCR (KSEG1ADDR(0x08610A00))
|
||||
#define AVALANCHE_WAKEUP_CTRL_WKCR (KSEG1ADDR(0x08610A0C))
|
||||
84
target/linux/ar7-2.4/patches/006-sched_use_tsc.patch
Normal file
84
target/linux/ar7-2.4/patches/006-sched_use_tsc.patch
Normal file
@@ -0,0 +1,84 @@
|
||||
diff -urN linux.old/arch/mips/kernel/time.c linux.dev/arch/mips/kernel/time.c
|
||||
--- linux.old/arch/mips/kernel/time.c 2005-11-14 11:06:38.661262000 +0100
|
||||
+++ linux.dev/arch/mips/kernel/time.c 2005-11-15 20:02:50.059676750 +0100
|
||||
@@ -151,6 +151,27 @@
|
||||
unsigned int (*mips_hpt_read)(void);
|
||||
void (*mips_hpt_init)(unsigned int);
|
||||
|
||||
+extern __u32 get_htscl(void)
|
||||
+{
|
||||
+ return timerhi;
|
||||
+}
|
||||
+
|
||||
+static __u64 tscll_last = 0;
|
||||
+
|
||||
+extern __u64 get_tscll(void)
|
||||
+{
|
||||
+ __u64 h = (__u64) timerhi;
|
||||
+ __u32 c = read_c0_count();
|
||||
+
|
||||
+ h <<= 32;
|
||||
+ h += c;
|
||||
+
|
||||
+ while (h < tscll_last)
|
||||
+ h += (((__u64) 1) << 32);
|
||||
+
|
||||
+ tscll_last = h;
|
||||
+ return h;
|
||||
+}
|
||||
|
||||
/*
|
||||
* timeofday services, for syscalls.
|
||||
@@ -761,3 +782,5 @@
|
||||
EXPORT_SYMBOL(to_tm);
|
||||
EXPORT_SYMBOL(rtc_set_time);
|
||||
EXPORT_SYMBOL(rtc_get_time);
|
||||
+EXPORT_SYMBOL(get_htscl);
|
||||
+EXPORT_SYMBOL(get_tscll);
|
||||
diff -urN linux.old/include/asm-mips/timex.h linux.dev/include/asm-mips/timex.h
|
||||
--- linux.old/include/asm-mips/timex.h 2005-11-14 11:06:38.685263500 +0100
|
||||
+++ linux.dev/include/asm-mips/timex.h 2005-11-14 11:02:21.069163500 +0100
|
||||
@@ -31,6 +31,19 @@
|
||||
return read_c0_count();
|
||||
}
|
||||
|
||||
+extern __u32 get_htscl(void);
|
||||
+extern __u64 get_tscll(void);
|
||||
+
|
||||
+#define rdtsc(low, high) \
|
||||
+ high = get_htscl(); \
|
||||
+ low = read_c0_count();
|
||||
+
|
||||
+#define rdtscl(low) \
|
||||
+ low = read_c0_count();
|
||||
+
|
||||
+#define rdtscll(val) \
|
||||
+ val = get_tscll();
|
||||
+
|
||||
#define vxtime_lock() do {} while (0)
|
||||
#define vxtime_unlock() do {} while (0)
|
||||
|
||||
diff -urN linux.old/include/net/pkt_sched.h linux.dev/include/net/pkt_sched.h
|
||||
--- linux.old/include/net/pkt_sched.h 2005-11-14 11:06:38.709265000 +0100
|
||||
+++ linux.dev/include/net/pkt_sched.h 2005-11-14 11:02:21.069163500 +0100
|
||||
@@ -5,7 +5,11 @@
|
||||
#define PSCHED_JIFFIES 2
|
||||
#define PSCHED_CPU 3
|
||||
|
||||
+#ifdef __mips__
|
||||
+#define PSCHED_CLOCK_SOURCE PSCHED_CPU
|
||||
+#else
|
||||
#define PSCHED_CLOCK_SOURCE PSCHED_JIFFIES
|
||||
+#endif
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/types.h>
|
||||
@@ -271,7 +275,7 @@
|
||||
#define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
|
||||
#define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
|
||||
|
||||
-#ifdef CONFIG_X86_TSC
|
||||
+#if defined(CONFIG_X86_TSC) || defined(__mips__)
|
||||
|
||||
#define PSCHED_GET_TIME(stamp) \
|
||||
({ u64 __cur; \
|
||||
Reference in New Issue
Block a user