* [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs
@ 2015-10-28 22:37 Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards Hauke Mehrtens
` (14 more replies)
0 siblings, 15 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
This is based on lantiq GPL code and adds SoC detection, clocks and PMU
bits for some more SoCs and also adds the PMU bits for more devices.
This was tested on a VRX288 and a GRX300.
This is targeted at kernel 4.5.
Hauke Mehrtens (15):
MIPS: lantiq: add locking for PMU register and check status afterwards
MIPS: lantiq: add support for setting PMU register on AR10 and GRX390
MIPS: lantiq: rename CGU_SYS_VR9 register
MIPS: lantiq: fix pp32 clock on vr9
MIPS: lantiq: add clock detection for grx390 and ar10
MIPS: lantiq: deactivate most of the devices by default
MIPS: lantiq: add PMU bits for USB and SDIO devices
MIPS: lantiq: add pmu bits for ar10 and grx390
MIPS: lantiq: add support for gphy firmware loading for ar10 and
grx390
MIPS: lantiq: add SoC detection for ar10 and grx390
MIPS: lantiq: add clock for mei driver
MIPS: lantiq: add 1e103100.deu clock
MIPS: lantiq: add misc clocks
MIPS: lantiq: add support for xRX220 SoC
MIPS: lantiq: fix check for return value of request_mem_region()
.../mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 14 ++
arch/mips/lantiq/clk.h | 13 ++
arch/mips/lantiq/irq.c | 8 +-
arch/mips/lantiq/xway/clk.c | 174 +++++++++++++-
arch/mips/lantiq/xway/prom.c | 34 ++-
arch/mips/lantiq/xway/reset.c | 113 +++++++--
arch/mips/lantiq/xway/sysctrl.c | 256 +++++++++++++++++----
7 files changed, 538 insertions(+), 74 deletions(-)
--
2.6.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-29 11:19 ` Sergei Shtylyov
2015-10-29 19:15 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 02/15] MIPS: lantiq: add support for setting PMU register on AR10 and GRX390 Hauke Mehrtens
` (13 subsequent siblings)
14 siblings, 2 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
The PMU register are accesses in a non atomic way and they could be
accesses by different threads simultaneously, which could cause
problems this patch adds locking around the PMU registers. In
addition it is now also waited till the PMU is actually deactivated.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 2b15491..9965731 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -85,15 +85,19 @@ void __iomem *ltq_ebu_membase;
static u32 ifccr = CGU_IFCCR;
static u32 pcicr = CGU_PCICR;
+static DEFINE_SPINLOCK(g_pmu_lock);
+
/* legacy function kept alive to ease clkdev transition */
void ltq_pmu_enable(unsigned int module)
{
- int err = 1000000;
+ int retry = 1000000;
+ spin_lock(&g_pmu_lock);
pmu_w32(pmu_r32(PMU_PWDCR) & ~module, PMU_PWDCR);
- do {} while (--err && (pmu_r32(PMU_PWDSR) & module));
+ do {} while (--retry && (pmu_r32(PMU_PWDSR) & module));
+ spin_unlock(&g_pmu_lock);
- if (!err)
+ if (!retry)
panic("activating PMU module failed!");
}
EXPORT_SYMBOL(ltq_pmu_enable);
@@ -101,7 +105,15 @@ EXPORT_SYMBOL(ltq_pmu_enable);
/* legacy function kept alive to ease clkdev transition */
void ltq_pmu_disable(unsigned int module)
{
+ int retry = 1000000;
+
+ spin_lock(&g_pmu_lock);
pmu_w32(pmu_r32(PMU_PWDCR) | module, PMU_PWDCR);
+ do {} while (--retry && (!(pmu_r32(PMU_PWDSR) & module)));
+ spin_unlock(&g_pmu_lock);
+
+ if (!retry)
+ pr_warn("deactivating PMU module failed!");
}
EXPORT_SYMBOL(ltq_pmu_disable);
@@ -123,9 +135,11 @@ static int pmu_enable(struct clk *clk)
{
int retry = 1000000;
+ spin_lock(&g_pmu_lock);
pmu_w32(pmu_r32(PWDCR(clk->module)) & ~clk->bits,
PWDCR(clk->module));
do {} while (--retry && (pmu_r32(PWDSR(clk->module)) & clk->bits));
+ spin_unlock(&g_pmu_lock);
if (!retry)
panic("activating PMU module failed!");
@@ -136,8 +150,15 @@ static int pmu_enable(struct clk *clk)
/* disable a clock gate */
static void pmu_disable(struct clk *clk)
{
- pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits,
- PWDCR(clk->module));
+ int retry = 1000000;
+
+ spin_lock(&g_pmu_lock);
+ pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits, PWDCR(clk->module));
+ do {} while (--retry && (!(pmu_r32(PWDSR(clk->module)) & clk->bits)));
+ spin_unlock(&g_pmu_lock);
+
+ if (!retry)
+ pr_warn("deactivating PMU module failed!");
}
/* the pci enable helper */
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 02/15] MIPS: lantiq: add support for setting PMU register on AR10 and GRX390
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 03/15] MIPS: lantiq: rename CGU_SYS_VR9 register Hauke Mehrtens
` (12 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
This adds support for setting the PMU register on the AR10 and GRX390.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 84 +++++++++++++++++++++++++++++++++++------
1 file changed, 73 insertions(+), 11 deletions(-)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 9965731..71b6c1e 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -9,6 +9,7 @@
#include <linux/ioport.h>
#include <linux/export.h>
#include <linux/clkdev.h>
+#include <linux/spinlock.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
@@ -18,16 +19,18 @@
#include "../clk.h"
#include "../prom.h"
-/* clock control register */
+/* clock control register for legacy */
#define CGU_IFCCR 0x0018
#define CGU_IFCCR_VR9 0x0024
-/* system clock register */
+/* system clock register for legacy */
#define CGU_SYS 0x0010
/* pci control register */
#define CGU_PCICR 0x0034
#define CGU_PCICR_VR9 0x0038
/* ephy configuration register */
#define CGU_EPHY 0x10
+
+/* Legacy PMU register for ar9, ase, danube */
/* power control register */
#define PMU_PWDCR 0x1C
/* power status register */
@@ -41,6 +44,47 @@
/* power status register */
#define PWDSR(x) ((x) ? (PMU_PWDSR1) : (PMU_PWDSR))
+
+/* PMU register for ar10 and grx390 */
+
+/* First register set */
+#define PMU_CLK_SR 0x20 /* status */
+#define PMU_CLK_CR_A 0x24 /* Enable */
+#define PMU_CLK_CR_B 0x28 /* Disable */
+/* Second register set */
+#define PMU_CLK_SR1 0x30 /* status */
+#define PMU_CLK_CR1_A 0x34 /* Enable */
+#define PMU_CLK_CR1_B 0x38 /* Disable */
+/* Third register set */
+#define PMU_ANA_SR 0x40 /* status */
+#define PMU_ANA_CR_A 0x44 /* Enable */
+#define PMU_ANA_CR_B 0x48 /* Disable */
+
+/* Status */
+static u32 pmu_clk_sr[] = {
+ PMU_CLK_SR,
+ PMU_CLK_SR1,
+ PMU_ANA_SR,
+};
+
+/* Enable */
+static u32 pmu_clk_cr_a[] = {
+ PMU_CLK_CR_A,
+ PMU_CLK_CR1_A,
+ PMU_ANA_CR_A,
+};
+
+/* Disable */
+static u32 pmu_clk_cr_b[] = {
+ PMU_CLK_CR_B,
+ PMU_CLK_CR1_B,
+ PMU_ANA_CR_B,
+};
+
+#define PWDCR_EN_XRX(x) (pmu_clk_cr_a[(x)])
+#define PWDCR_DIS_XRX(x) (pmu_clk_cr_b[(x)])
+#define PWDSR_XRX(x) (pmu_clk_sr[(x)])
+
/* clock gates that we can en/disable */
#define PMU_USB0_P BIT(0)
#define PMU_PCI BIT(4)
@@ -135,11 +179,20 @@ static int pmu_enable(struct clk *clk)
{
int retry = 1000000;
- spin_lock(&g_pmu_lock);
- pmu_w32(pmu_r32(PWDCR(clk->module)) & ~clk->bits,
- PWDCR(clk->module));
- do {} while (--retry && (pmu_r32(PWDSR(clk->module)) & clk->bits));
- spin_unlock(&g_pmu_lock);
+ if (of_machine_is_compatible("lantiq,ar10")
+ || of_machine_is_compatible("lantiq,grx390")) {
+ pmu_w32(clk->bits, PWDCR_EN_XRX(clk->module));
+ do {} while (--retry &&
+ (!(pmu_r32(PWDSR_XRX(clk->module)) & clk->bits)));
+
+ } else {
+ spin_lock(&g_pmu_lock);
+ pmu_w32(pmu_r32(PWDCR(clk->module)) & ~clk->bits,
+ PWDCR(clk->module));
+ do {} while (--retry &&
+ (pmu_r32(PWDSR(clk->module)) & clk->bits));
+ spin_unlock(&g_pmu_lock);
+ }
if (!retry)
panic("activating PMU module failed!");
@@ -152,10 +205,19 @@ static void pmu_disable(struct clk *clk)
{
int retry = 1000000;
- spin_lock(&g_pmu_lock);
- pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits, PWDCR(clk->module));
- do {} while (--retry && (!(pmu_r32(PWDSR(clk->module)) & clk->bits)));
- spin_unlock(&g_pmu_lock);
+ if (of_machine_is_compatible("lantiq,ar10")
+ || of_machine_is_compatible("lantiq,grx390")) {
+ pmu_w32(clk->bits, PWDCR_DIS_XRX(clk->module));
+ do {} while (--retry &&
+ (pmu_r32(PWDSR_XRX(clk->module)) & clk->bits));
+ } else {
+ spin_lock(&g_pmu_lock);
+ pmu_w32(pmu_r32(PWDCR(clk->module)) | clk->bits,
+ PWDCR(clk->module));
+ do {} while (--retry &&
+ (!(pmu_r32(PWDSR(clk->module)) & clk->bits)));
+ spin_unlock(&g_pmu_lock);
+ }
if (!retry)
pr_warn("deactivating PMU module failed!");
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 03/15] MIPS: lantiq: rename CGU_SYS_VR9 register
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 02/15] MIPS: lantiq: add support for setting PMU register on AR10 and GRX390 Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-29 19:15 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 04/15] MIPS: lantiq: fix pp32 clock on vr9 Hauke Mehrtens
` (11 subsequent siblings)
14 siblings, 1 reply; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
This register is also used on other SoCs.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/clk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/mips/lantiq/xway/clk.c b/arch/mips/lantiq/xway/clk.c
index 8750dc0..e9e0d1f 100644
--- a/arch/mips/lantiq/xway/clk.c
+++ b/arch/mips/lantiq/xway/clk.c
@@ -25,8 +25,8 @@ static unsigned int ram_clocks[] = {
/* legacy xway clock */
#define CGU_SYS 0x10
-/* vr9 clock */
-#define CGU_SYS_VR9 0x0c
+/* vr9, ar10/grx390 clock */
+#define CGU_SYS_XRX 0x0c
#define CGU_IF_CLK_VR9 0x24
unsigned long ltq_danube_fpi_hz(void)
@@ -104,7 +104,7 @@ unsigned long ltq_vr9_cpu_hz(void)
unsigned int cpu_sel;
unsigned long clk;
- cpu_sel = (ltq_cgu_r32(CGU_SYS_VR9) >> 4) & 0xf;
+ cpu_sel = (ltq_cgu_r32(CGU_SYS_XRX) >> 4) & 0xf;
switch (cpu_sel) {
case 0:
@@ -145,7 +145,7 @@ unsigned long ltq_vr9_fpi_hz(void)
unsigned long clk;
cpu_clk = ltq_vr9_cpu_hz();
- ocp_sel = ltq_cgu_r32(CGU_SYS_VR9) & 0x3;
+ ocp_sel = ltq_cgu_r32(CGU_SYS_XRX) & 0x3;
switch (ocp_sel) {
case 0:
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 04/15] MIPS: lantiq: fix pp32 clock on vr9
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (2 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 03/15] MIPS: lantiq: rename CGU_SYS_VR9 register Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 05/15] MIPS: lantiq: add clock detection for grx390 and ar10 Hauke Mehrtens
` (10 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
The vendor code uses different clock values for this clock.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/clk.h | 2 ++
arch/mips/lantiq/xway/clk.c | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/mips/lantiq/clk.h b/arch/mips/lantiq/clk.h
index 77e4bdb..101afcb 100644
--- a/arch/mips/lantiq/clk.h
+++ b/arch/mips/lantiq/clk.h
@@ -31,10 +31,12 @@
#define CLOCK_240M 240000000
#define CLOCK_250M 250000000
#define CLOCK_266M 266666666
+#define CLOCK_288M 288888888
#define CLOCK_300M 300000000
#define CLOCK_333M 333333333
#define CLOCK_393M 393215332
#define CLOCK_400M 400000000
+#define CLOCK_432M 432000000
#define CLOCK_450M 450000000
#define CLOCK_500M 500000000
#define CLOCK_600M 600000000
diff --git a/arch/mips/lantiq/xway/clk.c b/arch/mips/lantiq/xway/clk.c
index e9e0d1f..ba58ec8 100644
--- a/arch/mips/lantiq/xway/clk.c
+++ b/arch/mips/lantiq/xway/clk.c
@@ -174,15 +174,18 @@ unsigned long ltq_vr9_fpi_hz(void)
unsigned long ltq_vr9_pp32_hz(void)
{
- unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 16) & 3;
+ unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 16) & 0x7;
unsigned long clk;
switch (clksys) {
+ case 0:
+ clk = CLOCK_500M;
+ break;
case 1:
- clk = CLOCK_450M;
+ clk = CLOCK_432M;
break;
case 2:
- clk = CLOCK_300M;
+ clk = CLOCK_288M;
break;
default:
clk = CLOCK_500M;
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 05/15] MIPS: lantiq: add clock detection for grx390 and ar10
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (3 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 04/15] MIPS: lantiq: fix pp32 clock on vr9 Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 06/15] MIPS: lantiq: deactivate most of the devices by default Hauke Mehrtens
` (9 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
This add detection of some clocks on the ar10 and grx390.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/clk.h | 11 ++++
arch/mips/lantiq/xway/clk.c | 157 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 167 insertions(+), 1 deletion(-)
diff --git a/arch/mips/lantiq/clk.h b/arch/mips/lantiq/clk.h
index 101afcb..7376ce8 100644
--- a/arch/mips/lantiq/clk.h
+++ b/arch/mips/lantiq/clk.h
@@ -34,12 +34,15 @@
#define CLOCK_288M 288888888
#define CLOCK_300M 300000000
#define CLOCK_333M 333333333
+#define CLOCK_360M 360000000
#define CLOCK_393M 393215332
#define CLOCK_400M 400000000
#define CLOCK_432M 432000000
#define CLOCK_450M 450000000
#define CLOCK_500M 500000000
#define CLOCK_600M 600000000
+#define CLOCK_666M 666666666
+#define CLOCK_720M 720000000
/* clock out speeds */
#define CLOCK_32_768K 32768
@@ -82,4 +85,12 @@ extern unsigned long ltq_vr9_cpu_hz(void);
extern unsigned long ltq_vr9_fpi_hz(void);
extern unsigned long ltq_vr9_pp32_hz(void);
+extern unsigned long ltq_ar10_cpu_hz(void);
+extern unsigned long ltq_ar10_fpi_hz(void);
+extern unsigned long ltq_ar10_pp32_hz(void);
+
+extern unsigned long ltq_grx390_cpu_hz(void);
+extern unsigned long ltq_grx390_fpi_hz(void);
+extern unsigned long ltq_grx390_pp32_hz(void);
+
#endif
diff --git a/arch/mips/lantiq/xway/clk.c b/arch/mips/lantiq/xway/clk.c
index ba58ec8..619bff7 100644
--- a/arch/mips/lantiq/xway/clk.c
+++ b/arch/mips/lantiq/xway/clk.c
@@ -27,7 +27,7 @@ static unsigned int ram_clocks[] = {
/* vr9, ar10/grx390 clock */
#define CGU_SYS_XRX 0x0c
-#define CGU_IF_CLK_VR9 0x24
+#define CGU_IF_CLK_AR10 0x24
unsigned long ltq_danube_fpi_hz(void)
{
@@ -194,3 +194,158 @@ unsigned long ltq_vr9_pp32_hz(void)
return clk;
}
+
+unsigned long ltq_ar10_cpu_hz(void)
+{
+ unsigned int clksys;
+ int cpu_fs = (ltq_cgu_r32(CGU_SYS_XRX) >> 8) & 0x1;
+ int freq_div = (ltq_cgu_r32(CGU_SYS_XRX) >> 4) & 0x7;
+
+ switch (cpu_fs) {
+ case 0:
+ clksys = CLOCK_500M;
+ break;
+ case 1:
+ clksys = CLOCK_600M;
+ break;
+ default:
+ clksys = CLOCK_500M;
+ break;
+ }
+
+ switch (freq_div) {
+ case 0:
+ return clksys;
+ case 1:
+ return clksys >> 1;
+ case 2:
+ return clksys >> 2;
+ default:
+ return clksys;
+ }
+}
+
+unsigned long ltq_ar10_fpi_hz(void)
+{
+ int freq_fpi = (ltq_cgu_r32(CGU_IF_CLK_AR10) >> 25) & 0xf;
+
+ switch (freq_fpi) {
+ case 1:
+ return CLOCK_300M;
+ case 5:
+ return CLOCK_250M;
+ case 2:
+ return CLOCK_150M;
+ case 6:
+ return CLOCK_125M;
+
+ default:
+ return CLOCK_125M;
+ }
+}
+
+unsigned long ltq_ar10_pp32_hz(void)
+{
+ unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 16) & 0x7;
+ unsigned long clk;
+
+ switch (clksys) {
+ case 1:
+ clk = CLOCK_250M;
+ break;
+ case 4:
+ clk = CLOCK_400M;
+ break;
+ default:
+ clk = CLOCK_250M;
+ break;
+ }
+
+ return clk;
+}
+
+unsigned long ltq_grx390_cpu_hz(void)
+{
+ unsigned int clksys;
+ int cpu_fs = ((ltq_cgu_r32(CGU_SYS_XRX) >> 9) & 0x3);
+ int freq_div = ((ltq_cgu_r32(CGU_SYS_XRX) >> 4) & 0x7);
+
+ switch (cpu_fs) {
+ case 0:
+ clksys = CLOCK_600M;
+ break;
+ case 1:
+ clksys = CLOCK_666M;
+ break;
+ case 2:
+ clksys = CLOCK_720M;
+ break;
+ default:
+ clksys = CLOCK_600M;
+ break;
+ }
+
+ switch (freq_div) {
+ case 0:
+ return clksys;
+ case 1:
+ return clksys >> 1;
+ case 2:
+ return clksys >> 2;
+ default:
+ return clksys;
+ }
+}
+
+unsigned long ltq_grx390_fpi_hz(void)
+{
+ /* fpi clock is derived from ddr_clk */
+ unsigned int clksys;
+ int cpu_fs = ((ltq_cgu_r32(CGU_SYS_XRX) >> 9) & 0x3);
+ int freq_div = ((ltq_cgu_r32(CGU_SYS_XRX)) & 0x7);
+ switch (cpu_fs) {
+ case 0:
+ clksys = CLOCK_600M;
+ break;
+ case 1:
+ clksys = CLOCK_666M;
+ break;
+ case 2:
+ clksys = CLOCK_720M;
+ break;
+ default:
+ clksys = CLOCK_600M;
+ break;
+ }
+
+ switch (freq_div) {
+ case 1:
+ return clksys >> 1;
+ case 2:
+ return clksys >> 2;
+ default:
+ return clksys >> 1;
+ }
+}
+
+unsigned long ltq_grx390_pp32_hz(void)
+{
+ unsigned int clksys = (ltq_cgu_r32(CGU_SYS) >> 16) & 0x7;
+ unsigned long clk;
+
+ switch (clksys) {
+ case 1:
+ clk = CLOCK_250M;
+ break;
+ case 2:
+ clk = CLOCK_432M;
+ break;
+ case 4:
+ clk = CLOCK_400M;
+ break;
+ default:
+ clk = CLOCK_250M;
+ break;
+ }
+ return clk;
+}
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 06/15] MIPS: lantiq: deactivate most of the devices by default
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (4 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 05/15] MIPS: lantiq: add clock detection for grx390 and ar10 Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-29 6:18 ` John Crispin
2015-10-28 22:37 ` [PATCH 07/15] MIPS: lantiq: add PMU bits for USB and SDIO devices Hauke Mehrtens
` (8 subsequent siblings)
14 siblings, 1 reply; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
When the SoC starts up most of the devices should be deactivated by the
PMU, they should be activated when they get used by their drivers. Some
devices should not get deactivate at startup like the serial, register
them in a special way.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 46 ++++++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 21 deletions(-)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 71b6c1e..01a4544 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -285,8 +285,8 @@ static int clkout_enable(struct clk *clk)
}
/* manage the clock gates via PMU */
-static void clkdev_add_pmu(const char *dev, const char *con,
- unsigned int module, unsigned int bits)
+static void clkdev_add_pmu(const char *dev, const char *con, bool deactivate,
+ unsigned int module, unsigned int bits)
{
struct clk *clk = kzalloc(sizeof(struct clk), GFP_KERNEL);
@@ -297,6 +297,10 @@ static void clkdev_add_pmu(const char *dev, const char *con,
clk->disable = pmu_disable;
clk->module = module;
clk->bits = bits;
+ if (deactivate) {
+ /* Disable it during the initialitin. Module should enable when used */
+ pmu_disable(clk);
+ }
clkdev_add(&clk->cl);
}
@@ -415,13 +419,13 @@ void __init ltq_soc_init(void)
ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_BUSCON0) & ~EBU_WRDIS, LTQ_EBU_BUSCON0);
/* add our generic xway clocks */
- clkdev_add_pmu("10000000.fpi", NULL, 0, PMU_FPI);
- clkdev_add_pmu("1e100400.serial", NULL, 0, PMU_ASC0);
- clkdev_add_pmu("1e100a00.gptu", NULL, 0, PMU_GPT);
- clkdev_add_pmu("1e100bb0.stp", NULL, 0, PMU_STP);
- clkdev_add_pmu("1e104100.dma", NULL, 0, PMU_DMA);
- clkdev_add_pmu("1e100800.spi", NULL, 0, PMU_SPI);
- clkdev_add_pmu("1e105300.ebu", NULL, 0, PMU_EBU);
+ clkdev_add_pmu("10000000.fpi", NULL, 0, 0, PMU_FPI);
+ clkdev_add_pmu("1e100400.serial", NULL, 0, 0, PMU_ASC0);
+ clkdev_add_pmu("1e100a00.gptu", NULL, 1, 0, PMU_GPT);
+ clkdev_add_pmu("1e100bb0.stp", NULL, 1, 0, PMU_STP);
+ clkdev_add_pmu("1e104100.dma", NULL, 1, 0, PMU_DMA);
+ clkdev_add_pmu("1e100800.spi", NULL, 1, 0, PMU_SPI);
+ clkdev_add_pmu("1e105300.ebu", NULL, 0, 0, PMU_EBU);
clkdev_add_clkout();
/* add the soc dependent clocks */
@@ -429,11 +433,11 @@ void __init ltq_soc_init(void)
ifccr = CGU_IFCCR_VR9;
pcicr = CGU_PCICR_VR9;
} else {
- clkdev_add_pmu("1e180000.etop", NULL, 0, PMU_PPE);
+ clkdev_add_pmu("1e180000.etop", NULL, 1, 0, PMU_PPE);
}
if (!of_machine_is_compatible("lantiq,ase")) {
- clkdev_add_pmu("1e100c00.serial", NULL, 0, PMU_ASC1);
+ clkdev_add_pmu("1e100c00.serial", NULL, 0, 0, PMU_ASC1);
clkdev_add_pci();
}
@@ -445,25 +449,25 @@ void __init ltq_soc_init(void)
clkdev_add_static(CLOCK_133M, CLOCK_133M,
CLOCK_133M, CLOCK_133M);
clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY),
- clkdev_add_pmu("1e180000.etop", "ephy", 0, PMU_EPHY);
+ clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY);
} else if (of_machine_is_compatible("lantiq,vr9")) {
clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),
ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz());
- clkdev_add_pmu("1d900000.pcie", "phy", 1, PMU1_PCIE_PHY);
- clkdev_add_pmu("1d900000.pcie", "bus", 0, PMU_PCIE_CLK);
- clkdev_add_pmu("1d900000.pcie", "msi", 1, PMU1_PCIE_MSI);
- clkdev_add_pmu("1d900000.pcie", "pdi", 1, PMU1_PCIE_PDI);
- clkdev_add_pmu("1d900000.pcie", "ctl", 1, PMU1_PCIE_CTL);
- clkdev_add_pmu("1d900000.pcie", "ahb", 0, PMU_AHBM | PMU_AHBS);
- clkdev_add_pmu("1e108000.eth", NULL, 0,
+ clkdev_add_pmu("1d900000.pcie", "phy", 1, 1, PMU1_PCIE_PHY);
+ clkdev_add_pmu("1d900000.pcie", "bus", 1, 0, PMU_PCIE_CLK);
+ clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
+ clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
+ clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
+ clkdev_add_pmu("1d900000.pcie", "ahb", 1, 0, PMU_AHBM | PMU_AHBS);
+ clkdev_add_pmu("1e108000.eth", NULL, 1, 0,
PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM |
PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 |
PMU_PPE_QSB | PMU_PPE_TOP);
- clkdev_add_pmu("1f203000.rcu", "gphy", 0, PMU_GPHY);
+ clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
} else if (of_machine_is_compatible("lantiq,ar9")) {
clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),
ltq_ar9_fpi_hz(), CLOCK_250M);
- clkdev_add_pmu("1e180000.etop", "switch", 0, PMU_SWITCH);
+ clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
} else {
clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
ltq_danube_fpi_hz(), ltq_danube_pp32_hz());
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 07/15] MIPS: lantiq: add PMU bits for USB and SDIO devices
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (5 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 06/15] MIPS: lantiq: deactivate most of the devices by default Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 08/15] MIPS: lantiq: add pmu bits for ar10 and grx390 Hauke Mehrtens
` (7 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
This adds the PUM bits for USB and SDIO devices
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 01a4544..6942fef 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -87,11 +87,13 @@ static u32 pmu_clk_cr_b[] = {
/* clock gates that we can en/disable */
#define PMU_USB0_P BIT(0)
+#define PMU_ASE_SDIO BIT(2) /* ASE special */
#define PMU_PCI BIT(4)
#define PMU_DMA BIT(5)
#define PMU_USB0 BIT(6)
#define PMU_ASC0 BIT(7)
#define PMU_EPHY BIT(7) /* ase */
+#define PMU_USIF BIT(7) /* from vr9 until grx390 */
#define PMU_SPI BIT(8)
#define PMU_DFE BIT(9)
#define PMU_EBU BIT(10)
@@ -100,6 +102,7 @@ static u32 pmu_clk_cr_b[] = {
#define PMU_AHBS BIT(13) /* vr9 */
#define PMU_FPI BIT(14)
#define PMU_AHBM BIT(15)
+#define PMU_SDIO BIT(16) /* danube, ar9, vr9 */
#define PMU_ASC1 BIT(17)
#define PMU_PPE_QSB BIT(18)
#define PMU_PPE_SLL01 BIT(19)
@@ -448,28 +451,47 @@ void __init ltq_soc_init(void)
else
clkdev_add_static(CLOCK_133M, CLOCK_133M,
CLOCK_133M, CLOCK_133M);
- clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY),
+ clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
+ clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
+ clkdev_add_pmu("1e180000.etop", "ppe", 1, 0, PMU_PPE);
+ clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY);
clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY);
+ clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_ASE_SDIO);
} else if (of_machine_is_compatible("lantiq,vr9")) {
clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),
ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz());
+ clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
+ clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0 | PMU_AHBM);
+ clkdev_add_pmu("1e106000.usb", "phy", 1, 0, PMU_USB1_P);
+ clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1 | PMU_AHBM);
clkdev_add_pmu("1d900000.pcie", "phy", 1, 1, PMU1_PCIE_PHY);
clkdev_add_pmu("1d900000.pcie", "bus", 1, 0, PMU_PCIE_CLK);
clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
clkdev_add_pmu("1d900000.pcie", "ahb", 1, 0, PMU_AHBM | PMU_AHBS);
+
+ clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
clkdev_add_pmu("1e108000.eth", NULL, 1, 0,
PMU_SWITCH | PMU_PPE_DPLUS | PMU_PPE_DPLUM |
PMU_PPE_EMA | PMU_PPE_TC | PMU_PPE_SLL01 |
PMU_PPE_QSB | PMU_PPE_TOP);
clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
+ clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
} else if (of_machine_is_compatible("lantiq,ar9")) {
clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),
ltq_ar9_fpi_hz(), CLOCK_250M);
+ clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
+ clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
+ clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1);
+ clkdev_add_pmu("1e106000.usb", "phy", 1, 0, PMU_USB1_P);
clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
+ clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
} else {
clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
ltq_danube_fpi_hz(), ltq_danube_pp32_hz());
+ clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
+ clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
+ clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
}
}
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 08/15] MIPS: lantiq: add pmu bits for ar10 and grx390
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (6 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 07/15] MIPS: lantiq: add PMU bits for USB and SDIO devices Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 09/15] MIPS: lantiq: add support for gphy firmware loading " Hauke Mehrtens
` (6 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 57 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 6942fef..55e694e 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -109,6 +109,7 @@ static u32 pmu_clk_cr_b[] = {
#define PMU_PPE_TC BIT(21)
#define PMU_PPE_EMA BIT(22)
#define PMU_PPE_DPLUM BIT(23)
+#define PMU_PPE_DP BIT(23)
#define PMU_PPE_DPLUS BIT(24)
#define PMU_USB1_P BIT(26)
#define PMU_USB1 BIT(27)
@@ -117,10 +118,27 @@ static u32 pmu_clk_cr_b[] = {
#define PMU_GPHY BIT(30)
#define PMU_PCIE_CLK BIT(31)
-#define PMU1_PCIE_PHY BIT(0)
+#define PMU1_PCIE_PHY BIT(0) /* vr9-specific,moved in ar10/grx390 */
#define PMU1_PCIE_CTL BIT(1)
#define PMU1_PCIE_PDI BIT(4)
#define PMU1_PCIE_MSI BIT(5)
+#define PMU1_CKE BIT(6)
+#define PMU1_PCIE1_CTL BIT(17)
+#define PMU1_PCIE1_PDI BIT(20)
+#define PMU1_PCIE1_MSI BIT(21)
+#define PMU1_PCIE2_CTL BIT(25)
+#define PMU1_PCIE2_PDI BIT(26)
+#define PMU1_PCIE2_MSI BIT(27)
+
+#define PMU_ANALOG_USB0_P BIT(0)
+#define PMU_ANALOG_USB1_P BIT(1)
+#define PMU_ANALOG_PCIE0_P BIT(8)
+#define PMU_ANALOG_PCIE1_P BIT(9)
+#define PMU_ANALOG_PCIE2_P BIT(10)
+#define PMU_ANALOG_DSL_AFE BIT(16)
+#define PMU_ANALOG_DCDC_2V5 BIT(17)
+#define PMU_ANALOG_DCDC_1VX BIT(18)
+#define PMU_ANALOG_DCDC_1V0 BIT(19)
#define pmu_w32(x, y) ltq_w32((x), pmu_membase + (y))
#define pmu_r32(x) ltq_r32(pmu_membase + (x))
@@ -444,6 +462,22 @@ void __init ltq_soc_init(void)
clkdev_add_pci();
}
+ if (of_machine_is_compatible("lantiq,grx390") ||
+ of_machine_is_compatible("lantiq,ar10")) {
+ clkdev_add_pmu("1e101000.usb", "phy", 1, 2, PMU_ANALOG_USB0_P);
+ clkdev_add_pmu("1e106000.usb", "phy", 1, 2, PMU_ANALOG_USB1_P);
+ /* rc 0 */
+ clkdev_add_pmu("1d900000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE0_P);
+ clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
+ clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
+ clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
+ /* rc 1 */
+ clkdev_add_pmu("19000000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE1_P);
+ clkdev_add_pmu("19000000.pcie", "msi", 1, 1, PMU1_PCIE1_MSI);
+ clkdev_add_pmu("19000000.pcie", "pdi", 1, 1, PMU1_PCIE1_PDI);
+ clkdev_add_pmu("19000000.pcie", "ctl", 1, 1, PMU1_PCIE1_CTL);
+ }
+
if (of_machine_is_compatible("lantiq,ase")) {
if (ltq_cgu_r32(CGU_SYS) & (1 << 5))
clkdev_add_static(CLOCK_266M, CLOCK_133M,
@@ -457,6 +491,27 @@ void __init ltq_soc_init(void)
clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY);
clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_ASE_SDIO);
+ } else if (of_machine_is_compatible("lantiq,grx390")) {
+ clkdev_add_static(ltq_grx390_cpu_hz(), ltq_grx390_fpi_hz(),
+ ltq_grx390_fpi_hz(), ltq_grx390_pp32_hz());
+ clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
+ clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1);
+ /* rc 2 */
+ clkdev_add_pmu("1a800000.pcie", "phy", 1, 2, PMU_ANALOG_PCIE2_P);
+ clkdev_add_pmu("1a800000.pcie", "msi", 1, 1, PMU1_PCIE2_MSI);
+ clkdev_add_pmu("1a800000.pcie", "pdi", 1, 1, PMU1_PCIE2_PDI);
+ clkdev_add_pmu("1a800000.pcie", "ctl", 1, 1, PMU1_PCIE2_CTL);
+ clkdev_add_pmu("1e108000.eth", NULL, 1, 0, PMU_SWITCH | PMU_PPE_DP);
+ clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
+ } else if (of_machine_is_compatible("lantiq,ar10")) {
+ clkdev_add_static(ltq_ar10_cpu_hz(), ltq_ar10_fpi_hz(),
+ ltq_ar10_fpi_hz(), ltq_ar10_pp32_hz());
+ clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
+ clkdev_add_pmu("1e106000.usb", "ctl", 1, 0, PMU_USB1);
+ clkdev_add_pmu("1e108000.eth", NULL, 1, 0, PMU_SWITCH |
+ PMU_PPE_DP | PMU_PPE_TC);
+ clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
+ clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
} else if (of_machine_is_compatible("lantiq,vr9")) {
clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),
ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz());
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 09/15] MIPS: lantiq: add support for gphy firmware loading for ar10 and grx390
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (7 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 08/15] MIPS: lantiq: add pmu bits for ar10 and grx390 Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-29 19:16 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 10/15] MIPS: lantiq: add SoC detection " Hauke Mehrtens
` (5 subsequent siblings)
14 siblings, 1 reply; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/reset.c | 111 ++++++++++++++++++++++++++++++++++--------
1 file changed, 91 insertions(+), 20 deletions(-)
diff --git a/arch/mips/lantiq/xway/reset.c b/arch/mips/lantiq/xway/reset.c
index fe68f9a..1e23cee 100644
--- a/arch/mips/lantiq/xway/reset.c
+++ b/arch/mips/lantiq/xway/reset.c
@@ -22,9 +22,6 @@
#include "../prom.h"
-#define ltq_rcu_w32(x, y) ltq_w32((x), ltq_rcu_membase + (y))
-#define ltq_rcu_r32(x) ltq_r32(ltq_rcu_membase + (x))
-
/* reset request register */
#define RCU_RST_REQ 0x0010
/* reset status register */
@@ -32,11 +29,29 @@
/* vr9 gphy registers */
#define RCU_GFS_ADD0_XRX200 0x0020
#define RCU_GFS_ADD1_XRX200 0x0068
+/* xRX300 gphy registers */
+#define RCU_GFS_ADD0_XRX300 0x0020
+#define RCU_GFS_ADD1_XRX300 0x0058
+#define RCU_GFS_ADD2_XRX300 0x00AC
+/* xRX330 gphy registers */
+#define RCU_GFS_ADD0_XRX330 0x0020
+#define RCU_GFS_ADD1_XRX330 0x0058
+#define RCU_GFS_ADD2_XRX330 0x00AC
+#define RCU_GFS_ADD3_XRX330 0x0264
/* reboot bit */
#define RCU_RD_GPHY0_XRX200 BIT(31)
#define RCU_RD_SRST BIT(30)
#define RCU_RD_GPHY1_XRX200 BIT(29)
+/* xRX300 bits */
+#define RCU_RD_GPHY0_XRX300 BIT(31)
+#define RCU_RD_GPHY1_XRX300 BIT(29)
+#define RCU_RD_GPHY2_XRX300 BIT(28)
+/* xRX330 bits */
+#define RCU_RD_GPHY0_XRX330 BIT(31)
+#define RCU_RD_GPHY1_XRX330 BIT(29)
+#define RCU_RD_GPHY2_XRX330 BIT(28)
+#define RCU_RD_GPHY3_XRX330 BIT(10)
/* reset cause */
#define RCU_STAT_SHIFT 26
@@ -47,6 +62,26 @@
/* remapped base addr of the reset control unit */
static void __iomem *ltq_rcu_membase;
static struct device_node *ltq_rcu_np;
+static DEFINE_SPINLOCK(ltq_rcu_lock);
+
+static void ltq_rcu_w32(uint32_t val, uint32_t reg_off)
+{
+ ltq_w32(val, ltq_rcu_membase + reg_off);
+}
+
+static uint32_t ltq_rcu_r32(uint32_t reg_off)
+{
+ return ltq_r32(ltq_rcu_membase + reg_off);
+}
+
+static void ltq_rcu_w32_mask(uint32_t clr, uint32_t set, uint32_t reg_off)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(<q_rcu_lock, flags);
+ ltq_rcu_w32((ltq_rcu_r32(reg_off) & ~(clr)) | (set), reg_off);
+ spin_unlock_irqrestore(<q_rcu_lock, flags);
+}
/* This function is used by the watchdog driver */
int ltq_reset_cause(void)
@@ -67,15 +102,40 @@ unsigned char ltq_boot_select(void)
return RCU_BOOT_SEL(val);
}
-/* reset / boot a gphy */
-static struct ltq_xrx200_gphy_reset {
+struct ltq_gphy_reset {
u32 rd;
u32 addr;
-} xrx200_gphy[] = {
+};
+
+/* reset / boot a gphy */
+static struct ltq_gphy_reset xrx200_gphy[] = {
{RCU_RD_GPHY0_XRX200, RCU_GFS_ADD0_XRX200},
{RCU_RD_GPHY1_XRX200, RCU_GFS_ADD1_XRX200},
};
+/* reset / boot a gphy */
+static struct ltq_gphy_reset xrx300_gphy[] = {
+ {RCU_RD_GPHY0_XRX300, RCU_GFS_ADD0_XRX300},
+ {RCU_RD_GPHY1_XRX300, RCU_GFS_ADD1_XRX300},
+ {RCU_RD_GPHY2_XRX300, RCU_GFS_ADD2_XRX300},
+};
+
+/* reset / boot a gphy */
+static struct ltq_gphy_reset xrx330_gphy[] = {
+ {RCU_RD_GPHY0_XRX330, RCU_GFS_ADD0_XRX330},
+ {RCU_RD_GPHY1_XRX330, RCU_GFS_ADD1_XRX330},
+ {RCU_RD_GPHY2_XRX330, RCU_GFS_ADD2_XRX330},
+ {RCU_RD_GPHY3_XRX330, RCU_GFS_ADD3_XRX330},
+};
+
+static void xrx200_gphy_boot_addr(struct ltq_gphy_reset *phy_regs,
+ dma_addr_t dev_addr)
+{
+ ltq_rcu_w32_mask(0, phy_regs->rd, RCU_RST_REQ);
+ ltq_rcu_w32(dev_addr, phy_regs->addr);
+ ltq_rcu_w32_mask(phy_regs->rd, 0, RCU_RST_REQ);
+}
+
/* reset and boot a gphy. these phys only exist on xrx200 SoC */
int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr)
{
@@ -86,23 +146,34 @@ int xrx200_gphy_boot(struct device *dev, unsigned int id, dma_addr_t dev_addr)
return -EINVAL;
}
- clk = clk_get_sys("1f203000.rcu", "gphy");
- if (IS_ERR(clk))
- return PTR_ERR(clk);
-
- clk_enable(clk);
-
- if (id > 1) {
- dev_err(dev, "%u is an invalid gphy id\n", id);
- return -EINVAL;
+ if (of_machine_is_compatible("lantiq,vr9")) {
+ clk = clk_get_sys("1f203000.rcu", "gphy");
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+ clk_enable(clk);
}
+
dev_info(dev, "booting GPHY%u firmware at %X\n", id, dev_addr);
- ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) | xrx200_gphy[id].rd,
- RCU_RST_REQ);
- ltq_rcu_w32(dev_addr, xrx200_gphy[id].addr);
- ltq_rcu_w32(ltq_rcu_r32(RCU_RST_REQ) & ~xrx200_gphy[id].rd,
- RCU_RST_REQ);
+ if (of_machine_is_compatible("lantiq,vr9")) {
+ if (id >= ARRAY_SIZE(xrx200_gphy)) {
+ dev_err(dev, "%u is an invalid gphy id\n", id);
+ return -EINVAL;
+ }
+ xrx200_gphy_boot_addr(&xrx200_gphy[id], dev_addr);
+ } else if (of_machine_is_compatible("lantiq,ar10")) {
+ if (id >= ARRAY_SIZE(xrx300_gphy)) {
+ dev_err(dev, "%u is an invalid gphy id\n", id);
+ return -EINVAL;
+ }
+ xrx200_gphy_boot_addr(&xrx300_gphy[id], dev_addr);
+ } else if (of_machine_is_compatible("lantiq,grx390")) {
+ if (id >= ARRAY_SIZE(xrx330_gphy)) {
+ dev_err(dev, "%u is an invalid gphy id\n", id);
+ return -EINVAL;
+ }
+ xrx200_gphy_boot_addr(&xrx330_gphy[id], dev_addr);
+ }
return 0;
}
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 10/15] MIPS: lantiq: add SoC detection for ar10 and grx390
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (8 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 09/15] MIPS: lantiq: add support for gphy firmware loading " Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-29 19:17 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 11/15] MIPS: lantiq: add clock for mei driver Hauke Mehrtens
` (4 subsequent siblings)
14 siblings, 1 reply; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
.../mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 12 ++++++++++
arch/mips/lantiq/xway/prom.c | 27 ++++++++++++++++++++--
2 files changed, 37 insertions(+), 2 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 133336b..3ab4e98 100644
--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
@@ -36,6 +36,16 @@
#define SOC_ID_GRX288_2 0x00D /* v1.2 */
#define SOC_ID_GRX282_2 0x00E /* v1.2 */
+#define SOC_ID_ARX362 0x004
+#define SOC_ID_ARX368 0x005
+#define SOC_ID_ARX382 0x007
+#define SOC_ID_ARX388 0x008
+#define SOC_ID_URX388 0x009
+#define SOC_ID_GRX383 0x010
+#define SOC_ID_GRX369 0x011
+#define SOC_ID_GRX387 0x00F
+#define SOC_ID_GRX389 0x012
+
/* SoC Types */
#define SOC_TYPE_DANUBE 0x01
#define SOC_TYPE_TWINPASS 0x02
@@ -43,6 +53,8 @@
#define SOC_TYPE_VR9 0x04 /* v1.1 */
#define SOC_TYPE_VR9_2 0x05 /* v1.2 */
#define SOC_TYPE_AMAZON_SE 0x06
+#define SOC_TYPE_AR10 0x07
+#define SOC_TYPE_GRX390 0x08
/* BOOT_SEL - find what boot media we have */
#define BS_EXT_ROM 0x0
diff --git a/arch/mips/lantiq/xway/prom.c b/arch/mips/lantiq/xway/prom.c
index 248429a..6f679f9 100644
--- a/arch/mips/lantiq/xway/prom.c
+++ b/arch/mips/lantiq/xway/prom.c
@@ -19,8 +19,10 @@
#define SOC_TWINPASS "Twinpass"
#define SOC_AMAZON_SE "Amazon_SE"
#define SOC_AR9 "AR9"
-#define SOC_GR9 "GR9"
-#define SOC_VR9 "VR9"
+#define SOC_GR9 "GRX200"
+#define SOC_VR9 "xRX200"
+#define SOC_AR10 "xRX300"
+#define SOC_GRX390 "xRX330"
#define COMP_DANUBE "lantiq,danube"
#define COMP_TWINPASS "lantiq,twinpass"
@@ -28,6 +30,8 @@
#define COMP_AR9 "lantiq,ar9"
#define COMP_GR9 "lantiq,gr9"
#define COMP_VR9 "lantiq,vr9"
+#define COMP_AR10 "lantiq,ar10"
+#define COMP_GRX390 "lantiq,grx390"
#define PART_SHIFT 12
#define PART_MASK 0x0FFFFFFF
@@ -108,6 +112,25 @@ void __init ltq_soc_detect(struct ltq_soc_info *i)
i->compatible = COMP_GR9;
break;
+ case SOC_ID_ARX362:
+ case SOC_ID_ARX368:
+ case SOC_ID_ARX382:
+ case SOC_ID_ARX388:
+ case SOC_ID_URX388:
+ i->name = SOC_AR10;
+ i->type = SOC_TYPE_AR10;
+ i->compatible = COMP_AR10;
+ break;
+
+ case SOC_ID_GRX383:
+ case SOC_ID_GRX369:
+ case SOC_ID_GRX387:
+ case SOC_ID_GRX389:
+ i->name = SOC_GRX390;
+ i->type = SOC_TYPE_GRX390;
+ i->compatible = COMP_GRX390;
+ break;
+
default:
unreachable();
break;
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 11/15] MIPS: lantiq: add clock for mei driver
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (9 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 10/15] MIPS: lantiq: add SoC detection " Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 12/15] MIPS: lantiq: add 1e103100.deu clock Hauke Mehrtens
` (3 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 55e694e..2140a2b 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -491,6 +491,7 @@ void __init ltq_soc_init(void)
clkdev_add_cgu("1e180000.etop", "ephycgu", CGU_EPHY);
clkdev_add_pmu("1e180000.etop", "ephy", 1, 0, PMU_EPHY);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_ASE_SDIO);
+ clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
} else if (of_machine_is_compatible("lantiq,grx390")) {
clkdev_add_static(ltq_grx390_cpu_hz(), ltq_grx390_fpi_hz(),
ltq_grx390_fpi_hz(), ltq_grx390_pp32_hz());
@@ -512,6 +513,8 @@ void __init ltq_soc_init(void)
PMU_PPE_DP | PMU_PPE_TC);
clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
+ clkdev_add_pmu("1e116000.mei", "afe", 1, 2, PMU_ANALOG_DSL_AFE);
+ clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
} else if (of_machine_is_compatible("lantiq,vr9")) {
clkdev_add_static(ltq_vr9_cpu_hz(), ltq_vr9_fpi_hz(),
ltq_vr9_fpi_hz(), ltq_vr9_pp32_hz());
@@ -533,6 +536,7 @@ void __init ltq_soc_init(void)
PMU_PPE_QSB | PMU_PPE_TOP);
clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
+ clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
} else if (of_machine_is_compatible("lantiq,ar9")) {
clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),
ltq_ar9_fpi_hz(), CLOCK_250M);
@@ -542,11 +546,13 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1e106000.usb", "phy", 1, 0, PMU_USB1_P);
clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
+ clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
} else {
clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
ltq_danube_fpi_hz(), ltq_danube_pp32_hz());
clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
+ clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
}
}
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 12/15] MIPS: lantiq: add 1e103100.deu clock
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (10 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 11/15] MIPS: lantiq: add clock for mei driver Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 13/15] MIPS: lantiq: add misc clocks Hauke Mehrtens
` (2 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 2140a2b..e791cf8 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -106,6 +106,7 @@ static u32 pmu_clk_cr_b[] = {
#define PMU_ASC1 BIT(17)
#define PMU_PPE_QSB BIT(18)
#define PMU_PPE_SLL01 BIT(19)
+#define PMU_DEU BIT(20)
#define PMU_PPE_TC BIT(21)
#define PMU_PPE_EMA BIT(22)
#define PMU_PPE_DPLUM BIT(23)
@@ -504,6 +505,7 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1a800000.pcie", "ctl", 1, 1, PMU1_PCIE2_CTL);
clkdev_add_pmu("1e108000.eth", NULL, 1, 0, PMU_SWITCH | PMU_PPE_DP);
clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
+ clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
} else if (of_machine_is_compatible("lantiq,ar10")) {
clkdev_add_static(ltq_ar10_cpu_hz(), ltq_ar10_fpi_hz(),
ltq_ar10_fpi_hz(), ltq_ar10_pp32_hz());
@@ -513,6 +515,7 @@ void __init ltq_soc_init(void)
PMU_PPE_DP | PMU_PPE_TC);
clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
+ clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
clkdev_add_pmu("1e116000.mei", "afe", 1, 2, PMU_ANALOG_DSL_AFE);
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
} else if (of_machine_is_compatible("lantiq,vr9")) {
@@ -536,6 +539,7 @@ void __init ltq_soc_init(void)
PMU_PPE_QSB | PMU_PPE_TOP);
clkdev_add_pmu("1f203000.rcu", "gphy", 1, 0, PMU_GPHY);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
+ clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
} else if (of_machine_is_compatible("lantiq,ar9")) {
clkdev_add_static(ltq_ar9_cpu_hz(), ltq_ar9_fpi_hz(),
@@ -546,6 +550,7 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1e106000.usb", "phy", 1, 0, PMU_USB1_P);
clkdev_add_pmu("1e180000.etop", "switch", 1, 0, PMU_SWITCH);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
+ clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
} else {
clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
@@ -553,6 +558,7 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1e101000.usb", "ctl", 1, 0, PMU_USB0);
clkdev_add_pmu("1e101000.usb", "phy", 1, 0, PMU_USB0_P);
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
+ clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
}
}
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 13/15] MIPS: lantiq: add misc clocks
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (11 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 12/15] MIPS: lantiq: add 1e103100.deu clock Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 14/15] MIPS: lantiq: add support for xRX220 SoC Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 15/15] MIPS: lantiq: fix check for return value of request_mem_region() Hauke Mehrtens
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index e791cf8..945f867 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -530,7 +530,7 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1d900000.pcie", "msi", 1, 1, PMU1_PCIE_MSI);
clkdev_add_pmu("1d900000.pcie", "pdi", 1, 1, PMU1_PCIE_PDI);
clkdev_add_pmu("1d900000.pcie", "ctl", 1, 1, PMU1_PCIE_CTL);
- clkdev_add_pmu("1d900000.pcie", "ahb", 1, 0, PMU_AHBM | PMU_AHBS);
+ clkdev_add_pmu(NULL, "ahb", 1, 0, PMU_AHBM | PMU_AHBS);
clkdev_add_pmu("1da00000.usif", "NULL", 1, 0, PMU_USIF);
clkdev_add_pmu("1e108000.eth", NULL, 1, 0,
@@ -552,6 +552,7 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
+ clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
} else {
clkdev_add_static(ltq_danube_cpu_hz(), ltq_danube_fpi_hz(),
ltq_danube_fpi_hz(), ltq_danube_pp32_hz());
@@ -560,5 +561,6 @@ void __init ltq_soc_init(void)
clkdev_add_pmu("1e103000.sdio", NULL, 1, 0, PMU_SDIO);
clkdev_add_pmu("1e103100.deu", NULL, 1, 0, PMU_DEU);
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
+ clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
}
}
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 14/15] MIPS: lantiq: add support for xRX220 SoC
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (12 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 13/15] MIPS: lantiq: add misc clocks Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 15/15] MIPS: lantiq: fix check for return value of request_mem_region() Hauke Mehrtens
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h | 2 ++
arch/mips/lantiq/xway/prom.c | 7 +++++++
2 files changed, 9 insertions(+)
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 3ab4e98..dd6005b 100644
--- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
+++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
@@ -35,6 +35,7 @@
#define SOC_ID_VRX268_2 0x00C /* v1.2 */
#define SOC_ID_GRX288_2 0x00D /* v1.2 */
#define SOC_ID_GRX282_2 0x00E /* v1.2 */
+#define SOC_ID_VRX220 0x000
#define SOC_ID_ARX362 0x004
#define SOC_ID_ARX368 0x005
@@ -55,6 +56,7 @@
#define SOC_TYPE_AMAZON_SE 0x06
#define SOC_TYPE_AR10 0x07
#define SOC_TYPE_GRX390 0x08
+#define SOC_TYPE_VRX220 0x09
/* BOOT_SEL - find what boot media we have */
#define BS_EXT_ROM 0x0
diff --git a/arch/mips/lantiq/xway/prom.c b/arch/mips/lantiq/xway/prom.c
index 6f679f9..a23b77ae 100644
--- a/arch/mips/lantiq/xway/prom.c
+++ b/arch/mips/lantiq/xway/prom.c
@@ -21,6 +21,7 @@
#define SOC_AR9 "AR9"
#define SOC_GR9 "GRX200"
#define SOC_VR9 "xRX200"
+#define SOC_VRX220 "xRX220"
#define SOC_AR10 "xRX300"
#define SOC_GRX390 "xRX330"
@@ -105,6 +106,12 @@ void __init ltq_soc_detect(struct ltq_soc_info *i)
i->compatible = COMP_VR9;
break;
+ case SOC_ID_VRX220:
+ i->name = SOC_VRX220;
+ i->type = SOC_TYPE_VRX220;
+ i->compatible = COMP_VR9;
+ break;
+
case SOC_ID_GRX282_2:
case SOC_ID_GRX288_2:
i->name = SOC_GR9;
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 15/15] MIPS: lantiq: fix check for return value of request_mem_region()
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
` (13 preceding siblings ...)
2015-10-28 22:37 ` [PATCH 14/15] MIPS: lantiq: add support for xRX220 SoC Hauke Mehrtens
@ 2015-10-28 22:37 ` Hauke Mehrtens
14 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-28 22:37 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
request_mem_region() returns a pointer and not an integer with an error
value. A check for "< 0" on a pointer will cause problems, replace it
with not null checks instead. This was found with sparse.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/irq.c | 8 ++++----
arch/mips/lantiq/xway/reset.c | 2 +-
arch/mips/lantiq/xway/sysctrl.c | 12 ++++++------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index 2c218c3..2e7f60c 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -369,8 +369,8 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
if (of_address_to_resource(node, i, &res))
panic("Failed to get icu memory range");
- if (request_mem_region(res.start, resource_size(&res),
- res.name) < 0)
+ if (!request_mem_region(res.start, resource_size(&res),
+ res.name))
pr_err("Failed to request icu memory");
ltq_icu_membase[i] = ioremap_nocache(res.start,
@@ -449,8 +449,8 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
if (ret != exin_avail)
panic("failed to load external irq resources");
- if (request_mem_region(res.start, resource_size(&res),
- res.name) < 0)
+ if (!request_mem_region(res.start, resource_size(&res),
+ res.name))
pr_err("Failed to request eiu memory");
ltq_eiu_membase = ioremap_nocache(res.start,
diff --git a/arch/mips/lantiq/xway/reset.c b/arch/mips/lantiq/xway/reset.c
index 1e23cee..55c278f 100644
--- a/arch/mips/lantiq/xway/reset.c
+++ b/arch/mips/lantiq/xway/reset.c
@@ -287,7 +287,7 @@ static int __init mips_reboot_setup(void)
if (of_address_to_resource(ltq_rcu_np, 0, &res))
panic("Failed to get rcu memory range");
- if (request_mem_region(res.start, resource_size(&res), res.name) < 0)
+ if (!request_mem_region(res.start, resource_size(&res), res.name))
pr_err("Failed to request rcu memory");
ltq_rcu_membase = ioremap_nocache(res.start, resource_size(&res));
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index 945f867..7ddae3e 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -421,12 +421,12 @@ void __init ltq_soc_init(void)
of_address_to_resource(np_ebu, 0, &res_ebu))
panic("Failed to get core resources");
- if ((request_mem_region(res_pmu.start, resource_size(&res_pmu),
- res_pmu.name) < 0) ||
- (request_mem_region(res_cgu.start, resource_size(&res_cgu),
- res_cgu.name) < 0) ||
- (request_mem_region(res_ebu.start, resource_size(&res_ebu),
- res_ebu.name) < 0))
+ if (!request_mem_region(res_pmu.start, resource_size(&res_pmu),
+ res_pmu.name) ||
+ !request_mem_region(res_cgu.start, resource_size(&res_cgu),
+ res_cgu.name) ||
+ !request_mem_region(res_ebu.start, resource_size(&res_ebu),
+ res_ebu.name))
pr_err("Failed to request core resources");
pmu_membase = ioremap_nocache(res_pmu.start, resource_size(&res_pmu));
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 06/15] MIPS: lantiq: deactivate most of the devices by default
2015-10-28 22:37 ` [PATCH 06/15] MIPS: lantiq: deactivate most of the devices by default Hauke Mehrtens
@ 2015-10-29 6:18 ` John Crispin
0 siblings, 0 replies; 22+ messages in thread
From: John Crispin @ 2015-10-29 6:18 UTC (permalink / raw
To: Hauke Mehrtens, ralf; +Cc: linux-mips, Hauke Mehrtens
Hi Hauke,
read through the series a couple of times now and the only thing i can
find is a superfluous Travolta bracket
On 28/10/2015 23:37, Hauke Mehrtens wrote:
> + if (deactivate) {
> + /* Disable it during the initialitin. Module should enable when used */
> + pmu_disable(clk);
> + }
> clkdev_add(&clk->cl);
> }
i think that bracket is not needed
apart from that, for the whole series
Acked-by: John Crispin <blogic@openwrt.org>
Thanks!
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards
2015-10-28 22:37 ` [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards Hauke Mehrtens
@ 2015-10-29 11:19 ` Sergei Shtylyov
2015-10-29 19:15 ` [PATCH please merge into original " Hauke Mehrtens
1 sibling, 0 replies; 22+ messages in thread
From: Sergei Shtylyov @ 2015-10-29 11:19 UTC (permalink / raw
To: Hauke Mehrtens, ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
Hello.
On 10/29/2015 1:37 AM, Hauke Mehrtens wrote:
> From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
>
> From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Hm... why twice?
> The PMU register are accesses in a non atomic way and they could be
Accessed?
> accesses by different threads simultaneously, which could cause
Accessed?
> problems this patch adds locking around the PMU registers. In
> addition it is now also waited till the PMU is actually deactivated.
Perhaps "we now also wait"?
> Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH please merge into original 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards
2015-10-28 22:37 ` [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards Hauke Mehrtens
2015-10-29 11:19 ` Sergei Shtylyov
@ 2015-10-29 19:15 ` Hauke Mehrtens
1 sibling, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-29 19:15 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
The PMU register are accessed in a non atomic way and they could be
accessed by different threads simultaneously, which could cause
problems, this patch adds locking around the PMU registers. In
addition this patch makes the function deactivating the PMU register
wait till this setting is applied.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/sysctrl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/lantiq/xway/sysctrl.c b/arch/mips/lantiq/xway/sysctrl.c
index c73ea3f..7c2ddbd 100644
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -4,6 +4,8 @@
* by the Free Software Foundation.
*
* Copyright (C) 2011-2012 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2013 Lei Chuanhua <Chuanhua.lei@lantiq.com>
+ * Copyright (C) 2015 Hauke Mehrtens <hauke.mehrtens@lantiq.com>
*/
#include <linux/ioport.h>
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH please merge into original 03/15] MIPS: lantiq: rename CGU_SYS_VR9 register
2015-10-28 22:37 ` [PATCH 03/15] MIPS: lantiq: rename CGU_SYS_VR9 register Hauke Mehrtens
@ 2015-10-29 19:15 ` Hauke Mehrtens
0 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-29 19:15 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
This register is also used on other SoCs.
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/clk.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/lantiq/xway/clk.c b/arch/mips/lantiq/xway/clk.c
index 619bff7..7aa4387 100644
--- a/arch/mips/lantiq/xway/clk.c
+++ b/arch/mips/lantiq/xway/clk.c
@@ -4,6 +4,8 @@
* by the Free Software Foundation.
*
* Copyright (C) 2010 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2013 Lei Chuanhua <Chuanhua.lei@lantiq.com>
+ * Copyright (C) 2015 Hauke Mehrtens <hauke.mehrtens@lantiq.com>
*/
#include <linux/io.h>
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH please merge into original 09/15] MIPS: lantiq: add support for gphy firmware loading for ar10 and grx390
2015-10-28 22:37 ` [PATCH 09/15] MIPS: lantiq: add support for gphy firmware loading " Hauke Mehrtens
@ 2015-10-29 19:16 ` Hauke Mehrtens
0 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-29 19:16 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/reset.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/lantiq/xway/reset.c b/arch/mips/lantiq/xway/reset.c
index 55c278f..9b009ec 100644
--- a/arch/mips/lantiq/xway/reset.c
+++ b/arch/mips/lantiq/xway/reset.c
@@ -4,6 +4,8 @@
* by the Free Software Foundation.
*
* Copyright (C) 2010 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2013 Lei Chuanhua <Chuanhua.lei@lantiq.com>
+ * Copyright (C) 2015 Hauke Mehrtens <hauke.mehrtens@lantiq.com>
*/
#include <linux/init.h>
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH please merge into original 10/15] MIPS: lantiq: add SoC detection for ar10 and grx390
2015-10-28 22:37 ` [PATCH 10/15] MIPS: lantiq: add SoC detection " Hauke Mehrtens
@ 2015-10-29 19:17 ` Hauke Mehrtens
0 siblings, 0 replies; 22+ messages in thread
From: Hauke Mehrtens @ 2015-10-29 19:17 UTC (permalink / raw
To: ralf; +Cc: blogic, linux-mips, Hauke Mehrtens
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
---
arch/mips/lantiq/xway/prom.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/lantiq/xway/prom.c b/arch/mips/lantiq/xway/prom.c
index a23b77ae..32994a9 100644
--- a/arch/mips/lantiq/xway/prom.c
+++ b/arch/mips/lantiq/xway/prom.c
@@ -4,6 +4,8 @@
* by the Free Software Foundation.
*
* Copyright (C) 2010 John Crispin <blogic@openwrt.org>
+ * Copyright (C) 2013 Lei Chuanhua <Chuanhua.lei@lantiq.com>
+ * Copyright (C) 2015 Hauke Mehrtens <hauke.mehrtens@lantiq.com>
*/
#include <linux/export.h>
--
2.6.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2015-10-29 19:17 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-28 22:37 [PATCH 00/15] MIPS: lantiq: add clock and PMU support for new SoCs Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 01/15] MIPS: lantiq: add locking for PMU register and check status afterwards Hauke Mehrtens
2015-10-29 11:19 ` Sergei Shtylyov
2015-10-29 19:15 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 02/15] MIPS: lantiq: add support for setting PMU register on AR10 and GRX390 Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 03/15] MIPS: lantiq: rename CGU_SYS_VR9 register Hauke Mehrtens
2015-10-29 19:15 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 04/15] MIPS: lantiq: fix pp32 clock on vr9 Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 05/15] MIPS: lantiq: add clock detection for grx390 and ar10 Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 06/15] MIPS: lantiq: deactivate most of the devices by default Hauke Mehrtens
2015-10-29 6:18 ` John Crispin
2015-10-28 22:37 ` [PATCH 07/15] MIPS: lantiq: add PMU bits for USB and SDIO devices Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 08/15] MIPS: lantiq: add pmu bits for ar10 and grx390 Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 09/15] MIPS: lantiq: add support for gphy firmware loading " Hauke Mehrtens
2015-10-29 19:16 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 10/15] MIPS: lantiq: add SoC detection " Hauke Mehrtens
2015-10-29 19:17 ` [PATCH please merge into original " Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 11/15] MIPS: lantiq: add clock for mei driver Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 12/15] MIPS: lantiq: add 1e103100.deu clock Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 13/15] MIPS: lantiq: add misc clocks Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 14/15] MIPS: lantiq: add support for xRX220 SoC Hauke Mehrtens
2015-10-28 22:37 ` [PATCH 15/15] MIPS: lantiq: fix check for return value of request_mem_region() Hauke Mehrtens
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.