Skip to contentSkip to conversation

ls1043ardb: add qe node to ls1043ardb

PATCH In review Zhao Qiang 2 participants 8 messages Nov 1, 2017 – Nov 6, 2017

Subsystems (9)
lore
Share & tools
lore

Zhao Qiang

author maintainer
#0 lore raw

PATCH 1/8 ls1043ardb: add qe node to ls1043ardb

---
 arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts | 16 ++++++
 arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi    | 66 +++++++++++++++++++++++
 2 files changed, 82 insertions(+)
arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts +16 -0
index c37110b..8f23f39 100644
@@ -132,6 +132,22 @@
 	};
 };
 
+&uqe {
+	ucc_hdlc: ucc@2000 {
+		compatible = "fsl,ucc-hdlc";
+		rx-clock-name = "clk8";
+		tx-clock-name = "clk9";
+		fsl,rx-sync-clock = "rsync_pin";
+		fsl,tx-sync-clock = "tsync_pin";
+		fsl,tx-timeslot-mask = <0xfffffffe>;
+		fsl,rx-timeslot-mask = <0xfffffffe>;
+		fsl,tdm-framer-type = "e1";
+		fsl,tdm-id = <0>;
+		fsl,siram-entry-id = <0>;
+		fsl,tdm-interface;
+	};
+};
+
 &duart0 {
 	status = "okay";
 };
arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +66 -0

72 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324
author maintainer
#1 lore raw

PATCH 2/8 ls1043ardb: add ds26522 node to dts

add ds26522 node to fsl-ls1043a-rdb.dts

---
 arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts +16 -0
index 8f23f39..11213ce 100644
@@ -130,6 +130,22 @@
 		reg = <0>;
 		spi-max-frequency = <1000000>; /* input clock */
 	};
+
+	slic@2 {
+		compatible = "maxim,ds26522";
+		reg = <2>;
+		spi-max-frequency = <2000000>;
+		fsl,spi-cs-sck-delay = <100>;
+		fsl,spi-sck-cs-delay = <50>;
+	};
+
+	slic@3 {
+		compatible = "maxim,ds26522";
+		reg = <3>;
+		spi-max-frequency = <2000000>;
+		fsl,spi-cs-sck-delay = <100>;
+		fsl,spi-sck-cs-delay = <50>;
+	};
 };
 
 &uqe {
Signature · 1 line
2.1.0.27.g96db324
author maintainer
#2 lore raw

PATCH 3/8 QE: remove PPCisms for QE

In reply to Zhao Qiang

QE was supported on PowerPC, and dependent on PPC, Now it is supported on other platforms. so remove PPCisms.

---
 drivers/net/ethernet/freescale/Kconfig | 11 ++---
 drivers/soc/fsl/qe/Kconfig             |  2 +-
 drivers/soc/fsl/qe/qe.c                | 80 ++++++++++++++++++++--------------
 drivers/soc/fsl/qe/qe_io.c             | 42 ++++++++----------
 drivers/soc/fsl/qe/qe_tdm.c            |  8 ++--
 drivers/soc/fsl/qe/ucc.c               | 10 ++---
 drivers/soc/fsl/qe/ucc_fast.c          | 74 ++++++++++++++++---------------
 drivers/tty/serial/Kconfig             |  2 +-
 drivers/tty/serial/ucc_uart.c          |  1 +
 drivers/usb/gadget/udc/Kconfig         |  2 +-
 drivers/usb/host/Kconfig               |  2 +-
 include/soc/fsl/qe/qe.h                |  1 -
 12 files changed, 124 insertions(+), 111 deletions(-)
drivers/net/ethernet/freescale/Kconfig +6 -5
index 6e490fd2..015bdb8 100644
@@ -5,10 +5,11 @@
 config NET_VENDOR_FREESCALE
 	bool "Freescale devices"
 	default y
-	depends on FSL_SOC || QUICC_ENGINE || CPM1 || CPM2 || PPC_MPC512x || \
-		   M523x || M527x || M5272 || M528x || M520x || M532x || \
-		   ARCH_MXC || ARCH_MXS || (PPC_MPC52xx && PPC_BESTCOMM) || \
-		   ARCH_LAYERSCAPE || COMPILE_TEST
+	depends on FSL_SOC || (QUICC_ENGINE && PPC32) || CPM1 || CPM2 || \
+		   PPC_MPC512x || M523x || M527x || M5272 || M528x || M520x || \
+		   M532x || ARCH_MXC || ARCH_MXS || \
+		   (PPC_MPC52xx && PPC_BESTCOMM) || ARCH_LAYERSCAPE || \
+		   COMPILE_TEST
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y.
 
@@ -73,7 +74,7 @@ config FSL_XGMAC_MDIO
 
 config UCC_GETH
 	tristate "Freescale QE Gigabit Ethernet"
-	depends on QUICC_ENGINE
+	depends on QUICC_ENGINE && FSL_SOC && PPC32
 	select FSL_PQ_MDIO
 	select PHYLIB
 	---help---
drivers/soc/fsl/qe/Kconfig +1 -1
index 73a2e08..b26b643 100644
@@ -4,7 +4,7 @@
 
 config QUICC_ENGINE
 	bool "Freescale QUICC Engine (QE) Support"
-	depends on FSL_SOC && PPC32
+	depends on OF && HAS_IOMEM
 	select GENERIC_ALLOCATOR
 	select CRC32
 	help
drivers/soc/fsl/qe/qe.c +48 -32

174 lines not on this page · raw message

drivers/soc/fsl/qe/qe_io.c +18 -24

88 lines not on this page · raw message

drivers/soc/fsl/qe/qe_tdm.c +4 -4
index a1048b4..818e679 100644
@@ -227,10 +227,10 @@ void ucc_tdm_init(struct ucc_tdm *utdm, struct ucc_tdm_info *ut_info)
 				    &siram[siram_entry_id * 32 + 0x200 +  i]);
 	}
 
-	setbits16(&siram[(siram_entry_id * 32) + (utdm->num_of_ts - 1)],
-		  SIR_LAST);
-	setbits16(&siram[(siram_entry_id * 32) + 0x200 + (utdm->num_of_ts - 1)],
-		  SIR_LAST);
+	qe_setbits16(&siram[(siram_entry_id * 32) + (utdm->num_of_ts - 1)],
+		     SIR_LAST);
+	qe_setbits16(&siram[(siram_entry_id * 32) + 0x200 +
+		     (utdm->num_of_ts - 1)], SIR_LAST);
 
 	/* Set SIxMR register */
 	sixmr = SIMR_SAD(siram_entry_id);
drivers/soc/fsl/qe/ucc.c +5 -5
index c646d87..bc64b83 100644
@@ -39,7 +39,7 @@ int ucc_set_qe_mux_mii_mng(unsigned int ucc_num)
 		return -EINVAL;
 
 	spin_lock_irqsave(&cmxgcr_lock, flags);
-	clrsetbits_be32(&qe_immr->qmx.cmxgcr, QE_CMXGCR_MII_ENET_MNG,
+	qe_clrsetbits32(&qe_immr->qmx.cmxgcr, QE_CMXGCR_MII_ENET_MNG,
 		ucc_num << QE_CMXGCR_MII_ENET_MNG_SHIFT);
 	spin_unlock_irqrestore(&cmxgcr_lock, flags);
 
@@ -84,7 +84,7 @@ int ucc_set_type(unsigned int ucc_num, enum ucc_speed_type speed)
 		return -EINVAL;
 	}
 
-	clrsetbits_8(guemr, UCC_GUEMR_MODE_MASK,
+	qe_clrsetbits8(guemr, UCC_GUEMR_MODE_MASK,
 		UCC_GUEMR_SET_RESERVED3 | speed);
 
 	return 0;
@@ -113,9 +113,9 @@ int ucc_mux_set_grant_tsa_bkpt(unsigned int ucc_num, int set, u32 mask)
 	get_cmxucr_reg(ucc_num, &cmxucr, &reg_num, &shift);
 
 	if (set)
-		setbits32(cmxucr, mask << shift);
+		qe_setbits32(cmxucr, mask << shift);
 	else
-		clrbits32(cmxucr, mask << shift);
+		qe_clrbits32(cmxucr, mask << shift);
 
 	return 0;
 }
@@ -211,7 +211,7 @@ int ucc_set_qe_mux_rxtx(unsigned int ucc_num, enum qe_clock clock,
 	if (mode == COMM_DIR_RX)
 		shift += 4;
 
-	clrsetbits_be32(cmxucr, QE_CMXUCR_TX_CLK_SRC_MASK << shift,
+	qe_clrsetbits32(cmxucr, QE_CMXUCR_TX_CLK_SRC_MASK << shift,
 		clock_bits << shift);
 
 	return 0;
drivers/soc/fsl/qe/ucc_fast.c +38 -36

162 lines not on this page · raw message

drivers/tty/serial/Kconfig +1 -1
index e9cf5b6..b02ae82 100644
@@ -1166,7 +1166,7 @@ config SERIAL_LANTIQ
 
 config SERIAL_QE
 	tristate "Freescale QUICC Engine serial port support"
-	depends on QUICC_ENGINE
+	depends on QUICC_ENGINE && FSL_SOC && PPC32
 	select SERIAL_CORE
 	select FW_LOADER
 	default n
drivers/tty/serial/ucc_uart.c +1 -0
index 481eb29..ee409fd 100644
@@ -34,6 +34,7 @@
 #include <soc/fsl/qe/ucc_slow.h>
 
 #include <linux/firmware.h>
+#include <asm/cpm.h>
 #include <asm/reg.h>
 
 /*
drivers/usb/gadget/udc/Kconfig +1 -1
index 658b8da..e18168c 100644
@@ -277,7 +277,7 @@ config USB_AMD5536UDC
 
 config USB_FSL_QE
 	tristate "Freescale QE/CPM USB Device Controller"
-	depends on FSL_SOC && (QUICC_ENGINE || CPM)
+	depends on (FSL_SOC && QUICC_ENGINE && PPC32) || (FSL_SOC && CPM)
 	help
 	   Some of Freescale PowerPC processors have a Full Speed
 	   QE/CPM2 USB controller, which support device mode with 4
drivers/usb/host/Kconfig +1 -1
index 6361fc7..30f0548 100644
@@ -639,7 +639,7 @@ config USB_UHCI_BIG_ENDIAN_DESC
 
 config USB_FHCI_HCD
 	tristate "Freescale QE USB Host Controller support"
-	depends on OF_GPIO && QE_GPIO && QUICC_ENGINE
+	depends on OF_GPIO && QE_GPIO && QUICC_ENGINE && FSL_SOC && PPC32
 	select FSL_GTM
 	select QE_USB
 	help
include/soc/fsl/qe/qe.h +0 -1
index 70339d7..f7a14f2 100644
@@ -21,7 +21,6 @@
 #include <linux/spinlock.h>
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <asm/cpm.h>
 #include <soc/fsl/qe/immap_qe.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
Signature · 1 line
2.1.0.27.g96db324
#3 lore raw

Re: [PATCH 3/8] QE: remove PPCisms for QE

Quoted 4 lines · Zhao Qiang

QE was supported on PowerPC, and dependent on PPC, Now it is supported on other platforms. so remove PPCisms.

That's the same (wrong) patch. See my reply to 4/4 in your other series.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
author maintainer
#4 lore raw

PATCH 4/8 irqchip/qeic: move qeic driver from drivers/soc/fsl/qe

In reply to Zhao Qiang

move the driver from drivers/soc/fsl/qe to drivers/irqchip, merge qe_ic.h and qe_ic.c into irq-qeic.c.

---
 drivers/irqchip/Makefile    |   1 +
 drivers/irqchip/irq-qeic.c  | 601 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/soc/fsl/qe/Makefile |   2 +-
 drivers/soc/fsl/qe/qe_ic.c  | 512 -------------------------------------
 drivers/soc/fsl/qe/qe_ic.h  | 103 --------
 5 files changed, 603 insertions(+), 616 deletions(-)
 create mode 100644 drivers/irqchip/irq-qeic.c
 delete mode 100644 drivers/soc/fsl/qe/qe_ic.c
 delete mode 100644 drivers/soc/fsl/qe/qe_ic.h
drivers/irqchip/Makefile +1 -0
index 0e55d94..627c5d6 100644
@@ -75,3 +75,4 @@ obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
 obj-$(CONFIG_EZNPS_GIC)			+= irq-eznps.o
 obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o
 obj-$(CONFIG_STM32_EXTI) 		+= irq-stm32-exti.o
+obj-$(CONFIG_QUICC_ENGINE)		+= irq-qeic.o
drivers/irqchip/irq-qeic.c new file +601 -0

601 lines not on this page · raw message

drivers/soc/fsl/qe/Makefile +1 -1
index 2031d38..51e4726 100644
@@ -1,7 +1,7 @@
 #
 # Makefile for the linux ppc-specific parts of QE
 #
-obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_common.o qe_ic.o qe_io.o
+obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_common.o qe_io.o
 obj-$(CONFIG_CPM)	+= qe_common.o
 obj-$(CONFIG_UCC)	+= ucc.o
 obj-$(CONFIG_UCC_SLOW)	+= ucc_slow.o
drivers/soc/fsl/qe/qe_ic.c deleted +0 -512

512 lines not on this page · raw message

drivers/soc/fsl/qe/qe_ic.h deleted +0 -103

103 lines not on this page · raw message

Signature · 1 line
2.1.0.27.g96db324
#5 lore raw

Re: [PATCH 4/8] irqchip/qeic: move qeic driver from drivers/soc/fsl/qe

Quoted 4 lines · Zhao Qiang

move the driver from drivers/soc/fsl/qe to drivers/irqchip, merge qe_ic.h and qe_ic.c into irq-qeic.c.

Quoted 10 lines
---
 drivers/irqchip/Makefile    |   1 +
 drivers/irqchip/irq-qeic.c  | 601 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/soc/fsl/qe/Makefile |   2 +-
 drivers/soc/fsl/qe/qe_ic.c  | 512 -------------------------------------
 drivers/soc/fsl/qe/qe_ic.h  | 103 --------
 5 files changed, 603 insertions(+), 616 deletions(-)
 create mode 100644 drivers/irqchip/irq-qeic.c
 delete mode 100644 drivers/soc/fsl/qe/qe_ic.c
 delete mode 100644 drivers/soc/fsl/qe/qe_ic.h

So that's where this is hiding. Next time, please send one consistent series, not something that is spanned across two series with no indication of the dependency.

Quoted 134 lines
drivers/irqchip/Makefile +1 -0
index 0e55d94..627c5d6 100644
@@ -75,3 +75,4 @@ obj-$(CONFIG_LS_SCFG_MSI)		+= irq-ls-scfg-msi.o
 obj-$(CONFIG_EZNPS_GIC)			+= irq-eznps.o
 obj-$(CONFIG_ARCH_ASPEED)		+= irq-aspeed-vic.o
 obj-$(CONFIG_STM32_EXTI) 		+= irq-stm32-exti.o
+obj-$(CONFIG_QUICC_ENGINE)		+= irq-qeic.o
drivers/irqchip/irq-qeic.c new file +118 -0
new file mode 100644
index 0000000..48ceded
@@ -0,0 +1,601 @@
+/*
+ * drivers/irqchip/irq-qeic.c
+ *
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.  All rights reserved.
+ *
+ * Author: Li Yang <[email protected]>
+ * Based on code from Shlomi Gridish <[email protected]>
+ *
+ * QUICC ENGINE Interrupt Controller
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/slab.h>
+#include <linux/stddef.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/device.h>
+#include <linux/spinlock.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+#include <soc/fsl/qe/qe_ic.h>
+
+#define NR_QE_IC_INTS		64
+
+/* QE IC registers offset */
+#define QEIC_CICR		0x00
+#define QEIC_CIVEC		0x04
+#define QEIC_CRIPNR		0x08
+#define QEIC_CIPNR		0x0c
+#define QEIC_CIPXCC		0x10
+#define QEIC_CIPYCC		0x14
+#define QEIC_CIPWCC		0x18
+#define QEIC_CIPZCC		0x1c
+#define QEIC_CIMR		0x20
+#define QEIC_CRIMR		0x24
+#define QEIC_CICNR		0x28
+#define QEIC_CIPRTA		0x30
+#define QEIC_CIPRTB		0x34
+#define QEIC_CRICR		0x3c
+#define QEIC_CHIVEC		0x60
+
+/* Interrupt priority registers */
+#define CIPCC_SHIFT_PRI0	29
+#define CIPCC_SHIFT_PRI1	26
+#define CIPCC_SHIFT_PRI2	23
+#define CIPCC_SHIFT_PRI3	20
+#define CIPCC_SHIFT_PRI4	13
+#define CIPCC_SHIFT_PRI5	10
+#define CIPCC_SHIFT_PRI6	7
+#define CIPCC_SHIFT_PRI7	4
+
+/* CICR priority modes */
+#define CICR_GWCC		0x00040000
+#define CICR_GXCC		0x00020000
+#define CICR_GYCC		0x00010000
+#define CICR_GZCC		0x00080000
+#define CICR_GRTA		0x00200000
+#define CICR_GRTB		0x00400000
+#define CICR_HPIT_SHIFT		8
+#define CICR_HPIT_MASK		0x00000300
+#define CICR_HP_SHIFT		24
+#define CICR_HP_MASK		0x3f000000
+
+/* CICNR */
+#define CICNR_WCC1T_SHIFT	20
+#define CICNR_ZCC1T_SHIFT	28
+#define CICNR_YCC1T_SHIFT	12
+#define CICNR_XCC1T_SHIFT	4
+
+/* CRICR */
+#define CRICR_RTA1T_SHIFT	20
+#define CRICR_RTB1T_SHIFT	28
+
+/* Signal indicator */
+#define SIGNAL_MASK		3
+#define SIGNAL_HIGH		2
+#define SIGNAL_LOW		0
+
+struct qe_ic {
+	/* Control registers offset */
+	volatile u32 __iomem *regs;
+
+	/* The remapper for this QEIC */
+	struct irq_domain *irqhost;
+
+	/* The "linux" controller struct */
+	struct irq_chip hc_irq;
+
+	/* VIRQ numbers of QE high/low irqs */
+	unsigned int virq_high;
+	unsigned int virq_low;
+};
+
+/*
+ * QE interrupt controller internal structure
+ */
+struct qe_ic_info {
+	/* location of this source at the QIMR register. */
+	u32	mask;
+
+	/* Mask register offset */
+	u32	mask_reg;
+
+	/*
+	 * for grouped interrupts sources - the interrupt
+	 * code as appears at the group priority register
+	 */
+	u8	pri_code;

drivers/irqchip/irq-qeic.c line 128

Quoted 10 lines
drivers/irqchip/irq-qeic.c new file +10 -0
+
+	/* Group priority register offset */
+	u32	pri_reg;
+};
+
+static DEFINE_RAW_SPINLOCK(qe_ic_lock);
+
+static struct qe_ic_info qe_ic_info[] = {
+	[1] = {
+	       .mask = 0x00008000,

Please write those single-bit constants as BIT(x), as it makes the code much more readable.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#6 lore raw
In reply to Zhao Qiang
Quoted 5 lines · Zhao Qiang
---
 arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts | 16 ++++++
 arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi    | 66 +++++++++++++++++++++++
 2 files changed, 82 insertions(+)

This patch needs to gain a commit log, and be sent (together with the following one) to armsoc, as they deal with the platform DT files.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
author maintainer
#7 lore raw
Quoted 13 lines · Marc Zyngier

-----Original Message-----
From: Marc Zyngier [mailto:[email protected]]
Sent: Friday, November 03, 2017 7:07 PM
To: Qiang Zhao <[email protected]>; [email protected]; [email protected]
Cc: [email protected]
Subject: Re: [PATCH 1/8] ls1043ardb: add qe node to ls1043ardb

Quoted 4 lines · Zhao Qiang
---
 arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dts | 16 ++++++
 arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi    | 66
Quoted 6 lines

+++++++++++++++++++++++

Quoted 1 line
 2 files changed, 82 insertions(+)

This patch needs to gain a commit log, and be sent (together with the following one) to armsoc, as they deal with the platform DT files.

Sorry, This patchset has been superseded.

Best Regards
Qiang Zhao