ep93xx/ts72xx patches
v2 cover ep93xx/ts72xx patches
Whole patchset is available on my GitHub repository[1] also.
1. https://github.com/ynezz/linux-2.6/commits/ts72xx-upstream
Changes since v1:
* incorporated Ryan's and Hartley's comments on CPLD watchdog patch
* added one more patch 5/5, which is fixing the bug in the model detection
Petr ?tetiar (5):
ARM: ep93xx: use more reliable CPLD watchdog for reset on ts72xx
ARM: ep93xx: add model detection for ts-7300 and ts-7400 boards
ARM: ep93xx: increase NR_BANKS to 16 for support of 128MB RAM
ARM: ep93xx: fix inverted RTS/DTR signals on uart1
ARM: ep93xx: ts72xx: fix board model detection
arch/arm/include/asm/setup.h | 6 +++++- arch/arm/mach-ep93xx/core.c | 4 ++-- arch/arm/mach-ep93xx/include/mach/system.h | 18 +++++++++++++----- arch/arm/mach-ep93xx/include/mach/ts72xx.h | 26 ++++++++++++++++++++++---- 4 files changed, 42 insertions(+), 12 deletions(-)
PATCH v2 1/5 ARM: ep93xx: use more reliable CPLD watchdog for reset on ts72xx
On all ep93xx based boards from Technologic Systems, there's CPLD watchdog available, so use this one to reset the board instead of the soft reset in CPU. I've seen some weird lockups with the soft reset on ep93xx in the past, while the reset via CPLD watchdog seems to be rock solid (tm) and works fine so far.
--- arch/arm/mach-ep93xx/include/mach/system.h | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)
arch/arm/mach-ep93xx/include/mach/system.h +13 -5
@@ -2,7 +2,10 @@* arch/arm/mach-ep93xx/include/mach/system.h */ +#include <linux/io.h> +#include <mach/hardware.h> +#include <mach/ts72xx.h> static inline void arch_idle (void ) {
@@ -13,11 +16,16 @@ static inline void arch_reset(char mode, const char *cmd) {local_irq_disable (); -/* -* Set then clear the SWRST bit to initiate a software reset -*/ -ep93xx_devcfg_set_bits (EP93XX_SYSCON_DEVCFG_SWRST ); -ep93xx_devcfg_clear_bits (EP93XX_SYSCON_DEVCFG_SWRST ); +if (board_is_ts7200 () ||board_is_ts7250 () ||board_is_ts7260 () || +board_is_ts7300 () ||board_is_ts7400 ()) { +/* We use more reliable CPLD watchdog to perform the reset */ +__raw_writeb (0x5 ,TS72XX_WDT_FEED_PHYS_BASE ); +__raw_writeb (0x1 ,TS72XX_WDT_CONTROL_PHYS_BASE ); + }else { +/* Set then clear the SWRST bit to initiate a software reset */ +ep93xx_devcfg_set_bits (EP93XX_SYSCON_DEVCFG_SWRST ); +ep93xx_devcfg_clear_bits (EP93XX_SYSCON_DEVCFG_SWRST ); + }while (1 ) ;
Signature · 1 line
1.7.1
PATCH v2 1/5 ARM: ep93xx: use more reliable CPLD watchdog for reset on ts72xx
Quoted 11 lines · Petr ?tetiar
On all ep93xx based boards from Technologic Systems, there's CPLD watchdog available, so use this one to reset the board instead of the soft reset in CPU. I've seen some weird lockups with the soft reset on ep93xx in the past, while the reset via CPLD watchdog seems to be rock solid (tm) and works fine so far.
Cc Ryan Mallon <[email protected]>Tested-by Mika Westerberg <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>
Please submit to Russell's Patch Tracker.
Regards,
Hartley
PATCH v2 2/5 ARM: ep93xx: add model detection for ts-7300 and ts-7400 boards
In reply to Petr Štetiar--- arch/arm/mach-ep93xx/include/mach/ts72xx.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-ep93xx/include/mach/ts72xx.h +12 -0
@@ -20,6 +20,8 @@#define TS72XX_MODEL_TS7200 0x00#define TS72XX_MODEL_TS7250 0x01#define TS72XX_MODEL_TS7260 0x02 +#define TS72XX_MODEL_TS7300 0x03 +#define TS72XX_MODEL_TS7400 0x04#define TS72XX_OPTIONS_PHYS_BASE 0x22400000
@@ -66,6 +68,16 @@ static inline int board_is_ts7260(void)return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7260 ; } +static inline int board_is_ts7300 (void ) +{ +return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7300 ; +} + +static inline int board_is_ts7400 (void ) +{ +return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7400 ; +} +static inline int is_max197_installed (void ) { return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) &
Signature · 1 line
1.7.1
PATCH v2 2/5 ARM: ep93xx: add model detection for ts-7300 and ts-7400 boards
Quoted 4 lines · Petr ?tetiar
Cc Ryan Mallon <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>
Please submit to Russell's Patch Tracker.
Regards,
Hartley
PATCH v2 3/5 ARM: ep93xx: increase NR_BANKS to 16 for support of 128MB RAM
In reply to Petr ŠtetiarI've got hands on one ts-7300 board, which is equiped with 128MB RAM in two 64MB memory chips, so it's 16 banks/8MB each. Without this patch, the bootmem init code complains about small NR_BANKS number and only lower 64MB is accessible.
--- arch/arm/include/asm/setup.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/include/asm/setup.h +5 -1
@@ -192,7 +192,11 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }/* * Memory map description */ -#define NR_BANKS 8 +#ifdef CONFIG_ARCH_EP93XX +# define NR_BANKS 16 +#else +# define NR_BANKS 8 +#endif struct membank {phys_addr_t start;
Signature · 1 line
1.7.1
PATCH v2 3/5 ARM: ep93xx: increase NR_BANKS to 16 for support of 128MB RAM
Quoted 21 lines · Petr ?tetiar
I've got hands on one ts-7300 board, which is equiped with 128MB RAM in two 64MB memory chips, so it's 16 banks/8MB each. Without this patch, the bootmem init code complains about small
NR_BANKSnumber and only lower 64MB is accessible.Cc Russell King <[email protected]>Cc Hartley Sweeten <[email protected]>Cc Ryan Mallon <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>--- arch/arm/include/asm/setup.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)arch/arm/include/asm/setup.h +0
-0@@ -192,7 +192,11 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }/* * Memory map description
arch/arm/include/asm/setup.h static struct tagtable __tagtable_##fn __tag = { tag, fn } · line 202
Quoted 10 lines
arch/arm/include/asm/setup.h +5
-1*/ -#define NR_BANKS 8 +#ifdef CONFIG_ARCH_EP93XX +# define NR_BANKS 16 +#else +# define NR_BANKS 8 +#endif struct membank {phys_addr_t start;
I would like Russell's opinion on this patch before it's accepted into his Patch Tracker.
But, as far as the ep93xx support goes...
PATCH v2 3/5 ARM: ep93xx: increase NR_BANKS to 16 for support of 128MB RAM
H Hartley Sweeten <[email protected]> [2011-06-13 12:43:25]:
Quoted 36 lines · Petr ?tetiar
Quoted 21 lines
I've got hands on one ts-7300 board, which is equiped with 128MB RAM in two 64MB memory chips, so it's 16 banks/8MB each. Without this patch, the bootmem init code complains about small
NR_BANKSnumber and only lower 64MB is accessible.Cc Russell King <[email protected]>Cc Hartley Sweeten <[email protected]>Cc Ryan Mallon <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>--- arch/arm/include/asm/setup.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)arch/arm/include/asm/setup.h +0
-0@@ -192,7 +192,11 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }/* * Memory map description arch/arm/include/asm/setup.h static struct tagtable __tagtable_##fn __tag = { tag, fn } · line 202
Quoted 10 lines
arch/arm/include/asm/setup.h +5
-1*/ -#define NR_BANKS 8 +#ifdef CONFIG_ARCH_EP93XX +# define NR_BANKS 16 +#else +# define NR_BANKS 8 +#endif struct membank {phys_addr_t start;I would like Russell's opinion on this patch before it's accepted into his Patch Tracker.
Quoted 3 lines
But, as far as the ep93xx support goes...
Hello Russell,
could I kindly ask you about your opinnion on this patch? Thanks a lot.
-- ynezz
PATCH v2 3/5 ARM: ep93xx: increase NR_BANKS to 16 for support of 128MB RAM
Petr ?tetiar <[email protected]> [2011-06-17 12:32:49]:
Quoted 38 lines
H Hartley Sweeten <[email protected]> [2011-06-13 12:43:25]:
Quoted 36 lines · Petr ?tetiar
Quoted 21 lines
I've got hands on one ts-7300 board, which is equiped with 128MB RAM in two 64MB memory chips, so it's 16 banks/8MB each. Without this patch, the bootmem init code complains about small
NR_BANKSnumber and only lower 64MB is accessible.Cc Russell King <[email protected]>Cc Hartley Sweeten <[email protected]>Cc Ryan Mallon <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>--- arch/arm/include/asm/setup.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)arch/arm/include/asm/setup.h +0
-0@@ -192,7 +192,11 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }/* * Memory map description arch/arm/include/asm/setup.h static struct tagtable __tagtable_##fn __tag = { tag, fn } · line 202
Quoted 10 lines
arch/arm/include/asm/setup.h +5
-1*/ -#define NR_BANKS 8 +#ifdef CONFIG_ARCH_EP93XX +# define NR_BANKS 16 +#else +# define NR_BANKS 8 +#endif struct membank {phys_addr_t start;I would like Russell's opinion on this patch before it's accepted into his Patch Tracker.
Quoted 7 lines
Quoted 3 lines
But, as far as the ep93xx support goes...
Hello Russell,
could I kindly ask you about your opinnion on this patch? Thanks a lot.
Ping. Thanks a lot.
-- ynezz
PATCH v2 3/5 ARM: ep93xx: increase NR_BANKS to 16 for support of 128MB RAM
Quoted 42 lines · Petr ?tetiar
Petr ?tetiar <[email protected]> [2011-06-17 12:32:49]:
Quoted 40 lines
H Hartley Sweeten <[email protected]> [2011-06-13 12:43:25]:
Quoted 38 lines · Petr ?tetiar
Quoted 21 lines
I've got hands on one ts-7300 board, which is equiped with 128MB RAM in two 64MB memory chips, so it's 16 banks/8MB each. Without this patch, the bootmem init code complains about small
NR_BANKSnumber and only lower 64MB is accessible.Cc Russell King <[email protected]>Cc Hartley Sweeten <[email protected]>Cc Ryan Mallon <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>--- arch/arm/include/asm/setup.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)arch/arm/include/asm/setup.h +0
-0@@ -192,7 +192,11 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }/* * Memory map description arch/arm/include/asm/setup.h static struct tagtable __tagtable_##fn __tag = { tag, fn } · line 202
Quoted 10 lines
arch/arm/include/asm/setup.h +5
-1*/ -#define NR_BANKS 8 +#ifdef CONFIG_ARCH_EP93XX +# define NR_BANKS 16 +#else +# define NR_BANKS 8 +#endif struct membank {phys_addr_t start;I would like Russell's opinion on this patch before it's accepted into his Patch Tracker.
But, as far as the ep93xx support goes...
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Hello Russell,
could I kindly ask you about your opinnion on this patch? Thanks a lot.
Ping. Thanks a lot.
It's fine.
PATCH v2 4/5 ARM: ep93xx: fix inverted RTS/DTR signals on uart1
In reply to Petr ŠtetiarIt was discovered by Roberto Bergo, that RTS/DTR signals are inverted after the boot, because it was causing him problems with hardware controlled modem connected on ttyAM0. Todd Valentic came with this patch for the issue.
Discussion: http://tech.groups.yahoo.com/group/ts-7000/message/20259
--- arch/arm/mach-ep93xx/core.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-ep93xx/core.c +2 -2
@@ -251,9 +251,9 @@ static void ep93xx_uart_set_mctrl(struct amba_device *dev,unsigned int mcr; mcr =0 ; -if (!(mctrl &TIOCM_RTS )) +if (mctrl &TIOCM_RTS ) mcr |=2 ; -if (!(mctrl &TIOCM_DTR )) +if (mctrl &TIOCM_DTR ) mcr |=1 ;__raw_writel (mcr, base +EP93XX_UART_MCR_OFFSET );
Signature · 1 line
1.7.1
PATCH v2 4/5 ARM: ep93xx: fix inverted RTS/DTR signals on uart1
Quoted 22 lines · Petr ?tetiar
It was discovered by Roberto Bergo, that RTS/DTR signals are inverted after the boot, because it was causing him problems with hardware controlled modem connected on ttyAM0. Todd Valentic came with this patch for the issue.
Discussion: http://tech.groups.yahoo.com/group/ts-7000/message/20259
Cc Ryan Mallon <[email protected]>Cc Hartley Sweeten <[email protected]>Signed-off-by Todd Valentic <[email protected]>Tested-by Roberto Bergo <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>--- arch/arm/mach-ep93xx/core.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-ep93xx/core.c +0
-0@@ -251,9 +251,9 @@ static void ep93xx_uart_set_mctrl(struct amba_device *dev,unsigned int mcr;
arch/arm/mach-ep93xx/core.c static void ep93xx_uart_set_mctrl(struct amba_device *dev, · line 259
Quoted 10 lines
arch/arm/mach-ep93xx/core.c +2
-2mcr =0 ; -if (!(mctrl &TIOCM_RTS )) +if (mctrl &TIOCM_RTS ) mcr |=2 ; -if (!(mctrl &TIOCM_DTR )) +if (mctrl &TIOCM_DTR ) mcr |=1 ;__raw_writel (mcr, base +EP93XX_UART_MCR_OFFSET );
This looks correct.
Please add the patch to Russell's Patch Tracker.
Thanks,
Hartley
PATCH v2 5/5 ARM: ep93xx: ts72xx: fix board model detection
In reply to Petr ŠtetiarFix the obvious error in board detection logic, because according to the TS's manual, the model is stored in the least three significant bits. For example the byte read on my ts-7300 is 0x23 and the detection then fails.
--- arch/arm/mach-ep93xx/include/mach/ts72xx.h | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)
arch/arm/mach-ep93xx/include/mach/ts72xx.h +12 -6
@@ -6,7 +6,7 @@* TS72xx memory map: * * virt phys size -* febff000 22000000 4K model number register +* febff000 22000000 4K model number register (bits 0-2) * febfe000 22400000 4K options register * febfd000 22800000 4K options register #2 * febf9000 10800000 4K TS-5620 RTC index register
@@ -22,6 +22,7 @@#define TS72XX_MODEL_TS7260 0x02#define TS72XX_MODEL_TS7300 0x03#define TS72XX_MODEL_TS7400 0x04 +#define TS72XX_MODEL_MASK 0x07#define TS72XX_OPTIONS_PHYS_BASE 0x22400000
@@ -53,29 +54,34 @@#ifndef __ASSEMBLY__ +static inline int ts72xx_model (void ) +{ +return __raw_readb (TS72XX_MODEL_VIRT_BASE ) &TS72XX_MODEL_MASK ; +} +static inline int board_is_ts7200 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7200 ; +return ts72xx_model () ==TS72XX_MODEL_TS7200 ; }static inline int board_is_ts7250 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7250 ; +return ts72xx_model () ==TS72XX_MODEL_TS7250 ; }static inline int board_is_ts7260 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7260 ; +return ts72xx_model () ==TS72XX_MODEL_TS7260 ; }static inline int board_is_ts7300 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7300 ; +return ts72xx_model () ==TS72XX_MODEL_TS7300 ; }static inline int board_is_ts7400 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7400 ; +return ts72xx_model () ==TS72XX_MODEL_TS7400 ; }static inline int is_max197_installed (void )
Signature · 1 line
1.7.1
PATCH v2 5/5 ARM: ep93xx: ts72xx: fix board model detection
Quoted 63 lines · Petr ?tetiar
Fix the obvious error in board detection logic, because according to the TS's manual, the model is stored in the least three significant bits. For example the byte read on my ts-7300 is
0x23and the detection then fails.Cc Ryan Mallon <[email protected]>Cc Hartley Sweeten <[email protected]>Signed-off-by Petr ?tetiar <[email protected]>--- arch/arm/mach-ep93xx/include/mach/ts72xx.h | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-)arch/arm/mach-ep93xx/include/mach/ts72xx.h +10
-5@@ -6,7 +6,7 @@* TS72xx memory map: * * virt phys size -* febff000 22000000 4K model number register +* febff000 22000000 4K model number register (bits 0-2) * febfe000 22400000 4K options register * febfd000 22800000 4K options register #2 * febf9000 10800000 4K TS-5620 RTC index register @@ -22,6 +22,7 @@#define TS72XX_MODEL_TS7260 0x02#define TS72XX_MODEL_TS7300 0x03#define TS72XX_MODEL_TS7400 0x04 +#define TS72XX_MODEL_MASK 0x07#define TS72XX_OPTIONS_PHYS_BASE 0x22400000@@ -53,29 +54,34 @@#ifndef __ASSEMBLY__ +static inline int ts72xx_model (void ) +{ +return __raw_readb (TS72XX_MODEL_VIRT_BASE ) &TS72XX_MODEL_MASK ; +} +static inline int board_is_ts7200 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7200 ; +return ts72xx_model () ==TS72XX_MODEL_TS7200 ; }static inline int board_is_ts7250 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7250 ; +return ts72xx_model () ==TS72XX_MODEL_TS7250 ; }static inline int board_is_ts7260 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7260 ; +return ts72xx_model () ==TS72XX_MODEL_TS7260 ; }static inline int board_is_ts7300 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7300 ;
arch/arm/mach-ep93xx/include/mach/ts72xx.h line 87
Quoted 10 lines
arch/arm/mach-ep93xx/include/mach/ts72xx.h +2
-1+return ts72xx_model () ==TS72XX_MODEL_TS7300 ; }static inline int board_is_ts7400 (void ) { -return __raw_readb (TS72XX_MODEL_VIRT_BASE ) ==TS72XX_MODEL_TS7400 ; +return ts72xx_model () ==TS72XX_MODEL_TS7400 ; }static inline int is_max197_installed (void )
The "model" register on the ts boards is part of the CPLD. Since it only has the three lower data bits connected to it masking the value is correct. Otherwise the read will pickup random garbage on the upper 5 bits during the 8-bit read.
Please sumbit to Russell's Patch Tracker.
Regards,
Hartley