From 07046be146f644760476cc593c31a3c7e16636ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 3 Mar 2010 20:43:16 +0100 Subject: linux 2.6.27: add support for ts72xx and make it default kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Petr Štetiar Acked-by: Marcin Juszkiewicz --- .../0001-TS72xx-update-memory-map-comments.patch | 45 + .../linux/linux-2.6.27/ts72xx/0002-GPIO-fix.patch | 47 + .../linux-2.6.27/ts72xx/0003-Debounce-IRQ.patch | 97 ++ .../linux/linux-2.6.27/ts72xx/0004-OHCI-fix.patch | 39 + ...-Fix-wrong-machine-ID-passed-from-RedBoot.patch | 28 + .../ts72xx/0006-Force-the-nF-bit-on.patch | 33 + .../ts72xx/0007-Use-CPLD-watchdog-to-reset.patch | 54 + .../linux-2.6.27/ts72xx/0008-Fix-UART-clocks.patch | 99 ++ .../ts72xx/0009-CPU-info-and-board-revision.patch | 64 + .../linux/linux-2.6.27/ts72xx/0010-GPIO-leds.patch | 72 ++ .../ts72xx/0011-EP93xx-Ethernet-support.patch | 548 ++++++++ .../linux-2.6.27/ts72xx/0012-TS72xx-watchdog.patch | 451 +++++++ .../ts72xx/0013-TS7200-NOR-physmap-fix.patch | 58 + .../ts72xx/0014-TS-7200-8MB-NOR-flash.patch | 163 +++ .../ts72xx/0015-TS-72xx-MAX197-support.patch | 365 ++++++ .../ts72xx/0016-RS485-common-bits.patch | 46 + .../ts72xx/0017-TS-72xx-SBC-proc-info.patch | 249 ++++ .../linux-2.6.27/ts72xx/0018-EP93xx-GPIO-I2C.patch | 71 ++ .../ts72xx/0019-EP93xx-SPI-driver.patch | 989 +++++++++++++++ .../ts72xx/0020-TS-72XX-LCD-console-driver.patch | 509 ++++++++ .../ts72xx/0021-EP93xx-GPIO-matrix-keypad.patch | 564 +++++++++ .../0022-TS-72xx-RS485-auto-mode-support.patch | 218 ++++ .../0023-Clean-and-invalidate-D-cache-entry.patch | 29 + .../0024-PC-104-I-O-and-memory-mappings.patch | 40 + .../ts72xx/0025-EP93xx-discontigmem.patch | 481 +++++++ .../ts72xx/0026-TS72xx-PATA-support.patch | 442 +++++++ .../ts72xx/0027-TS72xx-TS-SER1-support.patch | 213 ++++ .../ts72xx/0028-TS72xx-TS-ETH100.patch | 259 ++++ .../0029-EP93xx-Power-Management-Routines.patch | 125 ++ .../ts72xx/0030-EP93xx-CPUfreq-driver.patch | 332 +++++ recipes/linux/linux-2.6.27/ts72xx/defconfig | 1312 ++++++++++++++++++++ recipes/linux/linux_2.6.27.bb | 36 +- 32 files changed, 8077 insertions(+), 1 deletion(-) create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0001-TS72xx-update-memory-map-comments.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0002-GPIO-fix.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0003-Debounce-IRQ.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0004-OHCI-fix.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0005-Fix-wrong-machine-ID-passed-from-RedBoot.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0006-Force-the-nF-bit-on.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0007-Use-CPLD-watchdog-to-reset.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0008-Fix-UART-clocks.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0009-CPU-info-and-board-revision.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0010-GPIO-leds.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0011-EP93xx-Ethernet-support.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0012-TS72xx-watchdog.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0013-TS7200-NOR-physmap-fix.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0014-TS-7200-8MB-NOR-flash.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0015-TS-72xx-MAX197-support.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0016-RS485-common-bits.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0017-TS-72xx-SBC-proc-info.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0018-EP93xx-GPIO-I2C.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0019-EP93xx-SPI-driver.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0020-TS-72XX-LCD-console-driver.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0021-EP93xx-GPIO-matrix-keypad.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0022-TS-72xx-RS485-auto-mode-support.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0023-Clean-and-invalidate-D-cache-entry.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0024-PC-104-I-O-and-memory-mappings.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0025-EP93xx-discontigmem.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0026-TS72xx-PATA-support.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0027-TS72xx-TS-SER1-support.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0028-TS72xx-TS-ETH100.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0029-EP93xx-Power-Management-Routines.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/0030-EP93xx-CPUfreq-driver.patch create mode 100644 recipes/linux/linux-2.6.27/ts72xx/defconfig diff --git a/recipes/linux/linux-2.6.27/ts72xx/0001-TS72xx-update-memory-map-comments.patch b/recipes/linux/linux-2.6.27/ts72xx/0001-TS72xx-update-memory-map-comments.patch new file mode 100644 index 0000000000..3eab1ca0d7 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0001-TS72xx-update-memory-map-comments.patch @@ -0,0 +1,45 @@ +From dd631acb622a6c7c6355945c446bd07085ade99f Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 14:02:33 +0100 +Subject: [PATCH] TS72xx update memory map comments +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/include/mach/ts72xx.h | 13 ++++++++++++- + 1 files changed, 12 insertions(+), 1 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/include/mach/ts72xx.h +index 30b318a..99c4e48 100644 +--- a/arch/arm/mach-ep93xx/include/mach/ts72xx.h ++++ b/arch/arm/mach-ep93xx/include/mach/ts72xx.h +@@ -8,12 +8,23 @@ + * virt phys size + * febff000 22000000 4K model number register + * febfe000 22400000 4K options register +- * febfd000 22800000 4K options register #2 ++ * febfd000 22800000 4K options register #2 (JP6 and TS-9420 flags) + * febfc000 [67]0000000 4K NAND data register + * febfb000 [67]0400000 4K NAND control register + * febfa000 [67]0800000 4K NAND busy register + * febf9000 10800000 4K TS-5620 RTC index register + * febf8000 11700000 4K TS-5620 RTC data register ++ * febf7000 23800000 4K CPLD watchdog (control register) ++ * febf6000 23c00000 4K CPLD watchdog (feed register) ++ * febf5000 23400000 4K PLD version (3 bits) ++ * febf4000 22c00000 4K RS-485 control register ++ * febf3000 23000000 4K RS-485 mode register ++ * febf2000 10800000 4K jumpers/max197 busy bit/COM1 dcd register (8-bit, read only) ++ * febf1000 10f00000 4K max197 sample/control register (16-bit read/8-bit write) ++ * febf0000 11e00000 4K PC/104 8-bit I/O ++ * febef000 21e00000 4K PC/104 16-bit I/O ++ * fea00000 11a00000 1MB PC/104 8-bit memory ++ * fe900000 21a00000 1MB PC/104 16-bit memory + */ + + #define TS72XX_MODEL_PHYS_BASE 0x22000000 +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0002-GPIO-fix.patch b/recipes/linux/linux-2.6.27/ts72xx/0002-GPIO-fix.patch new file mode 100644 index 0000000000..006321efd5 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0002-GPIO-fix.patch @@ -0,0 +1,47 @@ +From 9c7b38ef5e6843521c71eadefdba8cfa0aa607b4 Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 00:41:38 +0100 +Subject: [PATCH] GPIO fix +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/core.c | 2 +- + arch/arm/mach-ep93xx/gpio.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c +index f99f436..d6967de 100644 +--- a/arch/arm/mach-ep93xx/core.c ++++ b/arch/arm/mach-ep93xx/core.c +@@ -157,7 +157,7 @@ static unsigned char gpio_int_type2[3]; + static const u8 int_type1_register_offset[3] = { 0x90, 0xac, 0x4c }; + static const u8 int_type2_register_offset[3] = { 0x94, 0xb0, 0x50 }; + static const u8 eoi_register_offset[3] = { 0x98, 0xb4, 0x54 }; +-static const u8 int_en_register_offset[3] = { 0x9c, 0xb8, 0x5c }; ++static const u8 int_en_register_offset[3] = { 0x9c, 0xb8, 0x58 }; + + void ep93xx_gpio_update_int_params(unsigned port) + { +diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c +index 0f3fb87..468d523 100644 +--- a/arch/arm/mach-ep93xx/gpio.c ++++ b/arch/arm/mach-ep93xx/gpio.c +@@ -141,10 +141,10 @@ static void ep93xx_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) + static struct ep93xx_gpio_chip ep93xx_gpio_banks[] = { + EP93XX_GPIO_BANK("A", 0x00, 0x10, 0), + EP93XX_GPIO_BANK("B", 0x04, 0x14, 8), +- EP93XX_GPIO_BANK("C", 0x30, 0x34, 40), ++ EP93XX_GPIO_BANK("C", 0x08, 0x18, 40), + EP93XX_GPIO_BANK("D", 0x0c, 0x1c, 24), + EP93XX_GPIO_BANK("E", 0x20, 0x24, 32), +- EP93XX_GPIO_BANK("F", 0x08, 0x18, 16), ++ EP93XX_GPIO_BANK("F", 0x30, 0x34, 16), + EP93XX_GPIO_BANK("G", 0x38, 0x3c, 48), + EP93XX_GPIO_BANK("H", 0x40, 0x44, 56), + }; +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0003-Debounce-IRQ.patch b/recipes/linux/linux-2.6.27/ts72xx/0003-Debounce-IRQ.patch new file mode 100644 index 0000000000..21410ab7f0 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0003-Debounce-IRQ.patch @@ -0,0 +1,97 @@ +From 51bba77f0953f87a88a8fce9fb8827bdba57a2c5 Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 00:42:43 +0100 +Subject: [PATCH] Debounce IRQ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/core.c | 18 ++++++++++++++++++ + arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 3 +++ + arch/arm/mach-ep93xx/include/mach/gpio.h | 2 ++ + 3 files changed, 23 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c +index d6967de..1928c93 100644 +--- a/arch/arm/mach-ep93xx/core.c ++++ b/arch/arm/mach-ep93xx/core.c +@@ -152,12 +152,14 @@ static unsigned char gpio_int_unmasked[3]; + static unsigned char gpio_int_enabled[3]; + static unsigned char gpio_int_type1[3]; + static unsigned char gpio_int_type2[3]; ++static unsigned char gpio_int_debouce[3]; + + /* Port ordering is: A B F */ + static const u8 int_type1_register_offset[3] = { 0x90, 0xac, 0x4c }; + static const u8 int_type2_register_offset[3] = { 0x94, 0xb0, 0x50 }; + static const u8 eoi_register_offset[3] = { 0x98, 0xb4, 0x54 }; + static const u8 int_en_register_offset[3] = { 0x9c, 0xb8, 0x58 }; ++static const u8 int_debounce_register_offset[3] = { 0xa8, 0xc4, 0x64 }; + + void ep93xx_gpio_update_int_params(unsigned port) + { +@@ -180,6 +182,22 @@ void ep93xx_gpio_int_mask(unsigned line) + gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7)); + } + ++void ep93xx_gpio_int_debounce(unsigned int irq, int enable) ++{ ++ int line = irq_to_gpio(irq); ++ int port = line >> 3; ++ int port_mask = 1 << (line & 7); ++ ++ if (enable) ++ gpio_int_debouce[port] |= port_mask; ++ else ++ gpio_int_debouce[port] &= ~port_mask; ++ ++ __raw_writeb(gpio_int_debouce[port], ++ EP93XX_GPIO_REG(int_debounce_register_offset[port])); ++} ++EXPORT_SYMBOL(ep93xx_gpio_int_debounce); ++ + /************************************************************************* + * EP93xx IRQ handling + *************************************************************************/ +diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +index 9f4458c..5582138 100644 +--- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h ++++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +@@ -78,16 +78,19 @@ + #define EP93XX_GPIO_F_INT_ACK EP93XX_GPIO_REG(0x54) + #define EP93XX_GPIO_F_INT_ENABLE EP93XX_GPIO_REG(0x58) + #define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c) ++#define EP93XX_GPIO_F_INT_DEBOUNCE EP93XX_GPIO_REG(0x64) + #define EP93XX_GPIO_A_INT_TYPE1 EP93XX_GPIO_REG(0x90) + #define EP93XX_GPIO_A_INT_TYPE2 EP93XX_GPIO_REG(0x94) + #define EP93XX_GPIO_A_INT_ACK EP93XX_GPIO_REG(0x98) + #define EP93XX_GPIO_A_INT_ENABLE EP93XX_GPIO_REG(0x9c) + #define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) ++#define EP93XX_GPIO_A_INT_DEBOUNCE EP93XX_GPIO_REG(0xa8) + #define EP93XX_GPIO_B_INT_TYPE1 EP93XX_GPIO_REG(0xac) + #define EP93XX_GPIO_B_INT_TYPE2 EP93XX_GPIO_REG(0xb0) + #define EP93XX_GPIO_B_INT_ACK EP93XX_GPIO_REG(0xb4) + #define EP93XX_GPIO_B_INT_ENABLE EP93XX_GPIO_REG(0xb8) + #define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) ++#define EP93XX_GPIO_B_INT_DEBOUNCE EP93XX_GPIO_REG(0xc4) + + #define EP93XX_AAC_BASE (EP93XX_APB_VIRT_BASE + 0x00080000) + +diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h +index f702041..0a1498a 100644 +--- a/arch/arm/mach-ep93xx/include/mach/gpio.h ++++ b/arch/arm/mach-ep93xx/include/mach/gpio.h +@@ -99,6 +99,8 @@ + /* maximum value for irq capable line identifiers */ + #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) + ++extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable); ++ + /* new generic GPIO API - see Documentation/gpio.txt */ + + #include +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0004-OHCI-fix.patch b/recipes/linux/linux-2.6.27/ts72xx/0004-OHCI-fix.patch new file mode 100644 index 0000000000..1482e2dddf --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0004-OHCI-fix.patch @@ -0,0 +1,39 @@ +From 06e0fdf41288a6d54b821671593195ea27deba8b Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 00:54:35 +0100 +Subject: [PATCH] OHCI fix +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/core.c | 5 +++-- + 1 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c +index 1928c93..24b24c7 100644 +--- a/arch/arm/mach-ep93xx/core.c ++++ b/arch/arm/mach-ep93xx/core.c +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -472,8 +473,8 @@ static struct platform_device ep93xx_ohci_device = { + .name = "ep93xx-ohci", + .id = -1, + .dev = { +- .dma_mask = (void *)0xffffffff, +- .coherent_dma_mask = 0xffffffff, ++ .dma_mask = &ep93xx_ohci_device.dev.coherent_dma_mask, ++ .coherent_dma_mask = DMA_BIT_MASK(32), + }, + .num_resources = ARRAY_SIZE(ep93xx_ohci_resources), + .resource = ep93xx_ohci_resources, +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0005-Fix-wrong-machine-ID-passed-from-RedBoot.patch b/recipes/linux/linux-2.6.27/ts72xx/0005-Fix-wrong-machine-ID-passed-from-RedBoot.patch new file mode 100644 index 0000000000..e17f945ef6 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0005-Fix-wrong-machine-ID-passed-from-RedBoot.patch @@ -0,0 +1,28 @@ +From 22ce7d90cb3c58be44ebb0fcb3f1f5ca8af83d59 Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?Petr=20=C5=A0tetiar?= +Date: Sat, 3 Jan 2009 21:33:53 +0100 +Subject: [PATCH] Fix wrong machine ID passed from RedBoot +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/kernel/head.S | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S +index bff4c6e..bda4eb4 100644 +--- a/arch/arm/kernel/head.S ++++ b/arch/arm/kernel/head.S +@@ -83,6 +83,7 @@ ENTRY(stext) + bl __lookup_processor_type @ r5=procinfo r9=cpuid + movs r10, r5 @ invalid processor (r5=0)? + beq __error_p @ yes, error 'p' ++ ldr r1, =0x000002a1 @ mach-type = TS-7250 + bl __lookup_machine_type @ r5=machinfo + movs r8, r5 @ invalid machine (r5=0)? + beq __error_a @ yes, error 'a' +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0006-Force-the-nF-bit-on.patch b/recipes/linux/linux-2.6.27/ts72xx/0006-Force-the-nF-bit-on.patch new file mode 100644 index 0000000000..db96acc060 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0006-Force-the-nF-bit-on.patch @@ -0,0 +1,33 @@ +From 9852d9654b25b396cf5f31de376a2c211805db8b Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?Petr=20=C5=A0tetiar?= +Date: Sat, 3 Jan 2009 21:35:03 +0100 +Subject: [PATCH] Force the nF bit on +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Usually this is set by the bootrom. If it is not set, then the CPU core will +run from HCLK instead of FCLK, and performance will suffer. If you see +BogoMIPS of about 1/4 of your CPU clock, try turning this on; your performance +should double. + +Signed-off-by: Petr Štetiar +--- + arch/arm/mm/proc-arm920.S | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S +index 28cdb06..12f59db 100644 +--- a/arch/arm/mm/proc-arm920.S ++++ b/arch/arm/mm/proc-arm920.S +@@ -395,6 +395,7 @@ __arm920_setup: + mrc p15, 0, r0, c1, c0 @ get control register v4 + bic r0, r0, r5 + orr r0, r0, r6 ++ orr r0, r0, #0x40000000 + mov pc, lr + .size __arm920_setup, . - __arm920_setup + +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0007-Use-CPLD-watchdog-to-reset.patch b/recipes/linux/linux-2.6.27/ts72xx/0007-Use-CPLD-watchdog-to-reset.patch new file mode 100644 index 0000000000..c2fbd5c407 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0007-Use-CPLD-watchdog-to-reset.patch @@ -0,0 +1,54 @@ +From fca24d7cd93b7282d139cb91c0f4d62b1a95a985 Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?Petr=20=C5=A0tetiar?= +Date: Sat, 3 Jan 2009 21:36:36 +0100 +Subject: [PATCH] Use CPLD watchdog to reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Use CPLD watchdog to reset the machine instead of buggy ep93xx one, which +sometimes get stuck... + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/include/mach/system.h | 17 ++++++++++++----- + 1 files changed, 12 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/include/mach/system.h b/arch/arm/mach-ep93xx/include/mach/system.h +index 67789d0..5d85094 100644 +--- a/arch/arm/mach-ep93xx/include/mach/system.h ++++ b/arch/arm/mach-ep93xx/include/mach/system.h +@@ -3,6 +3,7 @@ + */ + + #include ++#include + + static inline void arch_idle(void) + { +@@ -15,11 +16,17 @@ static inline void arch_reset(char mode) + + local_irq_disable(); + +- devicecfg = __raw_readl(EP93XX_SYSCON_DEVICE_CONFIG); +- __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); +- __raw_writel(devicecfg | 0x80000000, EP93XX_SYSCON_DEVICE_CONFIG); +- __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); +- __raw_writel(devicecfg & ~0x80000000, EP93XX_SYSCON_DEVICE_CONFIG); ++ if (machine_is_ts72xx()) { ++ __raw_writeb(0x5, TS72XX_WATCHDOG_FEED_PHYS_BASE); ++ __raw_writeb(0x1, TS72XX_WATCHDOG_CONTROL_PHYS_BASE); ++ } else { ++ devicecfg = __raw_readl(EP93XX_SYSCON_DEVICE_CONFIG); ++ __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); ++ __raw_writel(devicecfg | 0x80000000, EP93XX_SYSCON_DEVICE_CONFIG); ++ __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); ++ __raw_writel(devicecfg & ~0x80000000, EP93XX_SYSCON_DEVICE_CONFIG); ++ } ++ + + while (1) + ; +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0008-Fix-UART-clocks.patch b/recipes/linux/linux-2.6.27/ts72xx/0008-Fix-UART-clocks.patch new file mode 100644 index 0000000000..43848478f8 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0008-Fix-UART-clocks.patch @@ -0,0 +1,99 @@ +From 1a86fa006baad26dcb70645e9d2a965f956a7189 Mon Sep 17 00:00:00 2001 +From: Lennert Buytenhek +Date: Sat, 3 Jan 2009 21:51:11 +0100 +Subject: [PATCH] Fix UART clocks +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Hackishly enable all UART clocks before uncompressing the kernel, +so that using ttyAM1 or ttyAM2 as console can work. Force UARTBAUD +on before uncompressing. + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/include/mach/uncompress.h | 65 ++++++++++++++++++++++++ + 1 files changed, 65 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/include/mach/uncompress.h b/arch/arm/mach-ep93xx/include/mach/uncompress.h +index 1fd2f17..ecdfd64 100644 +--- a/arch/arm/mach-ep93xx/include/mach/uncompress.h ++++ b/arch/arm/mach-ep93xx/include/mach/uncompress.h +@@ -77,9 +77,74 @@ static void ethernet_reset(void) + } + + ++/* ++ * We don't have clock management for the UARTs (amba-pl010) ++ * yet, so hackily enable all UART clocks here for now. ++ */ ++#define PHYS_SYSCON_DEVICE_CONFIG 0x80930080 ++#define PHYS_SYSCON_SWLOCK 0x809300c0 ++ ++static void enable_all_uart_clocks(void) ++{ ++ unsigned int v; ++ ++ v = __raw_readl(PHYS_SYSCON_DEVICE_CONFIG); ++ __raw_writel(0xaa, PHYS_SYSCON_SWLOCK); ++ __raw_writel(v | 0x01140000, PHYS_SYSCON_DEVICE_CONFIG); ++} ++ ++ ++/* ++ * Some bootloaders don't turn on the UARTBAUD bit, which means that ++ * the UARTs will be running off a divided 7.3728 MHz clock instead of ++ * the 14.7456 MHz peripheral clock when linux boots. ++ * ++ * We detect that condition here and fix it by turning on UARTBAUD, and ++ * then reprogramming the divisors on all enabled UARTs to twice what ++ * they were before we turned UARTBAUD on, to preserve the programmed ++ * baud rate. ++ */ ++#define PHYS_SYSCON_CLOCK_CONTROL 0x80930004 ++#define SYSCON_CLOCK_UARTBAUD 0x20000000 ++#define PHYS_UART1_BASE 0x808c0000 ++#define PHYS_UART2_BASE 0x808d0000 ++#define PHYS_UART3_BASE 0x808e0000 ++ ++static void uart_divisor_times_two(unsigned int base) ++{ ++ u16 divisor; ++ ++ divisor = __raw_readb(base + 0x0c) << 8; ++ divisor |= __raw_readb(base + 0x10); ++ if (divisor) { ++ divisor = (2 * (divisor + 1)) - 1; ++ __raw_writeb(divisor >> 8, base + 0x0c); ++ __raw_writeb(divisor & 0xff, base + 0x10); ++ __raw_writeb(__raw_readb(base + 0x08), base + 0x08); ++ } ++} ++ ++static void fix_uart_base(void) ++{ ++ unsigned int v; ++ ++ v = __raw_readl(PHYS_SYSCON_CLOCK_CONTROL); ++ if ((v & SYSCON_CLOCK_UARTBAUD) == 0) { ++ v |= SYSCON_CLOCK_UARTBAUD; ++ __raw_writel(v, PHYS_SYSCON_CLOCK_CONTROL); ++ ++ uart_divisor_times_two(PHYS_UART1_BASE); ++ uart_divisor_times_two(PHYS_UART2_BASE); ++ uart_divisor_times_two(PHYS_UART3_BASE); ++ } ++} ++ ++ + static void arch_decomp_setup(void) + { + ethernet_reset(); ++ enable_all_uart_clocks(); ++ fix_uart_base(); + } + + #define arch_decomp_wdog() +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0009-CPU-info-and-board-revision.patch b/recipes/linux/linux-2.6.27/ts72xx/0009-CPU-info-and-board-revision.patch new file mode 100644 index 0000000000..5dd360a796 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0009-CPU-info-and-board-revision.patch @@ -0,0 +1,64 @@ +From 3f48e4dc8affb4ddfe7b1ca8f209003cfb8ac314 Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sat, 3 Jan 2009 22:19:21 +0100 +Subject: [PATCH] CPU info and board revision +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Adds support for SoC's unique ID (Maverick Key) in /proc/cpuinfo and +information about board revision. + +Signed-off-by: Petr Štetiar +--- + arch/arm/kernel/setup.c | 9 +++++++++ + arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 3 +++ + 2 files changed, 12 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c +index 2ca7038..891fcf3 100644 +--- a/arch/arm/kernel/setup.c ++++ b/arch/arm/kernel/setup.c +@@ -994,9 +994,18 @@ static int c_show(struct seq_file *m, void *v) + seq_puts(m, "\n"); + + seq_printf(m, "Hardware\t: %s\n", machine_name); ++ ++#if defined(CONFIG_ARCH_EP93XX) ++#include ++ seq_printf(m, "Revision\t: %04x\n", ++ *((unsigned int *)EP93XX_SYSCON_CHIPID) >> 28); ++ seq_printf(m, "Serial\t\t: %016x\n", ++ *((unsigned int *)EP93XX_SECURITY_UNIQID)); ++#else + seq_printf(m, "Revision\t: %04x\n", system_rev); + seq_printf(m, "Serial\t\t: %08x%08x\n", + system_serial_high, system_serial_low); ++#endif + + return 0; + } +diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +index 5582138..e26b41b 100644 +--- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h ++++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +@@ -70,6 +70,8 @@ + #define EP93XX_I2S_BASE (EP93XX_APB_VIRT_BASE + 0x00020000) + + #define EP93XX_SECURITY_BASE (EP93XX_APB_VIRT_BASE + 0x00030000) ++#define EP93XX_SECURITY_REG(x) (EP93XX_SECURITY_BASE + (x)) ++#define EP93XX_SECURITY_UNIQID EP93XX_SECURITY_REG(0x2440) + + #define EP93XX_GPIO_BASE (EP93XX_APB_VIRT_BASE + 0x00040000) + #define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) +@@ -129,6 +131,7 @@ + #define EP93XX_SYSCON_DEVICE_CONFIG EP93XX_SYSCON_REG(0x80) + #define EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE 0x00800000 + #define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) ++#define EP93XX_SYSCON_CHIPID EP93XX_SYSCON_REG(0x94) + + #define EP93XX_WATCHDOG_BASE (EP93XX_APB_VIRT_BASE + 0x00140000) + +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0010-GPIO-leds.patch b/recipes/linux/linux-2.6.27/ts72xx/0010-GPIO-leds.patch new file mode 100644 index 0000000000..74c4490666 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0010-GPIO-leds.patch @@ -0,0 +1,72 @@ +From 11158bb59b2d848f1827d4ed59d4ca20d1f91d11 Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 00:58:03 +0100 +Subject: [PATCH] GPIO leds +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/core.c | 31 +++++++++++++++++++++++++++++++ + 1 files changed, 31 insertions(+), 0 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c +index 24b24c7..88afbe6 100644 +--- a/arch/arm/mach-ep93xx/core.c ++++ b/arch/arm/mach-ep93xx/core.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -480,6 +481,35 @@ static struct platform_device ep93xx_ohci_device = { + .resource = ep93xx_ohci_resources, + }; + ++ ++static const struct gpio_led ep93xx_led_pins[] = { ++ { ++ .name = "green", ++ .gpio = EP93XX_GPIO_LINE_GRLED, ++ .active_low = 0, ++ .default_trigger = "heartbeat", ++ }, ++ { ++ .name = "red", ++ .gpio = EP93XX_GPIO_LINE_RDLED, ++ .active_low = 0, ++ } ++}; ++ ++static const struct gpio_led_platform_data ep93xx_led_data = { ++ .num_leds = ARRAY_SIZE(ep93xx_led_pins), ++ .leds = (void *)ep93xx_led_pins, ++}; ++ ++static struct platform_device ep93xx_gpio_leds = { ++ .name = "leds-gpio", ++ .id = -1, ++ .dev = { ++ .platform_data = (void *)&ep93xx_led_data, ++ } ++}; ++ ++ + extern void ep93xx_gpio_init(void); + + void __init ep93xx_init_devices(void) +@@ -500,6 +530,7 @@ void __init ep93xx_init_devices(void) + amba_device_register(&uart2_device, &iomem_resource); + amba_device_register(&uart3_device, &iomem_resource); + ++ platform_device_register(&ep93xx_gpio_leds); + platform_device_register(&ep93xx_rtc_device); + platform_device_register(&ep93xx_ohci_device); + } +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0011-EP93xx-Ethernet-support.patch b/recipes/linux/linux-2.6.27/ts72xx/0011-EP93xx-Ethernet-support.patch new file mode 100644 index 0000000000..dc520def5c --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0011-EP93xx-Ethernet-support.patch @@ -0,0 +1,548 @@ +From d4b6abf167207531bad915bf8931b0757d8bc01e Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 01:03:58 +0100 +Subject: [PATCH] EP93xx Ethernet support +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + drivers/net/arm/Kconfig | 1 + + drivers/net/arm/ep93xx_eth.c | 354 +++++++++++++++++++++++++++++++++--------- + 2 files changed, 282 insertions(+), 73 deletions(-) + +diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig +index 8eda6ee..84e6068 100644 +--- a/drivers/net/arm/Kconfig ++++ b/drivers/net/arm/Kconfig +@@ -44,6 +44,7 @@ config EP93XX_ETH + tristate "EP93xx Ethernet support" + depends on ARM && ARCH_EP93XX + select MII ++ select PHYLIB + help + This is a driver for the ethernet hardware included in EP93xx CPUs. + Say Y if you are building a kernel for EP93xx based devices. +diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c +index 1267444..c3f011f 100644 +--- a/drivers/net/arm/ep93xx_eth.c ++++ b/drivers/net/arm/ep93xx_eth.c +@@ -2,6 +2,7 @@ + * EP93xx ethernet network device driver + * Copyright (C) 2006 Lennert Buytenhek + * Dedicated to Marija Kulikova. ++ * Copyright (C) 2007 Herbert Valerio Riedel + * + * 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 +@@ -14,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -37,6 +39,8 @@ + #define REG_RXCTL_DEFAULT 0x00073800 + #define REG_TXCTL 0x0004 + #define REG_TXCTL_ENABLE 0x00000001 ++#define REG_TESTCTL 0x0008 ++#define REG_TESTCTL_MFDX 0x00000040 + #define REG_MIICMD 0x0010 + #define REG_MIICMD_READ 0x00008000 + #define REG_MIICMD_WRITE 0x00004000 +@@ -45,6 +49,9 @@ + #define REG_MIISTS_BUSY 0x00000001 + #define REG_SELFCTL 0x0020 + #define REG_SELFCTL_RESET 0x00000001 ++#define REG_SELFCTL_MDCDIV_MSK 0x00007e00 ++#define REG_SELFCTL_MDCDIV_OFS 9 ++#define REG_SELFCTL_PSPRS 0x00000100 + #define REG_INTEN 0x0024 + #define REG_INTEN_TX 0x00000008 + #define REG_INTEN_RX 0x00000007 +@@ -174,8 +181,14 @@ struct ep93xx_priv + + struct net_device_stats stats; + +- struct mii_if_info mii; + u8 mdc_divisor; ++ int phy_supports_mfps:1; ++ ++ struct mii_bus mii_bus; ++ struct phy_device *phy_dev; ++ int speed; ++ int duplex; ++ int link; + }; + + #define rdb(ep, off) __raw_readb((ep)->base_addr + (off)) +@@ -185,8 +198,6 @@ struct ep93xx_priv + #define wrw(ep, off, val) __raw_writew((val), (ep)->base_addr + (off)) + #define wrl(ep, off, val) __raw_writel((val), (ep)->base_addr + (off)) + +-static int ep93xx_mdio_read(struct net_device *dev, int phy_id, int reg); +- + static struct net_device_stats *ep93xx_get_stats(struct net_device *dev) + { + struct ep93xx_priv *ep = netdev_priv(dev); +@@ -524,6 +535,22 @@ err: + return 1; + } + ++static int ep93xx_mdio_reset(struct mii_bus *bus) ++{ ++ struct ep93xx_priv *ep = bus->priv; ++ ++ u32 selfctl = rdl(ep, REG_SELFCTL); ++ ++ selfctl &= ~(REG_SELFCTL_MDCDIV_MSK | REG_SELFCTL_PSPRS); ++ ++ selfctl |= (ep->mdc_divisor - 1) << REG_SELFCTL_MDCDIV_OFS; ++ selfctl |= REG_SELFCTL_PSPRS; ++ ++ wrl(ep, REG_SELFCTL, selfctl); ++ ++ return 0; ++} ++ + static int ep93xx_start_hw(struct net_device *dev) + { + struct ep93xx_priv *ep = netdev_priv(dev); +@@ -542,11 +569,8 @@ static int ep93xx_start_hw(struct net_device *dev) + return 1; + } + +- wrl(ep, REG_SELFCTL, ((ep->mdc_divisor - 1) << 9)); +- +- /* Does the PHY support preamble suppress? */ +- if ((ep93xx_mdio_read(dev, ep->mii.phy_id, MII_BMSR) & 0x0040) != 0) +- wrl(ep, REG_SELFCTL, ((ep->mdc_divisor - 1) << 9) | (1 << 8)); ++ /* The reset cleared REG_SELFCTL, so set the MDC divisor again */ ++ ep93xx_mdio_reset(&ep->mii_bus); + + /* Receive descriptor ring. */ + addr = ep->descs_dma_addr + offsetof(struct ep93xx_descs, rdesc); +@@ -631,12 +655,11 @@ static int ep93xx_open(struct net_device *dev) + return -ENOMEM; + + if (is_zero_ether_addr(dev->dev_addr)) { ++ DECLARE_MAC_BUF(mac_buf); ++ + random_ether_addr(dev->dev_addr); +- printk(KERN_INFO "%s: generated random MAC address " +- "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name, +- dev->dev_addr[0], dev->dev_addr[1], +- dev->dev_addr[2], dev->dev_addr[3], +- dev->dev_addr[4], dev->dev_addr[5]); ++ dev_info(&dev->dev, "generated random MAC address %s\n", ++ print_mac(mac_buf, dev->dev_addr)); + } + + napi_enable(&ep->napi); +@@ -664,6 +687,8 @@ static int ep93xx_open(struct net_device *dev) + + wrl(ep, REG_GIINTMSK, REG_GIINTMSK_ENABLE); + ++ phy_start(ep->phy_dev); ++ + netif_start_queue(dev); + + return 0; +@@ -676,6 +701,9 @@ static int ep93xx_close(struct net_device *dev) + napi_disable(&ep->napi); + netif_stop_queue(dev); + ++ if (ep->phy_dev) ++ phy_stop(ep->phy_dev); ++ + wrl(ep, REG_GIINTMSK, 0); + free_irq(ep->irq, dev); + ep93xx_stop_hw(dev); +@@ -687,51 +715,83 @@ static int ep93xx_close(struct net_device *dev) + static int ep93xx_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) + { + struct ep93xx_priv *ep = netdev_priv(dev); +- struct mii_ioctl_data *data = if_mii(ifr); + +- return generic_mii_ioctl(&ep->mii, data, cmd, NULL); ++ return phy_mii_ioctl(ep->phy_dev, if_mii(ifr), cmd); + } + +-static int ep93xx_mdio_read(struct net_device *dev, int phy_id, int reg) ++/* common MII transactions should take < 100 iterations */ ++#define EP93XX_PHY_TIMEOUT 2000 ++ ++static int ep93xx_mdio_wait(struct mii_bus *bus) + { +- struct ep93xx_priv *ep = netdev_priv(dev); +- int data; +- int i; ++ struct ep93xx_priv *ep = bus->priv; ++ unsigned int timeout = EP93XX_PHY_TIMEOUT; + +- wrl(ep, REG_MIICMD, REG_MIICMD_READ | (phy_id << 5) | reg); ++ while ((rdl(ep, REG_MIISTS) & REG_MIISTS_BUSY) ++ && timeout--) ++ cpu_relax(); + +- for (i = 0; i < 10; i++) { +- if ((rdl(ep, REG_MIISTS) & REG_MIISTS_BUSY) == 0) +- break; +- msleep(1); ++ if (timeout <= 0) { ++ dev_err(bus->dev, "MII operation timed out\n"); ++ return -ETIMEDOUT; + } + +- if (i == 10) { +- printk(KERN_INFO DRV_MODULE_NAME ": mdio read timed out\n"); +- data = 0xffff; +- } else { +- data = rdl(ep, REG_MIIDATA); +- } ++ return 0; ++} ++ ++static int ep93xx_mdio_read(struct mii_bus *bus, int mii_id, int regnum) ++{ ++ struct ep93xx_priv *ep = bus->priv; ++ u32 selfctl; ++ u32 data; ++ ++ if (ep93xx_mdio_wait(bus) < 0) ++ return -ETIMEDOUT; + +- return data; ++ selfctl = rdl(ep, REG_SELFCTL); ++ ++ if (ep->phy_supports_mfps) ++ wrl(ep, REG_SELFCTL, selfctl | REG_SELFCTL_PSPRS); ++ else ++ wrl(ep, REG_SELFCTL, selfctl & ~REG_SELFCTL_PSPRS); ++ ++ wrl(ep, REG_MIICMD, REG_MIICMD_READ | (mii_id << 5) | regnum); ++ ++ if (ep93xx_mdio_wait(bus) < 0) ++ return -ETIMEDOUT; ++ ++ data = rdl(ep, REG_MIIDATA); ++ ++ wrl(ep, REG_SELFCTL, selfctl); ++ ++ return data; + } + +-static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int data) ++static int ep93xx_mdio_write(struct mii_bus *bus, int mii_id, int regnum, ++ u16 value) + { +- struct ep93xx_priv *ep = netdev_priv(dev); +- int i; ++ struct ep93xx_priv *ep = bus->priv; ++ u32 selfctl; + +- wrl(ep, REG_MIIDATA, data); +- wrl(ep, REG_MIICMD, REG_MIICMD_WRITE | (phy_id << 5) | reg); ++ if (ep93xx_mdio_wait(bus) < 0) ++ return -ETIMEDOUT; + +- for (i = 0; i < 10; i++) { +- if ((rdl(ep, REG_MIISTS) & REG_MIISTS_BUSY) == 0) +- break; +- msleep(1); +- } ++ selfctl = rdl(ep, REG_SELFCTL); + +- if (i == 10) +- printk(KERN_INFO DRV_MODULE_NAME ": mdio write timed out\n"); ++ if (ep->phy_supports_mfps) ++ wrl(ep, REG_SELFCTL, selfctl | REG_SELFCTL_PSPRS); ++ else ++ wrl(ep, REG_SELFCTL, selfctl & ~REG_SELFCTL_PSPRS); ++ ++ wrl(ep, REG_MIIDATA, value); ++ wrl(ep, REG_MIICMD, REG_MIICMD_WRITE | (mii_id << 5) | regnum); ++ ++ if (ep93xx_mdio_wait(bus) < 0) ++ return -ETIMEDOUT; ++ ++ wrl(ep, REG_SELFCTL, selfctl); ++ ++ return 0; + } + + static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) +@@ -743,33 +803,31 @@ static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i + static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) + { + struct ep93xx_priv *ep = netdev_priv(dev); +- return mii_ethtool_gset(&ep->mii, cmd); ++ struct phy_device *phydev = ep->phy_dev; ++ ++ if (!phydev) ++ return -ENODEV; ++ ++ return phy_ethtool_gset(phydev, cmd); + } + + static int ep93xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) + { + struct ep93xx_priv *ep = netdev_priv(dev); +- return mii_ethtool_sset(&ep->mii, cmd); +-} ++ struct phy_device *phydev = ep->phy_dev; + +-static int ep93xx_nway_reset(struct net_device *dev) +-{ +- struct ep93xx_priv *ep = netdev_priv(dev); +- return mii_nway_restart(&ep->mii); +-} ++ if (!phydev) ++ return -ENODEV; + +-static u32 ep93xx_get_link(struct net_device *dev) +-{ +- struct ep93xx_priv *ep = netdev_priv(dev); +- return mii_link_ok(&ep->mii); ++ return phy_ethtool_sset(phydev, cmd); + } + ++ + static struct ethtool_ops ep93xx_ethtool_ops = { + .get_drvinfo = ep93xx_get_drvinfo, + .get_settings = ep93xx_get_settings, + .set_settings = ep93xx_set_settings, +- .nway_reset = ep93xx_nway_reset, +- .get_link = ep93xx_get_link, ++ .get_link = ethtool_op_get_link, + }; + + struct net_device *ep93xx_dev_alloc(struct ep93xx_eth_data *data) +@@ -824,12 +882,122 @@ static int ep93xx_eth_remove(struct platform_device *pdev) + return 0; + } + ++static void ep93xx_adjust_link(struct net_device *dev) ++{ ++ struct ep93xx_priv *ep = netdev_priv(dev); ++ struct phy_device *phydev = ep->phy_dev; ++ ++ int status_change = 0; ++ ++ if (phydev->link) { ++ if ((ep->speed != phydev->speed) || ++ (ep->duplex != phydev->duplex)) { ++ /* speed and/or duplex state changed */ ++ u32 testctl = rdl(ep, REG_TESTCTL); ++ ++ if (DUPLEX_FULL == phydev->duplex) ++ testctl |= REG_TESTCTL_MFDX; ++ else ++ testctl &= ~(REG_TESTCTL_MFDX); ++ ++ wrl(ep, REG_TESTCTL, testctl); ++ ++ ep->speed = phydev->speed; ++ ep->duplex = phydev->duplex; ++ status_change = 1; ++ } ++ } ++ ++ /* test for online/offline link transition */ ++ if (phydev->link != ep->link) { ++ if (phydev->link) /* link went online */ ++ netif_tx_schedule_all(dev); ++ else { /* link went offline */ ++ ep->speed = 0; ++ ep->duplex = -1; ++ } ++ ep->link = phydev->link; ++ ++ status_change = 1; ++ } ++ ++ if (status_change) ++ phy_print_status(phydev); ++} ++ ++static int ep93xx_mii_probe(struct net_device *dev, int phy_addr) ++{ ++ struct ep93xx_priv *ep = netdev_priv(dev); ++ struct phy_device *phydev = NULL; ++ int val; ++ ++ if (phy_addr >= 0 && phy_addr < PHY_MAX_ADDR) ++ phydev = ep->mii_bus.phy_map[phy_addr]; ++ ++ if (!phydev) { ++ dev_info(&dev->dev, ++ "PHY not found at specified address," ++ " trying autodetection\n"); ++ ++ /* find the first phy */ ++ for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { ++ if (ep->mii_bus.phy_map[phy_addr]) { ++ phydev = ep->mii_bus.phy_map[phy_addr]; ++ break; ++ } ++ } ++ } ++ ++ if (!phydev) { ++ dev_err(&dev->dev, "no PHY found\n"); ++ return -ENODEV; ++ } ++ ++ phydev = phy_connect(dev, phydev->dev.bus_id, ++ ep93xx_adjust_link, 0, PHY_INTERFACE_MODE_MII); ++ ++ if (IS_ERR(phydev)) { ++ dev_err(&dev->dev, "Could not attach to PHY\n"); ++ return PTR_ERR(phydev); ++ } ++ ++ ep->phy_supports_mfps = 0; ++ ++ val = phy_read(phydev, MII_BMSR); ++ if (val < 0) { ++ dev_err(&phydev->dev, "failed to read MII register\n"); ++ return val; ++ } ++ ++ if (val & 0x0040) { ++ dev_info(&phydev->dev, ++ "PHY supports MII frame preamble suppression\n"); ++ ep->phy_supports_mfps = 1; ++ } ++ ++ phydev->supported &= PHY_BASIC_FEATURES; ++ ++ phydev->advertising = phydev->supported; ++ ++ ep->link = 0; ++ ep->speed = 0; ++ ep->duplex = -1; ++ ep->phy_dev = phydev; ++ ++ dev_info(&dev->dev, "attached PHY driver [%s] " ++ "(mii_bus:phy_addr=%s, irq=%d)\n", ++ phydev->drv->name, phydev->dev.bus_id, phydev->irq); ++ ++ return 0; ++} ++ + static int ep93xx_eth_probe(struct platform_device *pdev) + { + struct ep93xx_eth_data *data; + struct net_device *dev; + struct ep93xx_priv *ep; +- int err; ++ DECLARE_MAC_BUF(mac_buf); ++ int err, i; + + if (pdev == NULL) + return -ENODEV; +@@ -852,7 +1020,7 @@ static int ep93xx_eth_probe(struct platform_device *pdev) + if (ep->res == NULL) { + dev_err(&pdev->dev, "Could not reserve memory region\n"); + err = -ENOMEM; +- goto err_out; ++ goto err_out_request_mem_region; + } + + ep->base_addr = ioremap(pdev->resource[0].start, +@@ -860,34 +1028,74 @@ static int ep93xx_eth_probe(struct platform_device *pdev) + if (ep->base_addr == NULL) { + dev_err(&pdev->dev, "Failed to ioremap ethernet registers\n"); + err = -EIO; +- goto err_out; ++ goto err_out_ioremap; + } + ep->irq = pdev->resource[1].start; + +- ep->mii.phy_id = data->phy_id; +- ep->mii.phy_id_mask = 0x1f; +- ep->mii.reg_num_mask = 0x1f; +- ep->mii.dev = dev; +- ep->mii.mdio_read = ep93xx_mdio_read; +- ep->mii.mdio_write = ep93xx_mdio_write; ++ /* mdio/mii bus */ ++ ep->mii_bus.name = "ep93xx_mii_bus"; ++ snprintf(ep->mii_bus.id, MII_BUS_ID_SIZE, "0"); ++ ++ ep->mii_bus.read = ep93xx_mdio_read; ++ ep->mii_bus.write = ep93xx_mdio_write; ++ ep->mii_bus.reset = ep93xx_mdio_reset; ++ ++ ep->mii_bus.phy_mask = 0; ++ ++ ep->mii_bus.priv = ep; ++ ep->mii_bus.dev = &dev->dev; ++ ++ ep->mii_bus.irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); ++ if (NULL == ep->mii_bus.irq) { ++ dev_err(&pdev->dev, "Could not allocate memory\n"); ++ err = -ENOMEM; ++ goto err_out_mii_bus_irq_kmalloc; ++ } ++ ++ for (i = 0; i < PHY_MAX_ADDR; i++) ++ ep->mii_bus.irq[i] = PHY_POLL; ++ + ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ ++ ep->phy_supports_mfps = 0; /* probe without preamble suppression */ + + err = register_netdev(dev); + if (err) { + dev_err(&pdev->dev, "Failed to register netdev\n"); +- goto err_out; ++ goto err_out_register_netdev; + } + +- printk(KERN_INFO "%s: ep93xx on-chip ethernet, IRQ %d, " +- "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name, +- ep->irq, data->dev_addr[0], data->dev_addr[1], +- data->dev_addr[2], data->dev_addr[3], +- data->dev_addr[4], data->dev_addr[5]); ++ err = mdiobus_register(&ep->mii_bus); ++ if (err) { ++ dev_err(&dev->dev, "Could not register MII bus\n"); ++ goto err_out_mdiobus_register; ++ } ++ ++ err = ep93xx_mii_probe(dev, data->phy_id); ++ if (err) { ++ dev_err(&dev->dev, "failed to probe MII bus\n"); ++ goto err_out_mii_probe; ++ } ++ ++ dev_info(&dev->dev, "ep93xx on-chip ethernet, IRQ %d, %s\n", ++ ep->irq, print_mac(mac_buf, dev->dev_addr)); + + return 0; + ++err_out_mii_probe: ++ mdiobus_unregister(&ep->mii_bus); ++err_out_mdiobus_register: ++ unregister_netdev(dev); ++err_out_register_netdev: ++ kfree(ep->mii_bus.irq); ++err_out_mii_bus_irq_kmalloc: ++ iounmap(ep->base_addr); ++err_out_ioremap: ++ release_resource(ep->res); ++ kfree(ep->res); ++err_out_request_mem_region: ++ free_netdev(dev); + err_out: +- ep93xx_eth_remove(pdev); ++ + return err; + } + +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0012-TS72xx-watchdog.patch b/recipes/linux/linux-2.6.27/ts72xx/0012-TS72xx-watchdog.patch new file mode 100644 index 0000000000..66822033b3 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0012-TS72xx-watchdog.patch @@ -0,0 +1,451 @@ +From 0e804ab442879a1d9c70695e5a5c0ffc87cbca8b Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 01:15:14 +0100 +Subject: [PATCH] TS72xx watchdog +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/include/mach/ts72xx.h | 7 + + arch/arm/mach-ep93xx/ts72xx.c | 21 ++ + drivers/watchdog/Kconfig | 12 + + drivers/watchdog/Makefile | 1 + + drivers/watchdog/ts72xx_wdt.c | 332 ++++++++++++++++++++++++++++ + 5 files changed, 373 insertions(+), 0 deletions(-) + create mode 100644 drivers/watchdog/ts72xx_wdt.c + +diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/include/mach/ts72xx.h +index 99c4e48..bb67506 100644 +--- a/arch/arm/mach-ep93xx/include/mach/ts72xx.h ++++ b/arch/arm/mach-ep93xx/include/mach/ts72xx.h +@@ -79,6 +79,13 @@ + #define TS72XX_RTC_DATA_PHYS_BASE 0x11700000 + #define TS72XX_RTC_DATA_SIZE 0x00001000 + ++#define TS72XX_WATCHDOG_CONTROL_VIRT_BASE 0xfebf7000 ++#define TS72XX_WATCHDOG_CONTROL_PHYS_BASE 0x23800000 ++#define TS72XX_WATCHDOG_CONTROL_SIZE 0x00001000 ++ ++#define TS72XX_WATCHDOG_FEED_VIRT_BASE 0xfebf6000 ++#define TS72XX_WATCHDOG_FEED_PHYS_BASE 0x23c00000 ++#define TS72XX_WATCHDOG_FEED_SIZE 0x00001000 + + #ifndef __ASSEMBLY__ + #include +diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c +index c3cbff1..1e933bc 100644 +--- a/arch/arm/mach-ep93xx/ts72xx.c ++++ b/arch/arm/mach-ep93xx/ts72xx.c +@@ -183,6 +183,26 @@ static struct platform_device ts72xx_eth_device = { + .resource = ts72xx_eth_resource, + }; + ++static struct resource ts72xx_watchdog_resources[] = { ++ [0] = { ++ .start = TS72XX_WATCHDOG_CONTROL_PHYS_BASE, ++ .end = TS72XX_WATCHDOG_CONTROL_PHYS_BASE + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ }, ++ [1] = { ++ .start = TS72XX_WATCHDOG_FEED_PHYS_BASE, ++ .end = TS72XX_WATCHDOG_FEED_PHYS_BASE + 0x0fff, ++ .flags = IORESOURCE_MEM, ++ }, ++}; ++ ++static struct platform_device ts72xx_watchdog_device = { ++ .name = "ts72xx-wdt", ++ .id = -1, ++ .num_resources = ARRAY_SIZE(ts72xx_watchdog_resources), ++ .resource = ts72xx_watchdog_resources, ++}; ++ + static void __init ts72xx_init_machine(void) + { + ep93xx_init_devices(); +@@ -193,6 +213,7 @@ static void __init ts72xx_init_machine(void) + memcpy(ts72xx_eth_data.dev_addr, + (void *)(EP93XX_ETHERNET_BASE + 0x50), 6); + platform_device_register(&ts72xx_eth_device); ++ platform_device_register(&ts72xx_watchdog_device); + } + + MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC") +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig +index c510367..fac3093 100644 +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -217,6 +217,18 @@ config DAVINCI_WATCHDOG + NOTE: once enabled, this timer cannot be disabled. + Say N if you are unsure. + ++config TS72XX_WATCHDOG ++ tristate "TS-72xx Watchdog" ++ depends on WATCHDOG && ARCH_EP93XX && MACH_TS72XX ++ help ++ Say Y here if to include support for the CPLD watchdog ++ included on Technologic Systems SBC. ++ ++ NOTE: timeout value is given in milliseconds, not in seconds. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called ts72xx_wdt. ++ + # ARM26 Architecture + + # AVR32 Architecture +diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile +index e0ef123..890024b 100644 +--- a/drivers/watchdog/Makefile ++++ b/drivers/watchdog/Makefile +@@ -39,6 +39,7 @@ obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o + obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o + obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o + obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o ++obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o + + # ARM26 Architecture + +diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c +new file mode 100644 +index 0000000..7cbac78 +--- /dev/null ++++ b/drivers/watchdog/ts72xx_wdt.c +@@ -0,0 +1,332 @@ ++/* ++ * TS-72xx Watchdog Driver for Technologic Systems boards. ++ * ++ * Based on ep93xx_wdt.c by Lehtiniemi & ++ * Alessandro Zummo ++ * and ib700wdt.c by Charles Howes ++ * and mpc83xx_wdt.c by Dave Updegraff & ++ * Kumar Gala ++ * ++ * (c) Copyright 2006 Matthieu Crapet ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ * ++ * This driver only deals with native timeout provided by CPLD : ++ * 1/4s, 1/2s, 1s, 2s, 4s and 8s. No external timer is used. ++ * Notice that we must ping before modifying the control register. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define WATCHDOG_VERSION "0.2" ++#define PFX "ts72xx_wdt: " ++ ++#define WATCHDOG_TIMEOUT 8000 /* 8 seconds */ ++#define WDT_IN_USE 0 ++#define WDT_OK_TO_CLOSE 1 ++ ++static unsigned long ts72xx_wdt_status; ++static unsigned char ts72xx_wdt_cpld_value = 0x7; ++static int nowayout = WATCHDOG_NOWAYOUT; ++static int timeout = WATCHDOG_TIMEOUT; ++ ++static int ts72xx_wdt_times[12] = { ++ 6000, 3000, 1500, 750, 275, 0, ++ 8000, 4000, 2000, 1000, 500, 250 ++}; ++ ++static void __iomem *control_register; ++static void __iomem *feed_register; ++ ++ ++/* ++ * Kernel methods. ++ */ ++ ++static inline void ts72xx_wdt_ping(void) ++{ ++ __raw_writew(0x05, feed_register); ++} ++ ++static inline void ts72xx_wdt_enable(void) ++{ ++ __raw_writew(0x05, feed_register); ++ __raw_writew(ts72xx_wdt_cpld_value, control_register); ++} ++ ++static inline void ts72xx_wdt_disable(void) ++{ ++ __raw_writew(0x05, feed_register); ++ __raw_writew(0, control_register); ++} ++ ++static inline void ts72xx_parse_timeout(int value) ++{ ++ unsigned char cpld_value = 0x7; ++ int i; ++ ++ if ((value > 8000) || (value < 250)) { ++ timeout = WATCHDOG_TIMEOUT; ++ printk(KERN_INFO PFX "Timeout value out of range, set to %d\n", timeout); ++ } else { ++ for (i = 0; i < 6; i++) { ++ if (value >= ts72xx_wdt_times[i]) { ++ timeout = ts72xx_wdt_times[i+6]; ++ ++ if (value != timeout) ++ printk(KERN_INFO PFX "Timeout value rounded to %d\n", timeout); ++ ++ if (i >= 3) /* cpld_value can't be 4 */ ++ i++; ++ ++ cpld_value = 7 - i; ++ break; ++ } ++ } ++ } ++ ++ ts72xx_wdt_cpld_value = cpld_value; ++} ++ ++static ssize_t ts72xx_wdt_write(struct file *file, const char __user *buf, ++ size_t count, loff_t *ppos) ++{ ++ /* Can't seek (pwrite) on this device */ ++ if (*ppos != file->f_pos) ++ return -ESPIPE; ++ ++ if (count) { ++ if (!nowayout) { ++ size_t i; ++ ++ clear_bit(WDT_OK_TO_CLOSE, &ts72xx_wdt_status); ++ ++ for (i = 0; i != count; i++) { ++ char c; ++ ++ if (get_user(c, buf + i)) ++ return -EFAULT; ++ ++ if (c == 'V') ++ set_bit(WDT_OK_TO_CLOSE, &ts72xx_wdt_status); ++ else ++ clear_bit(WDT_OK_TO_CLOSE, &ts72xx_wdt_status); ++ } ++ } ++ ts72xx_wdt_ping(); ++ } ++ ++ return count; ++} ++ ++static int ts72xx_wdt_ioctl(struct inode *inode, struct file *file, ++ unsigned int cmd, unsigned long arg) ++{ ++ int new_margin; ++ int ret = -ENOIOCTLCMD; ++ ++ static struct watchdog_info ident = { ++ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, ++ .firmware_version = 1, ++ .identity = "TS-72xx Watchdog", ++ }; ++ ++ switch (cmd) { ++ case WDIOC_GETSUPPORT: ++ ret = copy_to_user((struct watchdog_info __user *)arg, &ident, ++ sizeof(ident)) ? -EFAULT : 0; ++ break; ++ ++ case WDIOC_GETSTATUS: ++ case WDIOC_GETBOOTSTATUS: ++ ret = put_user(0, (int __user *)arg); ++ break; ++ ++ case WDIOC_KEEPALIVE: ++ ts72xx_wdt_ping(); ++ ret = 0; ++ break; ++ ++ case WDIOC_SETTIMEOUT: ++ if (get_user(new_margin, (int __user *)arg)) ++ return -EFAULT; ++ ++ ts72xx_parse_timeout(new_margin); ++ ts72xx_wdt_enable(); ++ /* Fall */ ++ ++ case WDIOC_GETTIMEOUT: ++ ret = put_user(timeout, (int __user *)arg); ++ break; ++ } ++ ++ return ret; ++} ++ ++static int ts72xx_wdt_open(struct inode *inode, struct file *file) ++{ ++ if (test_and_set_bit(WDT_IN_USE, &ts72xx_wdt_status)) ++ return -EBUSY; ++ ++ if (nowayout) { ++ __module_get(THIS_MODULE); ++ } ++ ++ ts72xx_wdt_enable(); ++ ts72xx_wdt_ping(); ++ ++ return nonseekable_open(inode, file); ++} ++ ++static int ts72xx_wdt_close(struct inode *inode, struct file *file) ++{ ++ if (test_bit(WDT_OK_TO_CLOSE, &ts72xx_wdt_status)) ++ ts72xx_wdt_disable(); ++ else ++ printk(KERN_CRIT PFX "Device file closed unexpectedly. " ++ "Will not stop the WDT!\n"); ++ ++ clear_bit(WDT_IN_USE, &ts72xx_wdt_status); ++ ++ return 0; ++} ++ ++/* ++ * Kernel Interfaces ++ */ ++ ++static struct file_operations ts72xx_wdt_fops = { ++ .owner = THIS_MODULE, ++ .llseek = no_llseek, ++ .write = ts72xx_wdt_write, ++ .ioctl = ts72xx_wdt_ioctl, ++ .open = ts72xx_wdt_open, ++ .release = ts72xx_wdt_close, ++}; ++ ++static struct miscdevice ts72xx_wdt_miscdev = { ++ .minor = WATCHDOG_MINOR, ++ .name = "watchdog", ++ .fops = &ts72xx_wdt_fops, ++}; ++ ++static void ts72xx_wdt_shutdown(struct platform_device *dev) ++{ ++ ts72xx_wdt_disable(); ++} ++ ++static int __devinit ts72xx_wdt_probe(struct platform_device *dev) ++{ ++ struct resource *r; ++ int ret; ++ ++ if (!machine_is_ts72xx()) ++ return -ENODEV; ++ ++ r = platform_get_resource(dev, IORESOURCE_MEM, 0); ++ ++ if (!r) { ++ ret = -ENODEV; ++ goto err_out; ++ } ++ ++ control_register = ioremap(r->start, r->end - r->start + 1); ++ ++ if (control_register == NULL) { ++ ret = -ENOMEM; ++ goto err_out; ++ } ++ ++ r = platform_get_resource(dev, IORESOURCE_MEM, 1); ++ ++ if (!r) { ++ ret = -ENODEV; ++ goto err_unmap1; ++ } ++ ++ feed_register = ioremap(r->start, r->end - r->start + 1); ++ ++ if (feed_register == NULL) { ++ ret = -ENOMEM; ++ goto err_unmap1; ++ } ++ ++ ret = misc_register(&ts72xx_wdt_miscdev); ++ if (ret) { ++ printk(KERN_ERR PFX "cannot register miscdev on minor=%d " ++ "(err=%d)\n", WATCHDOG_MINOR, ret); ++ goto err_unmap2; ++ } ++ ++ printk(KERN_INFO PFX "TS-72xx watchdog driver, v%s\n", WATCHDOG_VERSION); ++ ts72xx_parse_timeout(timeout); ++ ++ return 0; ++ ++err_unmap2: ++ iounmap(feed_register); ++err_unmap1: ++ iounmap(control_register); ++err_out: ++ return ret; ++} ++ ++static int __devexit ts72xx_wdt_remove(struct platform_device *dev) ++{ ++ misc_deregister(&ts72xx_wdt_miscdev); ++ iounmap(feed_register); ++ iounmap(control_register); ++ ++ return 0; ++} ++ ++static struct platform_driver ts72xx_wdt_driver = { ++ .probe = ts72xx_wdt_probe, ++ .remove = __devexit_p(ts72xx_wdt_remove), ++ .shutdown = ts72xx_wdt_shutdown, ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "ts72xx-wdt", ++ }, ++}; ++ ++static int __init ts72xx_wdt_init(void) ++{ ++ return platform_driver_register(&ts72xx_wdt_driver); ++} ++ ++static void __exit ts72xx_wdt_exit(void) ++{ ++ platform_driver_unregister(&ts72xx_wdt_driver); ++} ++ ++module_init(ts72xx_wdt_init); ++module_exit(ts72xx_wdt_exit); ++ ++#ifdef CONFIG_WATCHDOG_NOWAYOUT ++module_param(nowayout, int, 0); ++MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); ++#endif ++ ++module_param(timeout, int, 0); ++MODULE_PARM_DESC(timeout,"Watchdog timeout in milliseconds (250..8000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); ++ ++MODULE_AUTHOR("Matthieu Crapet "); ++MODULE_DESCRIPTION("TS-72xx watchdog driver"); ++MODULE_LICENSE("GPL"); ++MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0013-TS7200-NOR-physmap-fix.patch b/recipes/linux/linux-2.6.27/ts72xx/0013-TS7200-NOR-physmap-fix.patch new file mode 100644 index 0000000000..57ae1669be --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0013-TS7200-NOR-physmap-fix.patch @@ -0,0 +1,58 @@ +From bd9ea2dfdce02b9c941073bf5d51d5f18a28d101 Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 01:21:24 +0100 +Subject: [PATCH] TS7200 NOR physmap fix +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/ts72xx.c | 10 ++++++++-- + 1 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c +index 1e933bc..a9d3939 100644 +--- a/arch/arm/mach-ep93xx/ts72xx.c ++++ b/arch/arm/mach-ep93xx/ts72xx.c +@@ -111,13 +111,14 @@ static void __init ts72xx_map_io(void) + } + } + ++#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) + static struct physmap_flash_data ts72xx_flash_data = { +- .width = 1, ++ .width = 2, + }; + + static struct resource ts72xx_flash_resource = { + .start = TS72XX_NOR_PHYS_BASE, +- .end = TS72XX_NOR_PHYS_BASE + 0x00ffffff, ++ .end = TS72XX_NOR_PHYS_BASE + SZ_16M - 1, /* SZ_8M for 8mb flash */ + .flags = IORESOURCE_MEM, + }; + +@@ -130,6 +131,7 @@ static struct platform_device ts72xx_flash = { + .num_resources = 1, + .resource = &ts72xx_flash_resource, + }; ++#endif + + static unsigned char ts72xx_rtc_readbyte(unsigned long addr) + { +@@ -206,8 +208,12 @@ static struct platform_device ts72xx_watchdog_device = { + static void __init ts72xx_init_machine(void) + { + ep93xx_init_devices(); ++ ++ #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) + if (board_is_ts7200()) + platform_device_register(&ts72xx_flash); ++ #endif ++ + platform_device_register(&ts72xx_rtc_device); + + memcpy(ts72xx_eth_data.dev_addr, +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0014-TS-7200-8MB-NOR-flash.patch b/recipes/linux/linux-2.6.27/ts72xx/0014-TS-7200-8MB-NOR-flash.patch new file mode 100644 index 0000000000..95795b4bb3 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0014-TS-7200-8MB-NOR-flash.patch @@ -0,0 +1,163 @@ +From ba4ba164344096ae7bea45891e99f3630ec6879a Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 01:23:06 +0100 +Subject: [PATCH] TS-7200 8MB NOR flash +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + drivers/mtd/maps/Kconfig | 8 +++ + drivers/mtd/maps/Makefile | 2 + + drivers/mtd/maps/ts7200_flash.c | 109 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 119 insertions(+), 0 deletions(-) + create mode 100644 drivers/mtd/maps/ts7200_flash.c + +diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig +index df8e00b..818f53b 100644 +--- a/drivers/mtd/maps/Kconfig ++++ b/drivers/mtd/maps/Kconfig +@@ -481,6 +481,14 @@ config MTD_OMAP_NOR + These boards include the Innovator, H2, H3, OSK, Perseus2, and + more. If you have such a board, say 'Y'. + ++config MTD_TS7200_NOR ++ tristate "Technologic Systems TS-7200 flash 8Mb" ++ depends on MTD_CFI && ARCH_EP93XX ++ help ++ This provides a driver for the on-board flash of the Technologic ++ System's TS-7200 board. The 8MB flash is splitted into 3 partitions ++ which are accessed as separate MTD devices. ++ + # This needs CFI or JEDEC, depending on the cards found. + config MTD_PCI + tristate "PCI MTD driver" +diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile +index 6cda6df..8fe5e72 100644 +--- a/drivers/mtd/maps/Makefile ++++ b/drivers/mtd/maps/Makefile +@@ -65,3 +65,5 @@ obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o + obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o + obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o + obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o ++obj-$(CONFIG_MTD_TS7200_NOR) += ts7200_flash.o ++ +diff --git a/drivers/mtd/maps/ts7200_flash.c b/drivers/mtd/maps/ts7200_flash.c +new file mode 100644 +index 0000000..9113abd +--- /dev/null ++++ b/drivers/mtd/maps/ts7200_flash.c +@@ -0,0 +1,109 @@ ++/* ++ * ts7200_flash.c - mapping for TS-7200 SBCs (8mb NOR flash) ++ * No platform_device resource is used here. All is hardcoded. ++ * ++ * (c) Copyright 2006 Matthieu Crapet ++ * Based on ts5500_flash.c by Sean Young ++ * ++ * 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define STRINGIFY(x) #x ++#define TOSTRING(x) STRINGIFY(x) ++ ++#define WINDOW_ADDR 0x60000000 ++#define WINDOW_SIZE SZ_8M ++#define WINDOW_READABLE_SIZE (WINDOW_SIZE/SZ_1M) ++ ++ ++static struct mtd_info *mymtd; ++ ++static struct map_info ts7200nor_map = { ++ .name = "Full TS-7200 NOR flash", ++ .size = WINDOW_SIZE, ++ .bankwidth = 2, ++ .phys = WINDOW_ADDR, ++}; ++ ++/* ++ * MTD partitioning stuff ++ */ ++#ifdef CONFIG_MTD_PARTITIONS ++static struct mtd_partition static_partitions[] = ++{ ++ { ++ .name = "TS-BOOTROM", ++ .offset = 0, ++ .size = 0x20000, ++ .mask_flags = MTD_WRITEABLE, /* force read-only */ ++ }, ++ { ++ .name = "RootFS", ++ .offset = 0x20000, ++ .size = 0x600000, ++ }, ++ { ++ .name = "Redboot", ++ .offset = 0x620000, ++ .size = MTDPART_SIZ_FULL, /* up to the end */ ++ }, ++}; ++#endif ++ ++int __init init_ts7200nor(void) ++{ ++ printk(KERN_NOTICE "TS-7200 flash mapping: %dmo at 0x%x\n", WINDOW_READABLE_SIZE, WINDOW_ADDR); ++ ++ ts7200nor_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); ++ if (!ts7200nor_map.virt) { ++ printk("ts7200_flash: failed to ioremap\n"); ++ return -EIO; ++ } ++ ++ simple_map_init(&ts7200nor_map); ++ mymtd = do_map_probe("cfi_probe", &ts7200nor_map); ++ if (mymtd) { ++ mymtd->owner = THIS_MODULE; ++ add_mtd_device(mymtd); ++#ifdef CONFIG_MTD_PARTITIONS ++ return add_mtd_partitions(mymtd, static_partitions, ARRAY_SIZE(static_partitions)); ++#else ++ return 0; ++#endif ++ } ++ ++ iounmap((void *)ts7200nor_map.virt); ++ return -ENXIO; ++} ++ ++static void __exit cleanup_ts7200nor(void) ++{ ++ if (mymtd) { ++ del_mtd_device(mymtd); ++ map_destroy(mymtd); ++ } ++ if (ts7200nor_map.virt) { ++ iounmap((void *)ts7200nor_map.virt); ++ ts7200nor_map.virt = 0; ++ } ++} ++ ++module_init(init_ts7200nor); ++module_exit(cleanup_ts7200nor); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Matthieu Crapet "); ++MODULE_DESCRIPTION("MTD map driver for TS-7200 board (" TOSTRING(WINDOW_READABLE_SIZE) "MB flash version)"); +-- +1.6.0.4 + diff --git a/recipes/linux/linux-2.6.27/ts72xx/0015-TS-72xx-MAX197-support.patch b/recipes/linux/linux-2.6.27/ts72xx/0015-TS-72xx-MAX197-support.patch new file mode 100644 index 0000000000..0469920a59 --- /dev/null +++ b/recipes/linux/linux-2.6.27/ts72xx/0015-TS-72xx-MAX197-support.patch @@ -0,0 +1,365 @@ +From 7220a7235e7b6722fb7dc6e8f599a20bac224760 Mon Sep 17 00:00:00 2001 +From: Matthieu Crapet +Date: Sun, 4 Jan 2009 01:32:39 +0100 +Subject: [PATCH] TS-72xx MAX197 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Štetiar +--- + arch/arm/mach-ep93xx/include/mach/ts72xx.h | 8 + + arch/arm/mach-ep93xx/ts72xx.c | 27 ++++ + drivers/misc/Kconfig | 21 +++ + drivers/misc/Makefile | 1 + + drivers/misc/ts72xx_max197.c | 235 ++++++++++++++++++++++++++++ + 5 files changed, 292 insertions(+), 0 deletions(-) + create mode 100644 drivers/misc/ts72xx_max197.c + +diff --git a/arch/arm/mach-ep93xx/in