diff options
-rw-r--r-- | arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 3 | ||||
-rw-r--r-- | arch/mips/lantiq/xway/reset.c | 36 |
2 files changed, 39 insertions, 0 deletions
diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h index 6a2df709c576..133336b493b6 100644 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h | |||
@@ -82,6 +82,9 @@ extern __iomem void *ltq_cgu_membase; | |||
82 | #define LTQ_MPS_BASE_ADDR (KSEG1 + 0x1F107000) | 82 | #define LTQ_MPS_BASE_ADDR (KSEG1 + 0x1F107000) |
83 | #define LTQ_MPS_CHIPID ((u32 *)(LTQ_MPS_BASE_ADDR + 0x0344)) | 83 | #define LTQ_MPS_CHIPID ((u32 *)(LTQ_MPS_BASE_ADDR + 0x0344)) |
84 | 84 | ||
85 | /* allow booting xrx200 phys */ | ||
86 | int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr); | ||
87 | |||
85 | /* request a non-gpio and set the PIO config */ | 88 | /* request a non-gpio and set the PIO config */ |
86 | #define PMU_PPE BIT(13) | 89 | #define PMU_PPE BIT(13) |
87 | extern void ltq_pmu_enable(unsigned int module); | 90 | extern void ltq_pmu_enable(unsigned int module); |
diff --git a/arch/mips/lantiq/xway/reset.c b/arch/mips/lantiq/xway/reset.c index 2799212ab7db..544dbb7fb421 100644 --- a/arch/mips/lantiq/xway/reset.c +++ b/arch/mips/lantiq/xway/reset.c | |||
@@ -28,9 +28,15 @@ | |||
28 | #define RCU_RST_REQ 0x0010 | 28 | #define RCU_RST_REQ 0x0010 |
29 | /* reset status register */ | 29 | /* reset status register */ |
30 | #define RCU_RST_STAT 0x0014 | 30 | #define RCU_RST_STAT 0x0014 |
31 | /* vr9 gphy registers */ | ||
32 | #define RCU_GFS_ADD0_XRX200 0x0020 | ||
33 | #define RCU_GFS_ADD1_XRX200 0x0068 | ||
31 | 34 | ||
32 | /* reboot bit */ | 35 | /* reboot bit */ |
36 | #define RCU_RD_GPHY0_XRX200 BIT(31) | ||
33 | #define RCU_RD_SRST BIT(30) | 37 | #define RCU_RD_SRST BIT(30) |
38 | #define RCU_RD_GPHY1_XRX200 BIT(29) | ||
39 | |||
34 | /* reset cause */ | 40 | /* reset cause */ |
35 | #define RCU_STAT_SHIFT 26 | 41 | #define RCU_STAT_SHIFT 26 |
36 | /* boot selection */ | 42 | /* boot selection */ |
@@ -60,6 +66,36 @@ unsigned char ltq_boot_select(void) | |||
60 | return RCU_BOOT_SEL(val); | 66 | return RCU_BOOT_SEL(val); |
61 | } | 67 | } |
62 | 68 | ||
69 | /* reset / boot a gphy */ | ||
70 | static struct ltq_xrx200_gphy_reset { | ||
71 | u32 rd; | ||
72 | u32 addr; | ||
73 | } xrx200_gphy[] = { | ||
74 | {RCU_RD_GPHY0_XRX200, RCU_GFS_ADD0_XRX200}, | ||
75 | {RCU_RD_GPHY1_XRX200, RCU_GFS_ADD1_XRX200}, | ||
76 | }; | ||
77 | |||
78 | /* reset and boot a gphy. these phys only exist on xrx200 SoC */ | ||
79 | int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr) | ||
80 | { | ||
81 | if (!of_device_is_compatible(ltq_rcu_np, "lantiq,rcu-xrx200")) { | ||
82 | dev_err(dev, "this SoC has no GPHY\n"); | ||
83 | return -EINVAL; | ||
84 | } | ||
85 | if (id > 1) { | ||
86 | dev_err(dev, "%u is an invalid gphy id\n", id); | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | dev_info(dev, "booting GPHY%u firmware at %X\n", id, dev_addr); | ||
90 | |||
91 | ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) | xrx200_gphy[id].rd, | ||
92 | RCU_RST_REQ); | ||
93 | ltq_rcu_w32(dev_addr, xrx200_gphy[id].addr); | ||
94 | ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) & ~xrx200_gphy[id].rd, | ||
95 | RCU_RST_REQ); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
63 | /* reset a io domain for u micro seconds */ | 99 | /* reset a io domain for u micro seconds */ |
64 | void ltq_reset_once(unsigned int module, ulong u) | 100 | void ltq_reset_once(unsigned int module, ulong u) |
65 | { | 101 | { |