diff options
16 files changed, 3285 insertions, 5 deletions
diff --git a/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch b/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch index 69d0c47282..5e180093a4 100644 --- a/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch +++ b/packages/linux/nas100d-kernel/2.6.14/60-nas100d-i2c.patch @@ -45,7 +45,7 @@ return 0; --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-nas100d/drivers/i2c/chips/pcf8563.c 2005-11-16 01:18:21.000000000 +0100 ++++ linux-nas100d/drivers/i2c/chips/pcf8563.c 2005-11-16 11:34:15.000000000 +0100 @@ -0,0 +1,547 @@ +/* + * pcf8563.c - An i2c driver for the Philips PCF8563 RTC @@ -75,7 +75,7 @@ + +#include <linux/pcf8563.h> + -+#define DRV_VERSION "0.2" ++#define DRV_VERSION "0.3.1" + +/* Addresses to scan */ +static unsigned short normal_i2c[] = { 0x51, I2C_CLIENT_END }; @@ -213,9 +213,9 @@ + tm->tm_hour = BCD2BIN(buf[PCF8563_REG_HR] & 0x3F); /* rtc hr 0-23 */ + tm->tm_mday = BCD2BIN(buf[PCF8563_REG_DM] & 0x3F); + tm->tm_wday = buf[PCF8563_REG_DW] & 0x07; -+ tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MN] & 0x1F) - 1; /* rtc mn 1-12 */ ++ tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */ + tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR]) -+ + (buf[PCF8563_REG_MN] & 0x80 ? 100 : 0); ++ + (buf[PCF8563_REG_MO] & 0x80 ? 100 : 0); + + dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " + "mday=%d, mon=%d, year=%d, wday=%d\n", @@ -223,7 +223,7 @@ + tm->tm_sec, tm->tm_min, tm->tm_hour, + tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); + -+ if (!pcf8563_validate_tm(tm)) { ++ if (pcf8563_validate_tm(tm) < 0) { + dev_err(&client->dev, "retrieved date/time is not valid.\n"); + return -EINVAL; + } diff --git a/packages/linux/nas100d-kernel/2.6.15/.mtn2git_empty b/packages/linux/nas100d-kernel/2.6.15/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/.mtn2git_empty diff --git a/packages/linux/nas100d-kernel/2.6.15/00-memory-h-page-shift.patch b/packages/linux/nas100d-kernel/2.6.15/00-memory-h-page-shift.patch new file mode 100644 index 0000000000..29b048e27a --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/00-memory-h-page-shift.patch @@ -0,0 +1,10 @@ +--- linux-2.6.15/include/asm-arm/arch-ixp4xx/memory.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.15/include/asm-arm/arch-ixp4xx/memory.h 1970-01-01 00:00:00.000000000 +0000 +@@ -8,6 +8,7 @@ + #define __ASM_ARCH_MEMORY_H + + #include <asm/sizes.h> ++#include <asm/page.h> + + /* + * Physical DRAM offset. diff --git a/packages/linux/nas100d-kernel/2.6.15/01-i2c-ixp4xx.patch b/packages/linux/nas100d-kernel/2.6.15/01-i2c-ixp4xx.patch new file mode 100644 index 0000000000..16426bdee6 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/01-i2c-ixp4xx.patch @@ -0,0 +1,29 @@ +--- linux-2.6.15/drivers/i2c/busses/i2c-ixp4xx.c 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.15/drivers/i2c/busses/i2c-ixp4xx.c 1970-01-01 00:00:00.000000000 +0000 +@@ -35,7 +35,7 @@ + + #include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ + +-static struct device_driver ixp4xx_i2c_driver; ++static struct platform_driver ixp4xx_i2c_driver; + + static inline int ixp4xx_scl_pin(void *data) + { +@@ -128,7 +128,7 @@ static int ixp4xx_i2c_probe(struct platf + drv_data->algo_data.timeout = 100; + + drv_data->adapter.id = I2C_HW_B_IXP4XX; +- strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.name, ++ strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.driver.name, + I2C_NAME_SIZE); + drv_data->adapter.algo_data = &drv_data->algo_data; + +@@ -140,7 +140,7 @@ static int ixp4xx_i2c_probe(struct platf + gpio_line_set(gpio->sda_pin, 0); + + if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { +- printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id); ++ printk(KERN_ERR "ERROR: Could not install %s\n", ixp4xx_i2c_driver.driver.name); + + kfree(drv_data); + return err; diff --git a/packages/linux/nas100d-kernel/2.6.15/10-mtdpart-redboot-fis-byteswap.patch b/packages/linux/nas100d-kernel/2.6.15/10-mtdpart-redboot-fis-byteswap.patch new file mode 100644 index 0000000000..edee083e3c --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/10-mtdpart-redboot-fis-byteswap.patch @@ -0,0 +1,44 @@ +On IXP4XX systems the FIS directory is big endian even with a little +endian kernel. This patch recognises the FIS directory on such a +system and byte swaps it to obtain a valid table based on the 'size' +field of the FIS directory (the size field is know to always match the +erase block size on such systems, and probably all systems.) + +--- linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000 +@@ -89,8 +89,34 @@ + i = numslots; + break; + } +- if (!memcmp(buf[i].name, "FIS directory", 14)) ++ if (!memcmp(buf[i].name, "FIS directory", 14)) { ++ /* This is apparently the FIS directory entry for the ++ * FIS directory itself. The FIS directory size is ++ * one erase block, if the buf[i].size field is ++ * swab32(erasesize) then we know we are looking at ++ * a byte swapped FIS directory - swap all the entries! ++ * (NOTE: this is 'size' not 'data_length', size is ++ * the full size of the entry.) ++ */ ++ if (swab32(buf[i].size) == master->erasesize) { ++ int j; ++ for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) { ++ /* The unsigned long fields were written with the ++ * wrong byte sex, name and pad have no byte sex. ++ */ ++# define do_swab32(x) (x) = swab32(x) ++ do_swab32(buf[j].flash_base); ++ do_swab32(buf[j].mem_base); ++ do_swab32(buf[j].size); ++ do_swab32(buf[j].entry_point); ++ do_swab32(buf[j].data_length); ++ do_swab32(buf[j].desc_cksum); ++ do_swab32(buf[j].file_cksum); ++# undef do_swab32 ++ } ++ } + break; ++ } + } + if (i == numslots) { + /* Didn't find it */ diff --git a/packages/linux/nas100d-kernel/2.6.15/19-jffs2-force-be.patch b/packages/linux/nas100d-kernel/2.6.15/19-jffs2-force-be.patch new file mode 100644 index 0000000000..09379031dd --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/19-jffs2-force-be.patch @@ -0,0 +1,13 @@ +--- linux-2.6.15/fs/jffs2/nodelist.h 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.15/fs/jffs2/nodelist.h 1970-01-01 00:00:00.000000000 +0000 +@@ -44,7 +44,9 @@ + #define D2(x) + #endif + +-#define JFFS2_NATIVE_ENDIAN ++#undef JFFS2_NATIVE_ENDIAN ++#define JFFS2_BIG_ENDIAN 1 ++#undef JFFS2_LITTLE_ENDIAN + + /* Note we handle mode bits conversion from JFFS2 (i.e. Linux) to/from + whatever OS we're actually running on here too. */ diff --git a/packages/linux/nas100d-kernel/2.6.15/50-nas100d-arch.patch b/packages/linux/nas100d-kernel/2.6.15/50-nas100d-arch.patch new file mode 100644 index 0000000000..eed275fefb --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/50-nas100d-arch.patch @@ -0,0 +1,56 @@ + arch/arm/mach-ixp4xx/Kconfig | 8 ++++++++ + arch/arm/mach-ixp4xx/Makefile | 1 + + include/asm-arm/arch-ixp4xx/hardware.h | 1 + + include/asm-arm/arch-ixp4xx/irqs.h | 9 +++++++++ + 4 files changed, 19 insertions(+) + +--- linux-nas100d.orig/arch/arm/mach-ixp4xx/Kconfig 2005-11-16 22:29:00.000000000 +0100 ++++ linux-nas100d/arch/arm/mach-ixp4xx/Kconfig 2005-11-16 22:29:52.000000000 +0100 +@@ -71,6 +71,14 @@ config ARCH_PRPMC1100 + PrPCM1100 Processor Mezanine Module. For more information on + this platform, see <file:Documentation/arm/IXP4xx>. + ++config MACH_NAS100D ++ bool ++ prompt "NAS100D" ++ help ++ Say 'Y' here if you want your kernel to support Iomega's ++ NAS 100d device. For more information on this platform, ++ see http://www.nslu2-linux.org/wiki/NAS100d/HomePage ++ + # + # Avila and IXDP share the same source for now. Will change in future + # +--- linux-nas100d.orig/arch/arm/mach-ixp4xx/Makefile 2005-11-16 22:29:00.000000000 +0100 ++++ linux-nas100d/arch/arm/mach-ixp4xx/Makefile 2005-11-16 22:30:37.000000000 +0100 +@@ -9,4 +9,5 @@ obj-$(CONFIG_MACH_IXDPG425) += ixdpg425- + obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o + obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o + obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o ++obj-$(CONFIG_MACH_NAS100D) += nas100d-pci.o nas100d-setup.o nas100d-power.o + +--- linux-nas100d.orig/include/asm-arm/arch-ixp4xx/hardware.h 2005-11-16 22:29:18.000000000 +0100 ++++ linux-nas100d/include/asm-arm/arch-ixp4xx/hardware.h 2005-11-16 22:31:08.000000000 +0100 +@@ -45,5 +45,6 @@ extern unsigned int processor_id; + #include "coyote.h" + #include "prpmc1100.h" + #include "nslu2.h" ++#include "nas100d.h" + + #endif /* _ASM_ARCH_HARDWARE_H */ +--- linux-nas100d.orig/include/asm-arm/arch-ixp4xx/irqs.h 2005-11-16 22:29:18.000000000 +0100 ++++ linux-nas100d/include/asm-arm/arch-ixp4xx/irqs.h 2005-11-16 22:29:52.000000000 +0100 +@@ -100,4 +100,13 @@ + #define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10 + #define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9 + ++/* ++ * NAS100D board IRQs ++ */ ++#define IRQ_NAS100D_PCI_INTA IRQ_IXP4XX_GPIO11 ++#define IRQ_NAS100D_PCI_INTB IRQ_IXP4XX_GPIO10 ++#define IRQ_NAS100D_PCI_INTC IRQ_IXP4XX_GPIO9 ++#define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8 ++#define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7 ++ + #endif diff --git a/packages/linux/nas100d-kernel/2.6.15/55-nas100d-arch.patch b/packages/linux/nas100d-kernel/2.6.15/55-nas100d-arch.patch new file mode 100644 index 0000000000..4b40047a92 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/55-nas100d-arch.patch @@ -0,0 +1,395 @@ + arch/arm/mach-ixp4xx/nas100d-pci.c | 77 +++++++++++++++++++ + arch/arm/mach-ixp4xx/nas100d-power.c | 92 +++++++++++++++++++++++ + arch/arm/mach-ixp4xx/nas100d-setup.c | 132 ++++++++++++++++++++++++++++++++++ + drivers/ide/pci/aec62xx.c | 11 ++ + include/asm-arm/arch-ixp4xx/nas100d.h | 75 +++++++++++++++++++ + 5 files changed, 387 insertions(+) + +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.14/include/asm-arm/arch-ixp4xx/nas100d.h 2005-11-12 14:24:14.000000000 +0100 +@@ -0,0 +1,75 @@ ++/* ++ * include/asm-arm/arch-ixp4xx/nas100d.h ++ * ++ * NAS100D platform specific definitions ++ * ++ * Copyright (c) 2005 Tower Technologies ++ * ++ * Author: Alessandro Zummo <a.zummo@towertech.it> ++ * ++ * based on ixdp425.h: ++ * Copyright 2004 (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. ++ */ ++ ++#ifndef __ASM_ARCH_HARDWARE_H__ ++#error "Do not include this directly, instead #include <asm/hardware.h>" ++#endif ++ ++#define NAS100D_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS ++#define NAS100D_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE ++ ++#define NAS100D_SDA_PIN 6 ++#define NAS100D_SCL_PIN 5 ++ ++/* ++ * NAS100D PCI IRQs ++ */ ++#define NAS100D_PCI_MAX_DEV 3 ++#define NAS100D_PCI_IRQ_LINES 3 ++ ++ ++/* PCI controller GPIO to IRQ pin mappings */ ++#define NAS100D_PCI_INTA_PIN 11 ++#define NAS100D_PCI_INTB_PIN 10 ++#define NAS100D_PCI_INTC_PIN 9 ++#define NAS100D_PCI_INTD_PIN 8 ++#define NAS100D_PCI_INTE_PIN 7 ++ ++/* GPIO */ ++ ++#define NAS100D_GPIO0 0 ++#define NAS100D_GPIO1 1 ++#define NAS100D_GPIO2 2 ++#define NAS100D_GPIO3 3 ++#define NAS100D_GPIO4 4 ++#define NAS100D_GPIO5 5 ++#define NAS100D_GPIO6 6 ++#define NAS100D_GPIO7 7 ++#define NAS100D_GPIO8 8 ++#define NAS100D_GPIO9 9 ++#define NAS100D_GPIO10 10 ++#define NAS100D_GPIO11 11 ++#define NAS100D_GPIO12 12 ++#define NAS100D_GPIO13 13 ++#define NAS100D_GPIO14 14 ++#define NAS100D_GPIO15 15 ++ ++ ++/* Buttons */ ++ ++#define NAS100D_PB_GPIO NAS100D_GPIO14 ++#define NAS100D_RB_GPIO NAS100D_GPIO4 ++#define NAS100D_PO_GPIO NAS100D_GPIO12 /* power off */ ++ ++#define NAS100D_PB_IRQ IRQ_IXP4XX_GPIO14 ++#define NAS100D_RB_IRQ IRQ_IXP4XX_GPIO4 ++ ++/* ++#define NAS100D_PB_BM (1L << NAS100D_PB_GPIO) ++#define NAS100D_PO_BM (1L << NAS100D_PO_GPIO) ++#define NAS100D_RB_BM (1L << NAS100D_RB_GPIO) ++*/ +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.14/arch/arm/mach-ixp4xx/nas100d-pci.c 2005-11-12 14:24:14.000000000 +0100 +@@ -0,0 +1,77 @@ ++/* ++ * arch/arm/mach-ixp4xx/nas100d-pci.c ++ * ++ * NAS 100d board-level PCI initialization ++ * ++ * based on ixdp425-pci.c: ++ * Copyright (C) 2002 Intel Corporation. ++ * Copyright (C) 2003-2004 MontaVista Software, Inc. ++ * ++ * Maintainer: http://www.nslu2-linux.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/config.h> ++#include <linux/pci.h> ++#include <linux/init.h> ++ ++#include <asm/mach/pci.h> ++#include <asm/mach-types.h> ++ ++void __init nas100d_pci_preinit(void) ++{ ++ set_irq_type(IRQ_NAS100D_PCI_INTA, IRQT_LOW); ++ set_irq_type(IRQ_NAS100D_PCI_INTB, IRQT_LOW); ++ set_irq_type(IRQ_NAS100D_PCI_INTC, IRQT_LOW); ++ set_irq_type(IRQ_NAS100D_PCI_INTD, IRQT_LOW); ++ set_irq_type(IRQ_NAS100D_PCI_INTE, IRQT_LOW); ++ ++ gpio_line_isr_clear(NAS100D_PCI_INTA_PIN); ++ gpio_line_isr_clear(NAS100D_PCI_INTB_PIN); ++ gpio_line_isr_clear(NAS100D_PCI_INTC_PIN); ++ gpio_line_isr_clear(NAS100D_PCI_INTD_PIN); ++ gpio_line_isr_clear(NAS100D_PCI_INTE_PIN); ++ ++ ixp4xx_pci_preinit(); ++} ++ ++static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ static int pci_irq_table[NAS100D_PCI_MAX_DEV][NAS100D_PCI_IRQ_LINES] = ++ { ++ { IRQ_NAS100D_PCI_INTA, -1, -1 }, ++ { IRQ_NAS100D_PCI_INTB, -1, -1 }, ++ { IRQ_NAS100D_PCI_INTC, IRQ_NAS100D_PCI_INTD, IRQ_NAS100D_PCI_INTE }, ++ }; ++ ++ int irq = -1; ++ ++ if (slot >= 1 && slot <= NAS100D_PCI_MAX_DEV && ++ pin >= 1 && pin <= NAS100D_PCI_IRQ_LINES) ++ irq = pci_irq_table[slot-1][pin-1]; ++ ++ return irq; ++} ++ ++struct hw_pci __initdata nas100d_pci = { ++ .nr_controllers = 1, ++ .preinit = nas100d_pci_preinit, ++ .swizzle = pci_std_swizzle, ++ .setup = ixp4xx_setup, ++ .scan = ixp4xx_scan_bus, ++ .map_irq = nas100d_map_irq, ++}; ++ ++int __init nas100d_pci_init(void) ++{ ++ if (machine_is_nas100d()) ++ pci_common_init(&nas100d_pci); ++ ++ return 0; ++} ++ ++subsys_initcall(nas100d_pci_init); +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.14/arch/arm/mach-ixp4xx/nas100d-power.c 2005-11-12 14:24:14.000000000 +0100 +@@ -0,0 +1,92 @@ ++/* ++ * arch/arm/mach-ixp4xx/nas100d-power.c ++ * ++ * NAS 100d Power/Reset driver ++ * ++ * Copyright (C) 2005 Tower Technologies ++ * ++ * based on nas100d-io.c ++ * Copyright (C) 2004 Karen Spearel ++ * ++ * Author: Alessandro Zummo <a.zummo@towertech.it> ++ * Maintainers: http://www.nslu2-linux.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/reboot.h> ++#include <linux/interrupt.h> ++ ++#include <asm/mach-types.h> ++ ++extern void ctrl_alt_del(void); ++ ++static irqreturn_t nas100d_power_handler(int irq, void *dev_id, struct pt_regs *regs) ++{ ++ /* Signal init to do the ctrlaltdel action, this will bypass init if ++ * it hasn't started and do a kernel_restart. ++ */ ++ ctrl_alt_del(); ++ ++ return IRQ_HANDLED; ++} ++ ++static irqreturn_t nas100d_reset_handler(int irq, void *dev_id, struct pt_regs *regs) ++{ ++ /* This is the paper-clip reset, it shuts the machine down directly. ++ */ ++ machine_power_off(); ++ ++ return IRQ_HANDLED; ++} ++ ++static int __init nas100d_power_init(void) ++{ ++ if (!(machine_is_nas100d())) ++ return 0; ++ ++ // *IXP4XX_GPIO_GPISR = 0x20400000; /* read the 2 irqs to clr */ ++ ++ set_irq_type(NAS100D_RB_IRQ, IRQT_LOW); ++// set_irq_type(NAS100D_PB_IRQ, IRQT_HIGH); ++ ++ gpio_line_isr_clear(NAS100D_RB_GPIO); ++// gpio_line_isr_clear(NAS100D_PB_GPIO); ++ ++ if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler, ++ SA_INTERRUPT, "NAS100D reset button", NULL) < 0) { ++ ++ printk(KERN_DEBUG "Reset Button IRQ %d not available\n", ++ NAS100D_RB_IRQ); ++ ++ return -EIO; ++ } ++/* ++ if (request_irq(NAS100D_PB_IRQ, &nas100d_power_handler, ++ SA_INTERRUPT, "NAS100D power button", NULL) < 0) { ++ ++ printk(KERN_DEBUG "Power Button IRQ %d not available\n", ++ NAS100D_PB_IRQ); ++ ++ return -EIO; ++ } ++*/ ++ return 0; ++} ++ ++static void __exit nas100d_power_exit(void) ++{ ++ free_irq(NAS100D_RB_IRQ, NULL); ++// free_irq(NAS100D_PB_IRQ, NULL); ++} ++ ++module_init(nas100d_power_init); ++module_exit(nas100d_power_exit); ++ ++MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); ++MODULE_DESCRIPTION("NAS100D Power/Reset driver"); ++MODULE_LICENSE("GPL"); +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-2.6.14/arch/arm/mach-ixp4xx/nas100d-setup.c 2005-11-12 14:24:14.000000000 +0100 +@@ -0,0 +1,132 @@ ++/* ++ * arch/arm/mach-ixp4xx/nas100d-setup.c ++ * ++ * NAS 100d board-setup ++ * ++ * based ixdp425-setup.c: ++ * Copyright (C) 2003-2004 MontaVista Software, Inc. ++ * ++ * Author: Mark Rakes <mrakes at mac.com> ++ * Maintainers: http://www.nslu2-linux.org/ ++ * ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/serial.h> ++#include <linux/serial_8250.h> ++ ++#include <asm/mach-types.h> ++#include <asm/mach/arch.h> ++#include <asm/mach/flash.h> ++ ++static struct flash_platform_data nas100d_flash_data = { ++ .map_name = "cfi_probe", ++ .width = 2, ++}; ++ ++static struct resource nas100d_flash_resource = { ++ .start = NAS100D_FLASH_BASE, ++ .end = NAS100D_FLASH_BASE + NAS100D_FLASH_SIZE, ++ .flags = IORESOURCE_MEM, ++}; ++ ++static struct platform_device nas100d_flash = { ++ .name = "IXP4XX-Flash", ++ .id = 0, ++ .dev.platform_data = &nas100d_flash_data, ++ .num_resources = 1, ++ .resource = &nas100d_flash_resource, ++}; ++ ++static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { ++ .sda_pin = NAS100D_SDA_PIN, ++ .scl_pin = NAS100D_SCL_PIN, ++}; ++ ++static struct platform_device nas100d_i2c_controller = { ++ .name = "IXP4XX-I2C", ++ .id = 0, ++ .dev.platform_data = &nas100d_i2c_gpio_pins, ++ .num_resources = 0, ++}; ++ ++static struct resource nas100d_uart_resources[] = { ++ { ++ .start = IXP4XX_UART1_BASE_PHYS, ++ .end = IXP4XX_UART1_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ }, ++ { ++ .start = IXP4XX_UART2_BASE_PHYS, ++ .end = IXP4XX_UART2_BASE_PHYS + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ } ++}; ++ ++static struct plat_serial8250_port nas100d_uart_data[] = { ++ { ++ .mapbase = IXP4XX_UART1_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART1, ++ .flags = UPF_BOOT_AUTOCONF, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { ++ .mapbase = IXP4XX_UART2_BASE_PHYS, ++ .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, ++ .irq = IRQ_IXP4XX_UART2, ++ .flags = UPF_BOOT_AUTOCONF, ++ .iotype = UPIO_MEM, ++ .regshift = 2, ++ .uartclk = IXP4XX_UART_XTAL, ++ }, ++ { } ++}; ++ ++static struct platform_device nas100d_uart = { ++ .name = "serial8250", ++ .id = PLAT8250_DEV_PLATFORM, ++ .dev.platform_data = nas100d_uart_data, ++ .num_resources = 2, ++ .resource = nas100d_uart_resources, ++}; ++ ++static struct platform_device *nas100d_devices[] __initdata = { ++ &nas100d_i2c_controller, ++ &nas100d_flash, ++ &nas100d_uart, ++}; ++ ++static void nas100d_power_off(void) ++{ ++ /* This causes the box to drop the power and go dead. */ ++ ++ /* enable the pwr cntl gpio */ ++ gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); ++ ++ /* do the deed */ ++ gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); ++} ++ ++static void __init nas100d_init(void) ++{ ++ ixp4xx_sys_init(); ++ ++ pm_power_off = nas100d_power_off; ++ ++ platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); ++} ++ ++MACHINE_START(NAS100D, "Iomega NAS 100d") ++ /* Maintainer: www.nslu2-linux.org */ ++ .phys_ram = PHYS_OFFSET, ++ .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, ++ .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, ++ .boot_params = 0x00000100, ++ .map_io = ixp4xx_map_io, ++ .init_irq = ixp4xx_init_irq, ++ .timer = &ixp4xx_timer, ++ .init_machine = nas100d_init, ++MACHINE_END diff --git a/packages/linux/nas100d-kernel/2.6.15/60-nas100d-i2c.patch b/packages/linux/nas100d-kernel/2.6.15/60-nas100d-i2c.patch new file mode 100644 index 0000000000..5073d4b5a7 --- /dev/null +++ b/packages/linux/nas100d-kernel/2.6.15/60-nas100d-i2c.patch @@ -0,0 +1,559 @@ + drivers/i2c/busses/i2c-ixp4xx.c | 7 + drivers/i2c/chips/Kconfig | 9 + drivers/i2c/chips/Makefile | 1 + drivers/i2c/chips/pcf8563.c | 466 ++++++++++++++++++++++++++++++++++++++++ + include/linux/pcf8563.h | 24 ++ + 5 files changed, 504 insertions(+), 3 deletions(-) + +--- linux-nas100d.orig/drivers/i2c/busses/i2c-ixp4xx.c 2005-11-16 23:10:02.000000000 +0100 ++++ linux-nas100d/drivers/i2c/busses/i2c-ixp4xx.c 2005-11-16 23:10:02.000000000 +0100 +@@ -67,7 +67,6 @@ static int ixp4xx_bit_getscl(void *data) + + gpio_line_config(ixp4xx_scl_pin(data), IXP4XX_GPIO_IN ); + gpio_line_get(ixp4xx_scl_pin(data), &scl); +- + return scl; + } + +@@ -77,7 +76,6 @@ static int ixp4xx_bit_getsda(void *data) + + gpio_line_config(ixp4xx_sda_pin(data), IXP4XX_GPIO_IN ); + gpio_line_get(ixp4xx_sda_pin(data), &sda); +- + return sda; + } + +@@ -126,7 +124,10 @@ static int ixp4xx_i2c_probe(struct platf + drv_data->algo_data.udelay = 10; + drv_data->algo_data.mdelay = 10; + drv_data->algo_data.timeout = 100; +- ++#ifdef CONFIG_MACH_NAS100D ++ drv_data->algo_data.udelay = 100; ++ drv_data->algo_data.mdelay = 100; ++#endif + drv_data->adapter.id = I2C_HW_B_IXP4XX; + strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.driver.name, + I2C_NAME_SIZE); +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-nas100d/drivers/i2c/chips/pcf8563.c 2005-11-16 23:12:33.000000000 +0100 +@@ -0,0 +1,466 @@ ++/* ++ * pcf8563.c - An i2c driver for the Philips PCF8563 RTC ++ * Copyright 2005 Alessandro Zummo ++ * ++ * please send all reports to: ++ * a dot zummo at towertech dot it ++ * ++ * based on the other drivers in this same directory. ++ * ++ * http://www.semiconductors.philips.com/acrobat/datasheets/PCF8563-04.pdf ++ * ++ * 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/init.h> ++#include <linux/slab.h> ++#include <linux/i2c.h> ++#include <linux/string.h> ++#include <linux/bcd.h> ++#include <linux/rtc.h> ++#include <linux/list.h> ++ ++#include <linux/pcf8563.h> ++ ++#define DRV_VERSION "0.3.2" ++ ++/* Addresses to scan */ ++static unsigned short normal_i2c[] = { 0x51, I2C_CLIENT_END }; ++ ++/* Module parameters */ ++I2C_CLIENT_INSMOD; ++I2C_CLIENT_MODULE_PARM(hctosys, ++ "Set the system time from the hardware clock upon initialization"); ++ ++#define PCF8563_REG_ST1 0x00 /* status */ ++#define PCF8563_REG_ST2 0x01 ++ ++#define PCF8563_REG_SC 0x02 /* datetime */ ++#define PCF8563_REG_MN 0x03 ++#define PCF8563_REG_HR 0x04 ++#define PCF8563_REG_DM 0x05 ++#define PCF8563_REG_DW 0x06 ++#define PCF8563_REG_MO 0x07 ++#define PCF8563_REG_YR 0x08 ++ ++#define PCF8563_REG_AMN 0x09 /* alarm */ ++#define PCF8563_REG_AHR 0x0A ++#define PCF8563_REG_ADM 0x0B ++#define PCF8563_REG_ADW 0x0C ++ ++#define PCF8563_REG_CLKO 0x0D /* clock out */ ++#define PCF8563_REG_TMRC 0x0E /* timer control */ ++#define PCF8563_REG_TMR 0x0F /* timer */ ++ ++#define PCF8563_SC_LV 0x80 /* low voltage */ ++#define PCF8563_MO_C 0x80 /* century */ ++ ++/* Prototypes */ ++static int pcf8563_attach(struct i2c_adapter *adapter); ++static int pcf8563_detach(struct i2c_client *client); ++static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind); ++static int pcf8563_command(struct i2c_client *client, unsigned int cmd, ++ void *arg); ++ ++static struct i2c_driver pcf8563_driver = { ++ .owner = THIS_MODULE, ++ .name = "pcf8563", ++ .flags = I2C_DF_NOTIFY, ++ .attach_adapter = &pcf8563_attach, ++ .detach_client = &pcf8563_detach, ++}; ++ ++struct pcf8563_data { ++ struct i2c_client client; ++ struct list_head list; ++}; ++ ++static const unsigned char days_in_mo[] = ++ { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; ++ ++static LIST_HEAD(pcf8563_clients); ++ ++/* Workaround until the I2C subsytem will allow to send ++ * commands to a specific client. This function will send the command ++ * to the first client. ++ */ ++int pcf8563_do_command(unsigned int cmd, void *arg) ++{ ++ struct list_head *walk; ++ struct list_head *tmp; ++ struct pcf8563_data *data; ++ ++ list_for_each_safe(walk, tmp, &pcf8563_clients) { ++ data = list_entry(walk, struct pcf8563_data, list); ++ return pcf8563_command(&data->client, cmd, arg); ++ } ++ ++ return -ENODEV; ++} ++ ++#define is_leap(year) \ ++ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0)) ++ ++/* make sure the rtc_time values are in bounds */ ++ ++static int pcf8563_validate_tm(struct rtc_time *tm) ++{ ++ int year = tm->tm_year + 1900; ++ ++ if ((tm->tm_year < 70) || (tm->tm_year > 255)) ++ return -EINVAL; ++ ++ if ((tm->tm_mon > 11) || (tm->tm_mday == 0)) ++ return -EINVAL; ++ ++ if (tm->tm_mday > days_in_mo[tm->tm_mon] ++ + ((tm->tm_mon == 1) && is_leap(year))) ++ return -EINVAL; ++ ++ if ((tm->tm_hour >= 24) || (tm->tm_min >= 60) || (tm->tm_sec >= 60)) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++/* ++ * In the routines that deal directly with the pcf8563 hardware, we use ++ * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch. ++ */ ++static int pcf8563_get_datetime(struct i2c_client *client, struct rtc_time *tm) ++{ ++ unsigned char buf[13]; ++ unsigned char addr = PCF8563_REG_ST1; ++ ++ struct i2c_msg msgs[] = { ++ { client->addr, 0, 1, &addr }, /* setup read ptr */ ++ { client->addr, I2C_M_RD, 13, buf }, /* read status + date */ ++ }; ++ ++ /* read registers */ ++ if ((i2c_transfer(client->adapter, msgs, 2)) != 2) { ++ dev_err(&client->dev, "%s: read error\n", __FUNCTION__); ++ return -EIO; ++ } ++ ++ if (buf[PCF8563_REG_SC] & PCF8563_SC_LV) ++ dev_info(&client->dev, ++ "low voltage detected, date/time is not reliable.\n"); ++ ++ dev_dbg(&client->dev, ++ "%s: raw data is st1=%02x, st2=%02x, sec=%02x, min=%02x, hr=%02x, " ++ "mday=%02x, wday=%02x, mon=%02x, year=%02x\n", ++ __FUNCTION__, ++ buf[0], buf[1], buf[2], buf[3], ++ buf[4], buf[5], buf[6], buf[7], ++ buf[8]); ++ ++ ++ tm->tm_sec = BCD2BIN(buf[PCF8563_REG_SC] & 0x7F); ++ tm->tm_min = BCD2BIN(buf[PCF8563_REG_MN] & 0x7F); ++ tm->tm_hour = BCD2BIN(buf[PCF8563_REG_HR] & 0x3F); /* rtc hr 0-23 */ ++ tm->tm_mday = BCD2BIN(buf[PCF8563_REG_DM] & 0x3F); ++ tm->tm_wday = buf[PCF8563_REG_DW] & 0x07; ++ tm->tm_mon = BCD2BIN(buf[PCF8563_REG_MO] & 0x1F) - 1; /* rtc mn 1-12 */ ++ tm->tm_year = BCD2BIN(buf[PCF8563_REG_YR]) ++ + (buf[PCF8563_REG_MO] & PCF8563_MO_C ? 100 : 0); ++ ++ dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, " ++ "mday=%d, mon=%d, year=%d, wday=%d\n", ++ __FUNCTION__, ++ tm->tm_sec, tm->tm_min, tm->tm_hour, ++ tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); ++ ++ if (pcf8563_validate_tm(tm) < 0) { ++ dev_err(&client->dev, "retrieved date/time is not valid.\n"); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static int pcf8563_set_datetime(struct i2c_client *client, struct rtc_time *tm, ++ int datetoo) ++{ ++ int i, err; ++ unsigned char buf[9]; ++ ++ /* check if all values in the tm struct are correct */ ++ if ((err = pcf8563_validate_tm(tm)) < 0) ++ return err; ++ ++ dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, " ++ "mday=%d, mon=%d, year=%d, wday=%d\n", ++ __FUNCTION__, ++ tm->tm_sec, tm->tm_min, tm->tm_hour, ++ tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); ++ ++ /* hours, minutes and seconds */ ++ buf[PCF8563_REG_SC] = BIN2BCD(tm->tm_sec); ++ buf[PCF8563_REG_MN] = BIN2BCD(tm->tm_min); ++ buf[PCF8563_REG_HR] = BIN2BCD(tm->tm_hour); ++ ++ /* should we also set the date? */ ++ if (datetoo) { ++ buf[PCF8563_REG_DM] = BIN2BCD(tm->tm_mday); ++ ++ /* month, 1 - 12 */ ++ buf[PCF8563_REG_MO] = BIN2BCD(tm->tm_mon + 1); ++ ++ /* year and century */ ++ buf[PCF8563_REG_YR] = BIN2BCD(tm->tm_year % 100); ++ if (tm->tm_year / 100) ++ buf[PCF8563_REG_MO] |= PCF8563_MO_C; ++ ++ buf[PCF8563_REG_DW] = tm->tm_wday & 0x07; ++ } ++ ++ /* write register's data */ ++ for (i = 0; i < (datetoo ? 7 : 3); i++) { ++ unsigned char data[2] = { PCF8563_REG_SC + i, ++ buf[PCF8563_REG_SC + i] }; ++ ++ err = i2c_master_send(client, data, sizeof(data)); ++ if (err != sizeof(data)) { ++ dev_err(&client->dev, ++ "%s: err=%d addr=%02x, data=%02x\n", ++ __FUNCTION__, err, data[0], data[1]); ++ return -EIO; ++ } ++ }; ++ ++ return 0; ++} ++ ++static int pcf8563_hctosys(struct i2c_client *client) ++{ ++ int err; ++ ++ struct rtc_time tm; ++ struct timespec tv; ++ ++ err = pcf8563_command(client, PCF8563_CMD_GETDATETIME, &tm); ++ ++ if (err) { ++ dev_err(&client->dev, ++ "Unable to set the system clock\n"); ++ return err; ++ } ++ ++ /* IMPORTANT: the RTC only stores whole seconds. It is arbitrary ++ * whether it stores the most close value or the value with partial ++ * seconds truncated. However, it is important that we use it to store ++ * the truncated value. This is because otherwise it is necessary, ++ * in an rtc sync function, to read both xtime.tv_sec and ++ * xtime.tv_nsec. On some processors (i.e. ARM), an atomic read ++ * of >32bits is not possible. So storing the most close value would ++ * slow down the sync API. So here we have the truncated value and ++ * the best guess is to add 0.5s. ++ */ ++ ++ tv.tv_nsec = NSEC_PER_SEC >> 1; ++ ++ /* WARNING: this is not the C library 'mktime' call, it is a built in ++ * inline function from include/linux/time.h. It expects (requires) ++ * the month to be in the range 1-12 ++ */ ++ ++ tv.tv_sec = mktime(tm.tm_year + 1900, tm.tm_mon + 1, ++ tm.tm_mday, tm.tm_hour, ++ tm.tm_min, tm.tm_sec); ++ |
