aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-08-29 11:08:44 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-10-29 14:08:46 -0400
commit238dd317f74250983aefbde6dc0a1f345a717993 (patch)
tree7ba6759dbb6e5b2639666fb8b6a0b02dac55a61c /arch/mips/include
parent3bc6968adc7b1926f4582a33a33ad42d9b302ce0 (diff)
MIPS: AR7: Add support for Titan (TNETV10xx) SoC variant
Add support for Titan TNETV1050,1055,1056,1060 variants. This SoC is almost completely identical to AR7 except on a few points: - a second bank of gpios is available - vlynq0 on titan is vlynq1 on ar7 - different PHY addresses for cpmac0 This SoC can be found on commercial products like the Linksys WRTP54G Original patch by Xin with improvments by Florian. Signed-off-by: Xin Zhen <xlonestar2000@aim.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/1563/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> ---
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/mach-ar7/ar7.h45
-rw-r--r--arch/mips/include/asm/mach-ar7/gpio.h3
2 files changed, 45 insertions, 3 deletions
diff --git a/arch/mips/include/asm/mach-ar7/ar7.h b/arch/mips/include/asm/mach-ar7/ar7.h
index ddb413e81d06..7919d76186bf 100644
--- a/arch/mips/include/asm/mach-ar7/ar7.h
+++ b/arch/mips/include/asm/mach-ar7/ar7.h
@@ -39,6 +39,7 @@
39#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00) 39#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
40#define AR7_REGS_USB (AR7_REGS_BASE + 0x1200) 40#define AR7_REGS_USB (AR7_REGS_BASE + 0x1200)
41#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600) 41#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
42#define AR7_REGS_PINSEL (AR7_REGS_BASE + 0x160C)
42#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800) 43#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
43#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00) 44#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
44#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00) 45#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
@@ -50,6 +51,14 @@
50#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00) 51#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00)
51#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00) 52#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00)
52 53
54/* Titan registers */
55#define TITAN_REGS_ESWITCH_BASE (0x08640000)
56#define TITAN_REGS_MAC0 (TITAN_REGS_ESWITCH_BASE)
57#define TITAN_REGS_MAC1 (TITAN_REGS_ESWITCH_BASE + 0x0800)
58#define TITAN_REGS_MDIO (TITAN_REGS_ESWITCH_BASE + 0x02000)
59#define TITAN_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1c00)
60#define TITAN_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1300)
61
53#define AR7_RESET_PERIPHERAL 0x0 62#define AR7_RESET_PERIPHERAL 0x0
54#define AR7_RESET_SOFTWARE 0x4 63#define AR7_RESET_SOFTWARE 0x4
55#define AR7_RESET_STATUS 0x8 64#define AR7_RESET_STATUS 0x8
@@ -59,15 +68,30 @@
59#define AR7_RESET_BIT_MDIO 22 68#define AR7_RESET_BIT_MDIO 22
60#define AR7_RESET_BIT_EPHY 26 69#define AR7_RESET_BIT_EPHY 26
61 70
71#define TITAN_RESET_BIT_EPHY1 28
72
62/* GPIO control registers */ 73/* GPIO control registers */
63#define AR7_GPIO_INPUT 0x0 74#define AR7_GPIO_INPUT 0x0
64#define AR7_GPIO_OUTPUT 0x4 75#define AR7_GPIO_OUTPUT 0x4
65#define AR7_GPIO_DIR 0x8 76#define AR7_GPIO_DIR 0x8
66#define AR7_GPIO_ENABLE 0xc 77#define AR7_GPIO_ENABLE 0xc
78#define TITAN_GPIO_INPUT_0 0x0
79#define TITAN_GPIO_INPUT_1 0x4
80#define TITAN_GPIO_OUTPUT_0 0x8
81#define TITAN_GPIO_OUTPUT_1 0xc
82#define TITAN_GPIO_DIR_0 0x10
83#define TITAN_GPIO_DIR_1 0x14
84#define TITAN_GPIO_ENBL_0 0x18
85#define TITAN_GPIO_ENBL_1 0x1c
67 86
68#define AR7_CHIP_7100 0x18 87#define AR7_CHIP_7100 0x18
69#define AR7_CHIP_7200 0x2b 88#define AR7_CHIP_7200 0x2b
70#define AR7_CHIP_7300 0x05 89#define AR7_CHIP_7300 0x05
90#define AR7_CHIP_TITAN 0x07
91#define TITAN_CHIP_1050 0x0f
92#define TITAN_CHIP_1055 0x0e
93#define TITAN_CHIP_1056 0x0d
94#define TITAN_CHIP_1060 0x07
71 95
72/* Interrupts */ 96/* Interrupts */
73#define AR7_IRQ_UART0 15 97#define AR7_IRQ_UART0 15
@@ -95,14 +119,29 @@ struct plat_dsl_data {
95 119
96extern int ar7_cpu_clock, ar7_bus_clock, ar7_dsp_clock; 120extern int ar7_cpu_clock, ar7_bus_clock, ar7_dsp_clock;
97 121
122static inline int ar7_is_titan(void)
123{
124 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x24)) & 0xffff) ==
125 AR7_CHIP_TITAN;
126}
127
98static inline u16 ar7_chip_id(void) 128static inline u16 ar7_chip_id(void)
99{ 129{
100 return readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x14)) & 0xffff; 130 return ar7_is_titan() ? AR7_CHIP_TITAN : (readl((void *)
131 KSEG1ADDR(AR7_REGS_GPIO + 0x14)) & 0xffff);
132}
133
134static inline u16 titan_chip_id(void)
135{
136 unsigned int val = readl((void *)KSEG1ADDR(AR7_REGS_GPIO +
137 TITAN_GPIO_INPUT_1));
138 return ((val >> 12) & 0x0f);
101} 139}
102 140
103static inline u8 ar7_chip_rev(void) 141static inline u8 ar7_chip_rev(void)
104{ 142{
105 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x14)) >> 16) & 0xff; 143 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + (ar7_is_titan() ? 0x24 :
144 0x14))) >> 16) & 0xff;
106} 145}
107 146
108struct clk { 147struct clk {
@@ -163,4 +202,6 @@ static inline void ar7_device_off(u32 bit)
163 202
164int __init ar7_gpio_init(void); 203int __init ar7_gpio_init(void);
165 204
205int __init ar7_gpio_init(void);
206
166#endif /* __AR7_H__ */ 207#endif /* __AR7_H__ */
diff --git a/arch/mips/include/asm/mach-ar7/gpio.h b/arch/mips/include/asm/mach-ar7/gpio.h
index abc317c0372e..c177cd1eed25 100644
--- a/arch/mips/include/asm/mach-ar7/gpio.h
+++ b/arch/mips/include/asm/mach-ar7/gpio.h
@@ -22,7 +22,8 @@
22#include <asm/mach-ar7/ar7.h> 22#include <asm/mach-ar7/ar7.h>
23 23
24#define AR7_GPIO_MAX 32 24#define AR7_GPIO_MAX 32
25#define NR_BUILTIN_GPIO AR7_GPIO_MAX 25#define TITAN_GPIO_MAX 51
26#define NR_BUILTIN_GPIO TITAN_GPIO_MAX
26 27
27#define gpio_to_irq(gpio) -1 28#define gpio_to_irq(gpio) -1
28 29