* [PATCH 2/9] arch: mips: ralink: unify SoC id handling
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
@ 2015-11-04 10:50 ` John Crispin
2015-11-04 10:50 ` [PATCH 3/9] arch: mips: ralink: fix usb issue during frequency scaling John Crispin
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
This makes detection a lot easier for audio, wifi, ... drivers.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/include/asm/mach-ralink/mt7620.h | 7 -------
arch/mips/include/asm/mach-ralink/ralink_regs.h | 17 +++++++++++++++++
arch/mips/include/asm/mach-ralink/rt305x.h | 21 ++++++---------------
arch/mips/ralink/mt7620.c | 15 ++++++---------
arch/mips/ralink/prom.c | 5 +++++
arch/mips/ralink/rt288x.c | 1 +
arch/mips/ralink/rt305x.c | 12 +++++-------
arch/mips/ralink/rt3883.c | 2 ++
8 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/arch/mips/include/asm/mach-ralink/mt7620.h b/arch/mips/include/asm/mach-ralink/mt7620.h
index 590681a..455d406 100644
--- a/arch/mips/include/asm/mach-ralink/mt7620.h
+++ b/arch/mips/include/asm/mach-ralink/mt7620.h
@@ -13,13 +13,6 @@
#ifndef _MT7620_REGS_H_
#define _MT7620_REGS_H_
-enum mt762x_soc_type {
- MT762X_SOC_UNKNOWN = 0,
- MT762X_SOC_MT7620A,
- MT762X_SOC_MT7620N,
- MT762X_SOC_MT7628AN,
-};
-
#define MT7620_SYSC_BASE 0x10000000
#define SYSC_REG_CHIP_NAME0 0x00
diff --git a/arch/mips/include/asm/mach-ralink/ralink_regs.h b/arch/mips/include/asm/mach-ralink/ralink_regs.h
index bd93014..4c9fba6 100644
--- a/arch/mips/include/asm/mach-ralink/ralink_regs.h
+++ b/arch/mips/include/asm/mach-ralink/ralink_regs.h
@@ -13,6 +13,23 @@
#ifndef _RALINK_REGS_H_
#define _RALINK_REGS_H_
+enum ralink_soc_type {
+ RALINK_UNKNOWN = 0,
+ RT2880_SOC,
+ RT3883_SOC,
+ RT305X_SOC_RT3050,
+ RT305X_SOC_RT3052,
+ RT305X_SOC_RT3350,
+ RT305X_SOC_RT3352,
+ RT305X_SOC_RT5350,
+ MT762X_SOC_MT7620A,
+ MT762X_SOC_MT7620N,
+ MT762X_SOC_MT7621AT,
+ MT762X_SOC_MT7628AN,
+ MT762X_SOC_MT7688,
+};
+extern enum ralink_soc_type ralink_soc;
+
extern __iomem void *rt_sysc_membase;
extern __iomem void *rt_memc_membase;
diff --git a/arch/mips/include/asm/mach-ralink/rt305x.h b/arch/mips/include/asm/mach-ralink/rt305x.h
index 96f731b..2eea793 100644
--- a/arch/mips/include/asm/mach-ralink/rt305x.h
+++ b/arch/mips/include/asm/mach-ralink/rt305x.h
@@ -13,25 +13,16 @@
#ifndef _RT305X_REGS_H_
#define _RT305X_REGS_H_
-enum rt305x_soc_type {
- RT305X_SOC_UNKNOWN = 0,
- RT305X_SOC_RT3050,
- RT305X_SOC_RT3052,
- RT305X_SOC_RT3350,
- RT305X_SOC_RT3352,
- RT305X_SOC_RT5350,
-};
-
-extern enum rt305x_soc_type rt305x_soc;
+extern enum ralink_soc_type ralink_soc;
static inline int soc_is_rt3050(void)
{
- return rt305x_soc == RT305X_SOC_RT3050;
+ return ralink_soc == RT305X_SOC_RT3050;
}
static inline int soc_is_rt3052(void)
{
- return rt305x_soc == RT305X_SOC_RT3052;
+ return ralink_soc == RT305X_SOC_RT3052;
}
static inline int soc_is_rt305x(void)
@@ -41,17 +32,17 @@ static inline int soc_is_rt305x(void)
static inline int soc_is_rt3350(void)
{
- return rt305x_soc == RT305X_SOC_RT3350;
+ return ralink_soc == RT305X_SOC_RT3350;
}
static inline int soc_is_rt3352(void)
{
- return rt305x_soc == RT305X_SOC_RT3352;
+ return ralink_soc == RT305X_SOC_RT3352;
}
static inline int soc_is_rt5350(void)
{
- return rt305x_soc == RT305X_SOC_RT5350;
+ return ralink_soc == RT305X_SOC_RT5350;
}
#define RT305X_SYSC_BASE 0x10000000
diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c
index 4d1a033..f3a4a08 100644
--- a/arch/mips/ralink/mt7620.c
+++ b/arch/mips/ralink/mt7620.c
@@ -37,9 +37,6 @@
#define PMU1_CFG 0x8C
#define DIG_SW_SEL BIT(25)
-/* is this a MT7620 or a MT7628 */
-enum mt762x_soc_type mt762x_soc;
-
/* EFUSE bits */
#define EFUSE_MT7688 0x100000
@@ -235,8 +232,8 @@ static struct rt2880_pmx_group mt7628an_pinmux_data[] = {
static inline int is_mt76x8(void)
{
- return mt762x_soc == MT762X_SOC_MT7628AN ||
- mt762x_soc == MT762X_SOC_MT7688;
+ return ralink_soc == MT762X_SOC_MT7628AN ||
+ ralink_soc == MT762X_SOC_MT7688;
}
static __init u32
@@ -511,11 +508,11 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
if (n0 == MT7620_CHIP_NAME0 && n1 == MT7620_CHIP_NAME1) {
if (bga) {
- mt762x_soc = MT762X_SOC_MT7620A;
+ ralink_soc = MT762X_SOC_MT7620A;
name = "MT7620A";
soc_info->compatible = "ralink,mt7620a-soc";
} else {
- mt762x_soc = MT762X_SOC_MT7620N;
+ ralink_soc = MT762X_SOC_MT7620N;
name = "MT7620N";
soc_info->compatible = "ralink,mt7620n-soc";
#ifdef CONFIG_PCI
@@ -526,10 +523,10 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
u32 efuse = __raw_readl(sysc + SYSC_REG_EFUSE_CFG);
if (efuse & EFUSE_MT7688) {
- mt762x_soc = MT762X_SOC_MT7688;
+ ralink_soc = MT762X_SOC_MT7688;
name = "MT7688";
} else {
- mt762x_soc = MT762X_SOC_MT7628AN;
+ ralink_soc = MT762X_SOC_MT7628AN;
name = "MT7628AN";
}
soc_info->compatible = "ralink,mt7628an-soc";
diff --git a/arch/mips/ralink/prom.c b/arch/mips/ralink/prom.c
index 09419f6..39a9142f 100644
--- a/arch/mips/ralink/prom.c
+++ b/arch/mips/ralink/prom.c
@@ -15,11 +15,16 @@
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
+#include <asm/mach-ralink/ralink_regs.h>
+
#include "common.h"
struct ralink_soc_info soc_info;
struct rt2880_pmx_group *rt2880_pinmux_data = NULL;
+enum ralink_soc_type ralink_soc;
+EXPORT_SYMBOL_GPL(ralink_soc);
+
const char *get_system_type(void)
{
return soc_info.sys_type;
diff --git a/arch/mips/ralink/rt288x.c b/arch/mips/ralink/rt288x.c
index 738cec8..844f5cd 100644
--- a/arch/mips/ralink/rt288x.c
+++ b/arch/mips/ralink/rt288x.c
@@ -119,4 +119,5 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
soc_info->mem_size_max = RT2880_MEM_SIZE_MAX;
rt2880_pinmux_data = rt2880_pinmux_data_act;
+ ralink_soc == RT2880_SOC;
}
diff --git a/arch/mips/ralink/rt305x.c b/arch/mips/ralink/rt305x.c
index c40776a..7e11f00 100644
--- a/arch/mips/ralink/rt305x.c
+++ b/arch/mips/ralink/rt305x.c
@@ -21,8 +21,6 @@
#include "common.h"
-enum rt305x_soc_type rt305x_soc;
-
static struct rt2880_pmx_func i2c_func[] = { FUNC("i2c", 0, 1, 2) };
static struct rt2880_pmx_func spi_func[] = { FUNC("spi", 0, 3, 4) };
static struct rt2880_pmx_func uartf_func[] = {
@@ -235,24 +233,24 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
icache_sets = (read_c0_config1() >> 22) & 7;
if (icache_sets == 1) {
- rt305x_soc = RT305X_SOC_RT3050;
+ ralink_soc = RT305X_SOC_RT3050;
name = "RT3050";
soc_info->compatible = "ralink,rt3050-soc";
} else {
- rt305x_soc = RT305X_SOC_RT3052;
+ ralink_soc = RT305X_SOC_RT3052;
name = "RT3052";
soc_info->compatible = "ralink,rt3052-soc";
}
} else if (n0 == RT3350_CHIP_NAME0 && n1 == RT3350_CHIP_NAME1) {
- rt305x_soc = RT305X_SOC_RT3350;
+ ralink_soc = RT305X_SOC_RT3350;
name = "RT3350";
soc_info->compatible = "ralink,rt3350-soc";
} else if (n0 == RT3352_CHIP_NAME0 && n1 == RT3352_CHIP_NAME1) {
- rt305x_soc = RT305X_SOC_RT3352;
+ ralink_soc = RT305X_SOC_RT3352;
name = "RT3352";
soc_info->compatible = "ralink,rt3352-soc";
} else if (n0 == RT5350_CHIP_NAME0 && n1 == RT5350_CHIP_NAME1) {
- rt305x_soc = RT305X_SOC_RT5350;
+ ralink_soc = RT305X_SOC_RT5350;
name = "RT5350";
soc_info->compatible = "ralink,rt5350-soc";
} else {
diff --git a/arch/mips/ralink/rt3883.c b/arch/mips/ralink/rt3883.c
index 86a535c..582995a 100644
--- a/arch/mips/ralink/rt3883.c
+++ b/arch/mips/ralink/rt3883.c
@@ -153,4 +153,6 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
soc_info->mem_size_max = RT3883_MEM_SIZE_MAX;
rt2880_pinmux_data = rt3883_pinmux_data;
+
+ ralink_soc == RT3883_SOC;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 3/9] arch: mips: ralink: fix usb issue during frequency scaling
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
2015-11-04 10:50 ` [PATCH 2/9] arch: mips: ralink: unify SoC id handling John Crispin
@ 2015-11-04 10:50 ` John Crispin
2015-11-04 10:50 ` [PATCH 4/9] arch: mips: ralink: add tty detection John Crispin
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
If the USB HCD is running and the cpu is scaled too low, then the USB
stops working. Increase the idle speed of the core to fix this if the
kernel is built with USB support.
The "magic" values are taken from the Ralink SDK Kernel.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/ralink/mt7620.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c
index f3a4a08..55ddf09 100644
--- a/arch/mips/ralink/mt7620.c
+++ b/arch/mips/ralink/mt7620.c
@@ -37,6 +37,12 @@
#define PMU1_CFG 0x8C
#define DIG_SW_SEL BIT(25)
+/* clock scaling */
+#define CLKCFG_FDIV_MASK 0x1f00
+#define CLKCFG_FDIV_USB_VAL 0x0300
+#define CLKCFG_FFRAC_MASK 0x001f
+#define CLKCFG_FFRAC_USB_VAL 0x0003
+
/* EFUSE bits */
#define EFUSE_MT7688 0x100000
@@ -432,6 +438,20 @@ void __init ralink_clk_init(void)
ralink_clk_add("10000b00.spi", sys_rate);
ralink_clk_add("10000c00.uartlite", periph_rate);
ralink_clk_add("10180000.wmac", xtal_rate);
+
+ if (IS_ENABLED(CONFIG_USB) && is_mt76x8()) {
+ /*
+ * When the CPU goes into sleep mode, the BUS clock will be
+ * too low for USB to function properly. Adjust the busses
+ * fractional divider to fix this
+ */
+ u32 val = rt_sysc_r32(SYSC_REG_CPU_SYS_CLKCFG);
+
+ val &= ~(CLKCFG_FDIV_MASK | CLKCFG_FFRAC_MASK);
+ val |= CLKCFG_FDIV_USB_VAL | CLKCFG_FFRAC_USB_VAL;
+
+ rt_sysc_w32(val, SYSC_REG_CPU_SYS_CLKCFG);
+ }
}
void __init ralink_of_remap(void)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 4/9] arch: mips: ralink: add tty detection
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
2015-11-04 10:50 ` [PATCH 2/9] arch: mips: ralink: unify SoC id handling John Crispin
2015-11-04 10:50 ` [PATCH 3/9] arch: mips: ralink: fix usb issue during frequency scaling John Crispin
@ 2015-11-04 10:50 ` John Crispin
2015-11-04 11:26 ` Sergei Shtylyov
2015-11-04 10:50 ` [PATCH 5/9] arch: mips: ralink: fix invalid tick count John Crispin
` (4 subsequent siblings)
7 siblings, 1 reply; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
MT7688 has several uarts that can be used for console. There are several
boards in the wild, that use ttyS1 or ttyS2. This patch applies a simply
autodetection routine to figure out which ttyS the bootloader used as
console. The uarts come up in 6 bit mode by default. The bootloader will
have set 8 bit mode on the console. Find that 8bit tty and use it.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/ralink/early_printk.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/mips/ralink/early_printk.c b/arch/mips/ralink/early_printk.c
index 255d695..36c2468 100644
--- a/arch/mips/ralink/early_printk.c
+++ b/arch/mips/ralink/early_printk.c
@@ -25,11 +25,13 @@
#define MT7628_CHIP_NAME1 0x20203832
#define UART_REG_TX 0x04
+#define UART_REG_LCR 0x0c
#define UART_REG_LSR 0x14
#define UART_REG_LSR_RT2880 0x1c
static __iomem void *uart_membase = (__iomem void *) KSEG1ADDR(EARLY_UART_BASE);
static __iomem void *chipid_membase = (__iomem void *) KSEG1ADDR(CHIPID_BASE);
+static int init_complete;
static inline void uart_w32(u32 val, unsigned reg)
{
@@ -47,8 +49,32 @@ static inline int soc_is_mt7628(void)
(__raw_readl(chipid_membase) == MT7628_CHIP_NAME1);
}
+static inline void find_uart_base(void)
+{
+ int i;
+
+ if (!soc_is_mt7628())
+ return;
+
+ for (i = 0; i < 3; i++) {
+ u32 reg = uart_r32(UART_REG_LCR + (0x100 * i));
+
+ if (!reg)
+ continue;
+
+ uart_membase = (__iomem void *) KSEG1ADDR(EARLY_UART_BASE +
+ (0x100 * i));
+ break;
+ }
+}
+
void prom_putchar(unsigned char ch)
{
+ if (!init_complete) {
+ find_uart_base();
+ init_complete = 1;
+ }
+
if (IS_ENABLED(CONFIG_SOC_MT7621) || soc_is_mt7628()) {
uart_w32(ch, UART_TX);
while ((uart_r32(UART_REG_LSR) & UART_LSR_THRE) == 0)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 4/9] arch: mips: ralink: add tty detection
2015-11-04 10:50 ` [PATCH 4/9] arch: mips: ralink: add tty detection John Crispin
@ 2015-11-04 11:26 ` Sergei Shtylyov
0 siblings, 0 replies; 10+ messages in thread
From: Sergei Shtylyov @ 2015-11-04 11:26 UTC (permalink / raw)
To: John Crispin, Ralf Baechle; +Cc: linux-mips
Hello.
On 11/4/2015 1:50 PM, John Crispin wrote:
> MT7688 has several uarts that can be used for console. There are several
> boards in the wild, that use ttyS1 or ttyS2. This patch applies a simply
> autodetection routine to figure out which ttyS the bootloader used as
> console. The uarts come up in 6 bit mode by default. The bootloader will
> have set 8 bit mode on the console. Find that 8bit tty and use it.
>
> Signed-off-by: John Crispin <blogic@openwrt.org>
> ---
> arch/mips/ralink/early_printk.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/arch/mips/ralink/early_printk.c b/arch/mips/ralink/early_printk.c
> index 255d695..36c2468 100644
> --- a/arch/mips/ralink/early_printk.c
> +++ b/arch/mips/ralink/early_printk.c
[...]
> @@ -47,8 +49,32 @@ static inline int soc_is_mt7628(void)
> (__raw_readl(chipid_membase) == MT7628_CHIP_NAME1);
> }
>
> +static inline void find_uart_base(void)
^^^^^^
We let gcc figure it out itself these days.
[...]
MBR< Sergei
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/9] arch: mips: ralink: fix invalid tick count
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
` (2 preceding siblings ...)
2015-11-04 10:50 ` [PATCH 4/9] arch: mips: ralink: add tty detection John Crispin
@ 2015-11-04 10:50 ` John Crispin
2015-11-04 10:50 ` [PATCH 6/9] arch: mips: ralink: remove check for CONFIG_PCI on non-PCI SoCs John Crispin
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
The current code adds the delta twice, which is obviously wrong.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/ralink/cevt-rt3352.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/ralink/cevt-rt3352.c b/arch/mips/ralink/cevt-rt3352.c
index a8e70a9..e46f91f 100644
--- a/arch/mips/ralink/cevt-rt3352.c
+++ b/arch/mips/ralink/cevt-rt3352.c
@@ -48,7 +48,7 @@ static int systick_next_event(unsigned long delta,
sdev = container_of(evt, struct systick_device, dev);
count = ioread32(sdev->membase + SYSTICK_COUNT);
count = (count + delta) % SYSTICK_FREQ;
- iowrite32(count + delta, sdev->membase + SYSTICK_COMPARE);
+ iowrite32(count, sdev->membase + SYSTICK_COMPARE);
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 6/9] arch: mips: ralink: remove check for CONFIG_PCI on non-PCI SoCs
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
` (3 preceding siblings ...)
2015-11-04 10:50 ` [PATCH 5/9] arch: mips: ralink: fix invalid tick count John Crispin
@ 2015-11-04 10:50 ` John Crispin
2015-11-04 10:50 ` [PATCH 7/9] arch: mips: ralink: dont set pm_power_off John Crispin
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
The code currently panics if PCI is enabled but the SoC has no PCI bus.
This check is superfluous as the driver only loads if enabled in the
devicetree.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/ralink/mt7620.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/arch/mips/ralink/mt7620.c b/arch/mips/ralink/mt7620.c
index 55ddf09..dfb04fc 100644
--- a/arch/mips/ralink/mt7620.c
+++ b/arch/mips/ralink/mt7620.c
@@ -535,9 +535,6 @@ void prom_soc_init(struct ralink_soc_info *soc_info)
ralink_soc = MT762X_SOC_MT7620N;
name = "MT7620N";
soc_info->compatible = "ralink,mt7620n-soc";
-#ifdef CONFIG_PCI
- panic("mt7620n is only supported for non pci kernels");
-#endif
}
} else if (n0 == MT7620_CHIP_NAME0 && n1 == MT7628_CHIP_NAME1) {
u32 efuse = __raw_readl(sysc + SYSC_REG_EFUSE_CFG);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 7/9] arch: mips: ralink: dont set pm_power_off
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
` (4 preceding siblings ...)
2015-11-04 10:50 ` [PATCH 6/9] arch: mips: ralink: remove check for CONFIG_PCI on non-PCI SoCs John Crispin
@ 2015-11-04 10:50 ` John Crispin
2015-11-04 10:50 ` [PATCH 8/9] arch: mips: ralink: put the pci bus into reset state before rebooting the SoC John Crispin
2015-11-04 10:50 ` [PATCH 9/9] arch: mips: ralink: add missing clock on rt305x John Crispin
7 siblings, 0 replies; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
Setting pm_power_off is apprently wrong and makes drivers such as
gpio-poweroff not work.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/ralink/reset.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/mips/ralink/reset.c b/arch/mips/ralink/reset.c
index 55c7ec5..ee26d45 100644
--- a/arch/mips/ralink/reset.c
+++ b/arch/mips/ralink/reset.c
@@ -98,7 +98,6 @@ static int __init mips_reboot_setup(void)
{
_machine_restart = ralink_restart;
_machine_halt = ralink_halt;
- pm_power_off = ralink_halt;
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 8/9] arch: mips: ralink: put the pci bus into reset state before rebooting the SoC
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
` (5 preceding siblings ...)
2015-11-04 10:50 ` [PATCH 7/9] arch: mips: ralink: dont set pm_power_off John Crispin
@ 2015-11-04 10:50 ` John Crispin
2015-11-04 10:50 ` [PATCH 9/9] arch: mips: ralink: add missing clock on rt305x John Crispin
7 siblings, 0 replies; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
Some pcie cards have problems after a reboot without this.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/ralink/reset.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/mips/ralink/reset.c b/arch/mips/ralink/reset.c
index ee26d45..ee117c4 100644
--- a/arch/mips/ralink/reset.c
+++ b/arch/mips/ralink/reset.c
@@ -11,6 +11,7 @@
#include <linux/pm.h>
#include <linux/io.h>
#include <linux/of.h>
+#include <linux/delay.h>
#include <linux/reset-controller.h>
#include <asm/reboot.h>
@@ -18,8 +19,10 @@
#include <asm/mach-ralink/ralink_regs.h>
/* Reset Control */
-#define SYSC_REG_RESET_CTRL 0x034
-#define RSTCTL_RESET_SYSTEM BIT(0)
+#define SYSC_REG_RESET_CTRL 0x034
+
+#define RSTCTL_RESET_PCI BIT(26)
+#define RSTCTL_RESET_SYSTEM BIT(0)
static int ralink_assert_device(struct reset_controller_dev *rcdev,
unsigned long id)
@@ -83,6 +86,11 @@ void ralink_rst_init(void)
static void ralink_restart(char *command)
{
+ if (IS_ENABLED(CONFIG_PCI)) {
+ rt_sysc_m32(0, RSTCTL_RESET_PCI, SYSC_REG_RESET_CTRL);
+ mdelay(50);
+ }
+
local_irq_disable();
rt_sysc_w32(RSTCTL_RESET_SYSTEM, SYSC_REG_RESET_CTRL);
unreachable();
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 9/9] arch: mips: ralink: add missing clock on rt305x
2015-11-04 10:50 [PATCH 1/9] arch: mips: ralink: add support for mt7688 John Crispin
` (6 preceding siblings ...)
2015-11-04 10:50 ` [PATCH 8/9] arch: mips: ralink: put the pci bus into reset state before rebooting the SoC John Crispin
@ 2015-11-04 10:50 ` John Crispin
7 siblings, 0 replies; 10+ messages in thread
From: John Crispin @ 2015-11-04 10:50 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
The rt305x support is missing a clock required by the ethernet driver.
Signed-off-by: John Crispin <blogic@openwrt.org>
---
arch/mips/ralink/rt305x.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/mips/ralink/rt305x.c b/arch/mips/ralink/rt305x.c
index 7e11f00..9e45725 100644
--- a/arch/mips/ralink/rt305x.c
+++ b/arch/mips/ralink/rt305x.c
@@ -199,6 +199,7 @@ void __init ralink_clk_init(void)
}
ralink_clk_add("cpu", cpu_rate);
+ ralink_clk_add("sys", sys_rate);
ralink_clk_add("10000b00.spi", sys_rate);
ralink_clk_add("10000100.timer", wdt_rate);
ralink_clk_add("10000120.watchdog", wdt_rate);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 10+ messages in thread