Skip to contentSkip to conversation

Few more patches for Kumar's powerpc.git

PATCH Superseded Anton Vorontsov 6 participants 25 messages Apr 17, 2008 – Apr 18, 2008

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Few more patches for Kumar's powerpc.git

Hello Kumar,

Here is respin of my pending patches.

I have bunch of others, but they depend on the drivers which I'm going to send for the merge after OF GPIO will hit Linus' tree (otherwise respective subsystem maintainers will fail even to compile-test these drivers). Given that, in worst case, I'm afraid I'll have to try to break merge window rules, or keep the patches for the next one.

Though, I hope tomorrow I'll send patch that adds new driver's (MCU, GPIO LEDs, USB FHCI, UPM NAND) bindings to the booting-without-of.txt, so subsystem maintainers won't have to bother with PowerPC bits.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#1 lore raw

PATCH 1/5 sysdev: implement FSL GTM support

GTM stands for General-purpose Timers Module and able to generate timer{1,2,3,4} interrupts. These timers are used by the drivers that need time precise interrupts (like for USB transactions scheduling for the Freescale USB Host controller as found in some QE and CPM chips), or these timers could be used as wakeup events from the CPU deep-sleep mode.

Things unimplemented:
1. Cascaded (32 bit) timers (1-2, 3-4).
This is straightforward to implement when needed, two timers should be marked as "requested" and configured as appropriate.
2. Super-cascaded (64 bit) timers (1-2-3-4).
This is also straightforward to implement when needed, all timers should be marked as "requested" and configured as appropriate.

---
 Documentation/powerpc/booting-without-of.txt |   32 +++-
 arch/powerpc/Kconfig                         |    5 +
 arch/powerpc/sysdev/Makefile                 |    1 +
 arch/powerpc/sysdev/fsl_gtm.c                |  362 ++++++++++++++++++++++++++
 include/asm-powerpc/fsl_gtm.h                |  108 ++++++++
 5 files changed, 507 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/sysdev/fsl_gtm.c
 create mode 100644 include/asm-powerpc/fsl_gtm.h
Documentation/powerpc/booting-without-of.txt +31 -1
index 4cc7800..827b630 100644
@@ -57,7 +57,8 @@ Table of Contents
       n) 4xx/Axon EMAC ethernet nodes
       o) Xilinx IP cores
       p) Freescale Synchronous Serial Interface
-	  q) USB EHCI controllers
+      q) USB EHCI controllers
+      r) Freescale General-purpose Timers Module
 
   VII - Marvell Discovery mv64[345]6x System Controller chips
     1) The /system-controller node
@@ -2825,6 +2826,35 @@ platforms are moved over to use the flattened-device-tree model.
 		   big-endian;
 	   };
 
+    r) Freescale General-purpose Timers Module
+
+    Required properties:
+      - compatible : should be "fsl,gtm" ("fsl,qe-gtm" in addition for QE
+                     GTMs or "fsl,cpm2-gtm" for CPM2 GTMs).
+      - reg : should contain gtm registers location and length (0x40).
+      - interrupts : should contain four interrupts.
+      - interrupt-parent : interrupt source phandle.
+      - clock-frequency : specifies the frequency driving the timer.
+
+    Example:
+
+    timer@500 {
+    	compatible = "fsl,gtm";
+    	reg = <0x500 0x40>;
+    	interrupts = <90 8 78 8 84 8 72 8>;
+    	interrupt-parent = <&ipic>;
+    	/* filled by u-boot */
+    	clock-frequency = <0>;
+    };
+
+    timer@440 {
+    	compatible = "fsl,qe-gtm", "fsl,gtm";
+    	reg = <0x440 0x40>;
+    	interrupts = <12 13 14 15>;
+    	interrupt-parent = <&qeic>;
+    	/* filled by u-boot */
+    	clock-frequency = <0>;
+    };
 
 VII - Marvell Discovery mv64[345]6x System Controller chips
 ===========================================================
arch/powerpc/Kconfig +5 -0
index 7f2f126..ad874e4 100644
@@ -525,6 +525,11 @@ config FSL_LBC
 	help
 	  Freescale Localbus support
 
+config FSL_GTM
+	bool
+	help
+	  Freescale General-purpose Timers support
+
 # Yes MCA RS/6000s exist but Linux-PPC does not currently support any
 config MCA
 	bool
arch/powerpc/sysdev/Makefile +1 -0
index 6d386d0..9d3ddd2 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_MMIO_NVRAM)	+= mmio_nvram.o
 obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
 obj-$(CONFIG_FSL_PCI)		+= fsl_pci.o
 obj-$(CONFIG_FSL_LBC)		+= fsl_lbc.o
+obj-$(CONFIG_FSL_GTM)		+= fsl_gtm.o
 obj-$(CONFIG_RAPIDIO)		+= fsl_rio.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
 obj-$(CONFIG_QUICC_ENGINE)	+= qe_lib/
arch/powerpc/sysdev/fsl_gtm.c new file +362 -0

362 lines not on this page · raw message

include/asm-powerpc/fsl_gtm.h new file +108 -0

108 lines not on this page · raw message

Signature · 1 line
1.5.5
#5 lore raw

PATCH 2/5 QE: add support for QE USB clocks routing

In reply to Anton Vorontsov

This patch adds a function to the qe_lib to setup QE USB clocks routing. To setup clocks safely, cmxgcr register needs locking, so I just reused ucc_lock since it was used only to protect cmxgcr.

The idea behind placing clocks routing functions into the qe_lib is that later we'll hopefully switch to the generic Linux Clock API, thus, for example, FHCI driver may be used for QE and CPM chips without nasty #ifdefs.

This patch also fixes QE_USB_RESTART_TX command definition in the qe.h.

---
 arch/powerpc/sysdev/qe_lib/Kconfig  |    4 ++
 arch/powerpc/sysdev/qe_lib/Makefile |    1 +
 arch/powerpc/sysdev/qe_lib/ucc.c    |    7 ++--
 arch/powerpc/sysdev/qe_lib/usb.c    |   57 +++++++++++++++++++++++++++++++++++
 include/asm-powerpc/qe.h            |   18 ++++++++++-
 5 files changed, 83 insertions(+), 4 deletions(-)
 create mode 100644 arch/powerpc/sysdev/qe_lib/usb.c
arch/powerpc/sysdev/qe_lib/Kconfig +4 -0
index adc6621..76ffbc4 100644
@@ -20,3 +20,7 @@ config UCC
 	bool
 	default y if UCC_FAST || UCC_SLOW
 
+config QE_USB
+	bool
+	help
+	  QE USB Host Controller support
arch/powerpc/sysdev/qe_lib/Makefile +1 -0
index 874fe1a..e9ff888 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_ic.o qe_io.o
 obj-$(CONFIG_UCC)	+= ucc.o
 obj-$(CONFIG_UCC_SLOW)	+= ucc_slow.o
 obj-$(CONFIG_UCC_FAST)	+= ucc_fast.o
+obj-$(CONFIG_QE_USB)	+= usb.o
arch/powerpc/sysdev/qe_lib/ucc.c +4 -3
index 0e348d9..d3c7f5a 100644
@@ -26,7 +26,8 @@
 #include <asm/qe.h>
 #include <asm/ucc.h>
 
-static DEFINE_SPINLOCK(ucc_lock);
+DEFINE_SPINLOCK(cmxgcr_lock);
+EXPORT_SYMBOL(cmxgcr_lock);
 
 int ucc_set_qe_mux_mii_mng(unsigned int ucc_num)
 {
@@ -35,10 +36,10 @@ int ucc_set_qe_mux_mii_mng(unsigned int ucc_num)
 	if (ucc_num > UCC_MAX_NUM - 1)
 		return -EINVAL;
 
-	spin_lock_irqsave(&ucc_lock, flags);
+	spin_lock_irqsave(&cmxgcr_lock, flags);
 	clrsetbits_be32(&qe_immr->qmx.cmxgcr, QE_CMXGCR_MII_ENET_MNG,
 		ucc_num << QE_CMXGCR_MII_ENET_MNG_SHIFT);
-	spin_unlock_irqrestore(&ucc_lock, flags);
+	spin_unlock_irqrestore(&cmxgcr_lock, flags);
 
 	return 0;
 }
arch/powerpc/sysdev/qe_lib/usb.c new file +57 -0

57 lines not on this page · raw message

include/asm-powerpc/qe.h +17 -1
index c3be6e2..3276b06 100644
@@ -16,6 +16,7 @@
 #define _ASM_POWERPC_QE_H
 #ifdef __KERNEL__
 
+#include <linux/spinlock.h>
 #include <asm/immap_qe.h>
 
 #define QE_NUM_OF_SNUM	28
@@ -74,6 +75,8 @@ enum qe_clock {
 	QE_CLK_DUMMY
 };
 
+extern spinlock_t cmxgcr_lock;
+
 /* Export QE common operations */
 extern void qe_reset(void);
 extern int par_io_init(struct device_node *np);
@@ -156,6 +159,9 @@ int qe_upload_firmware(const struct qe_firmware *firmware);
 /* Obtain information on the uploaded firmware */
 struct qe_firmware_info *qe_get_firmware_info(void);
 
+/* QE USB */
+int qe_usb_clock_set(enum qe_clock clk, int rate);
+
 /* Buffer descriptors */
 struct qe_bd {
 	__be16 status;
@@ -254,6 +260,16 @@ enum comm_dir {
 #define QE_CMXGCR_MII_ENET_MNG		0x00007000
 #define QE_CMXGCR_MII_ENET_MNG_SHIFT	12
 #define QE_CMXGCR_USBCS			0x0000000f
+#define QE_CMXGCR_USBCS_CLK3		0x1
+#define QE_CMXGCR_USBCS_CLK5		0x2
+#define QE_CMXGCR_USBCS_CLK7		0x3
+#define QE_CMXGCR_USBCS_CLK9		0x4
+#define QE_CMXGCR_USBCS_CLK13		0x5
+#define QE_CMXGCR_USBCS_CLK17		0x6
+#define QE_CMXGCR_USBCS_CLK19		0x7
+#define QE_CMXGCR_USBCS_CLK21		0x8
+#define QE_CMXGCR_USBCS_BRG9		0x9
+#define QE_CMXGCR_USBCS_BRG10		0xa
 
 /* QE CECR Commands.
 */
@@ -283,7 +299,7 @@ enum comm_dir {
 #define QE_HPAC_START_TX		0x0000060b
 #define QE_HPAC_START_RX		0x0000070b
 #define QE_USB_STOP_TX			0x0000000a
-#define QE_USB_RESTART_TX		0x0000000b
+#define QE_USB_RESTART_TX		0x0000000c
 #define QE_QMC_STOP_TX			0x0000000c
 #define QE_QMC_STOP_RX			0x0000000d
 #define QE_SS7_SU_FIL_RESET		0x0000000e
Signature · 1 line
1.5.5
#17 lore raw

PATCH 3/5 QE: split par_io_config_pin()

In reply to Anton Vorontsov

This patch splits par_io_config_pin so we can use it with GPIO LIB API.

Also add a comment regarding #ifdef CONFIG_PPC_85xx being legacy.

---
 arch/powerpc/sysdev/qe_lib/qe_io.c |   60 +++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 21 deletions(-)
arch/powerpc/sysdev/qe_lib/qe_io.c +39 -21
index 93916a4..a3f9c3f 100644
@@ -38,6 +38,10 @@ struct port_regs {
 	__be32	cppar1;		/* Pin assignment register */
 	__be32	cppar2;		/* Pin assignment register */
 #ifdef CONFIG_PPC_85xx
+	/*
+	 * This is needed for legacy support only, should go away,
+	 * because we started using per-bank gpio chips.
+	 */
 	u8	pad[8];
 #endif
 };
@@ -64,28 +68,29 @@ int par_io_init(struct device_node *np)
 	return 0;
 }
 
-int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
-		      int assignment, int has_irq)
+static void __par_io_config_pin(struct port_regs __iomem *par_io,
+				u8 pin, int dir, int open_drain,
+				int assignment, int has_irq)
 {
-	u32 pin_mask1bit, pin_mask2bits, new_mask2bits, tmp_val;
-
-	if (!par_io)
-		return -1;
+	u32 pin_mask1bit;
+	u32 pin_mask2bits;
+	u32 new_mask2bits;
+	u32 tmp_val;
 
 	/* calculate pin location for single and 2 bits information */
 	pin_mask1bit = (u32) (1 << (NUM_OF_PINS - (pin + 1)));
 
 	/* Set open drain, if required */
-	tmp_val = in_be32(&par_io[port].cpodr);
+	tmp_val = in_be32(&par_io->cpodr);
 	if (open_drain)
-		out_be32(&par_io[port].cpodr, pin_mask1bit | tmp_val);
+		out_be32(&par_io->cpodr, pin_mask1bit | tmp_val);
 	else
-		out_be32(&par_io[port].cpodr, ~pin_mask1bit & tmp_val);
+		out_be32(&par_io->cpodr, ~pin_mask1bit & tmp_val);
 
 	/* define direction */
 	tmp_val = (pin > (NUM_OF_PINS / 2) - 1) ?
-		in_be32(&par_io[port].cpdir2) :
-		in_be32(&par_io[port].cpdir1);
+		in_be32(&par_io->cpdir2) :
+		in_be32(&par_io->cpdir1);
 
 	/* get all bits mask for 2 bit per port */
 	pin_mask2bits = (u32) (0x3 << (NUM_OF_PINS -
@@ -97,36 +102,49 @@ int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
 
 	/* clear and set 2 bits mask */
 	if (pin > (NUM_OF_PINS / 2) - 1) {
-		out_be32(&par_io[port].cpdir2,
+		out_be32(&par_io->cpdir2,
 			 ~pin_mask2bits & tmp_val);
 		tmp_val &= ~pin_mask2bits;
-		out_be32(&par_io[port].cpdir2, new_mask2bits | tmp_val);
+		out_be32(&par_io->cpdir2, new_mask2bits | tmp_val);
 	} else {
-		out_be32(&par_io[port].cpdir1,
+		out_be32(&par_io->cpdir1,
 			 ~pin_mask2bits & tmp_val);
 		tmp_val &= ~pin_mask2bits;
-		out_be32(&par_io[port].cpdir1, new_mask2bits | tmp_val);
+		out_be32(&par_io->cpdir1, new_mask2bits | tmp_val);
 	}
 	/* define pin assignment */
 	tmp_val = (pin > (NUM_OF_PINS / 2) - 1) ?
-		in_be32(&par_io[port].cppar2) :
-		in_be32(&par_io[port].cppar1);
+		in_be32(&par_io->cppar2) :
+		in_be32(&par_io->cppar1);
 
 	new_mask2bits = (u32) (assignment << (NUM_OF_PINS -
 			(pin % (NUM_OF_PINS / 2) + 1) * 2));
 	/* clear and set 2 bits mask */
 	if (pin > (NUM_OF_PINS / 2) - 1) {
-		out_be32(&par_io[port].cppar2,
+		out_be32(&par_io->cppar2,
 			 ~pin_mask2bits & tmp_val);
 		tmp_val &= ~pin_mask2bits;
-		out_be32(&par_io[port].cppar2, new_mask2bits | tmp_val);
+		out_be32(&par_io->cppar2, new_mask2bits | tmp_val);
 	} else {
-		out_be32(&par_io[port].cppar1,
+		out_be32(&par_io->cppar1,
 			 ~pin_mask2bits & tmp_val);
 		tmp_val &= ~pin_mask2bits;
-		out_be32(&par_io[port].cppar1, new_mask2bits | tmp_val);
+		out_be32(&par_io->cppar1, new_mask2bits | tmp_val);
 	}
+}
+
+/*
+ * This is "legacy" function that takes port number as an argument
+ * instead of pointer to the appropriate bank.
+ */
+int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
+		      int assignment, int has_irq)
+{
+	if (!par_io || port >= num_par_io_ports)
+		return -EINVAL;
 
+	__par_io_config_pin(&par_io[port], pin, dir, open_drain, assignment,
+			    has_irq);
 	return 0;
 }
 EXPORT_SYMBOL(par_io_config_pin);
Signature · 1 line
1.5.5
#20 lore raw

PATCH 4/5 QE: implement support for the GPIO LIB API

In reply to Anton Vorontsov

This is needed to access QE GPIOs via Linux GPIO API.

---
 Documentation/powerpc/booting-without-of.txt |   34 ++++---
 arch/powerpc/platforms/Kconfig               |    2 +
 arch/powerpc/sysdev/qe_lib/qe_io.c           |  137 +++++++++++++++++++++++++-
 3 files changed, 159 insertions(+), 14 deletions(-)
Documentation/powerpc/booting-without-of.txt +20 -12
index 827b630..5c9cfab 100644
@@ -1721,24 +1721,32 @@ platforms are moved over to use the flattened-device-tree model.
    information.
 
    Required properties:
-   - device_type : should be "par_io".
+   - #gpio-cells : should be "2".
+   - compatible : should be "fsl,qe-pario-bank-<bank>", "fsl,qe-pario-bank"
    - reg : offset to the register set and its length.
-   - num-ports : number of Parallel I/O ports
+   - gpio-controller : node to identify gpio controllers.
 
-   Example:
-	par_io@1400 {
-		reg = <1400 100>;
-		#address-cells = <1>;
-		#size-cells = <0>;
-		device_type = "par_io";
-		num-ports = <7>;
-		ucc_pin@01 {
-			......
-		};
+   For example, two QE Par I/O banks:
+	qe_pio_a: gpio-controller@1400 {
+		#gpio-cells = <2>;
+		compatible = "fsl,qe-pario-bank-a", "fsl,qe-pario-bank";
+		reg = <0x1400 0x18>;
+		gpio-controller;
+	};
 
+	qe_pio_e: gpio-controller@1460 {
+		#gpio-cells = <2>;
+		compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
+		reg = <0x1460 0x18>;
+		gpio-controller;
+	};
 
    vi) Pin configuration nodes
 
+   NOTE: pin configuration nodes are obsolete. Usually, their existance
+         is an evidence of the firmware shortcomings. Such fixups are
+         better handled by the Linux board file, not the device tree.
+
    Required properties:
    - linux,phandle : phandle of this node; likely referenced by a QE
      device.
arch/powerpc/platforms/Kconfig +2 -0
index f38c50b..f6eecd1 100644
@@ -270,6 +270,8 @@ config QUICC_ENGINE
 	bool
 	select PPC_LIB_RHEAP
 	select CRC32
+	select GENERIC_GPIO
+	select HAVE_GPIO_LIB
 	help
 	  The QUICC Engine (QE) is a new generation of communications
 	  coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
arch/powerpc/sysdev/qe_lib/qe_io.c +136 -1

149 lines not on this page · raw message

Signature · 1 line
1.5.5
#24 lore raw

PATCH 5/5 83xx: new board support: MPC8360E-RDK

In reply to Anton Vorontsov

This is patch adds board file, device tree, and defconfig for the new board, made by Freescale Semiconductor Inc. and Logic Product Development.

Currently supported:
1. UEC{1,2,7,4};
2. I2C;
3. SPI;
4. NS16550 serial;
5. PCI and miniPCI;
6. Intel NOR StrataFlash X16 64Mbit PC28F640P30T85;
7. Graphics controller, Fujitsu MB86277.

Not supported in this patch:
1. StMICRO NAND512W3A2BN6E, 512 Mbit (supported with FSL UPM NAND driver);
2. FHCI USB (supported with FHCI driver).
3. QE Serial UCCs (tested to not work with ucc_uart driver, reason unknown, yet);
4. ADC AD7843 (tested to work, but support via device tree depends on major SPI rework, GPIO API, etc);

---
 arch/powerpc/boot/dts/mpc836x_rdk.dts           |  394 ++++++++
 arch/powerpc/configs/83xx/mpc836x_rdk_defconfig | 1087 +++++++++++++++++++++++
 arch/powerpc/platforms/83xx/Kconfig             |    8 +
 arch/powerpc/platforms/83xx/Makefile            |    1 +
 arch/powerpc/platforms/83xx/mpc836x_rdk.c       |  106 +++
 5 files changed, 1596 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/mpc836x_rdk.dts
 create mode 100644 arch/powerpc/configs/83xx/mpc836x_rdk_defconfig
 create mode 100644 arch/powerpc/platforms/83xx/mpc836x_rdk.c
arch/powerpc/boot/dts/mpc836x_rdk.dts new file +394 -0
new file mode 100644
index 0000000..39a7dcb
@@ -0,0 +1,394 @@
+/*
+ * MPC8360E RDK Device Tree Source
+ *
+ * Copyright 2006 Freescale Semiconductor Inc.
+ * Copyright 2007-2008 MontaVista Software, Inc.
+ *
+ * Author: Anton Vorontsov <[email protected]>
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "fsl,mpc8360rdk";
+
+	aliases {
+		serial0 = &serial0;
+		serial1 = &serial1;
+		serial2 = &serial2;
+		serial3 = &serial3;
+		ethernet0 = &enet0;
+		ethernet1 = &enet1;
+		ethernet2 = &enet2;
+		ethernet3 = &enet3;
+		pci0 = &pci0;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		PowerPC,8360@0 {
+			device_type = "cpu";
+			reg = <0>;
+			d-cache-line-size = <32>;
+			i-cache-line-size = <32>;
+			d-cache-size = <32768>;
+			i-cache-size = <32768>;
+			/* filled by u-boot */
+			timebase-frequency = <0>;
+			bus-frequency = <0>;
+			clock-frequency = <0>;
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		/* filled by u-boot */
+		reg = <0 0>;
+	};
+
+	soc@e0000000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		device_type = "soc";
+		compatible = "fsl,mpc8360-immr", "fsl,immr", "fsl,soc",
+			     "simple-bus";
+		ranges = <0 0xe0000000 0x200000>;
+		reg = <0xe0000000 0x200>;
+		/* filled by u-boot */
+		bus-frequency = <0>;
+
+		wdt@200 {
+			compatible = "mpc83xx_wdt";
+			reg = <0x200 0x100>;
+		};
+
+		i2c@3000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <0>;
+			compatible = "fsl-i2c";
+			reg = <0x3000 0x100>;
+			interrupts = <14 8>;
+			interrupt-parent = <&ipic>;
+			dfsrr;
+		};
+
+		i2c@3100 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <1>;
+			compatible = "fsl-i2c";
+			reg = <0x3100 0x100>;
+			interrupts = <16 8>;
+			interrupt-parent = <&ipic>;
+			dfsrr;
+		};
+
+		serial0: serial@4500 {
+			device_type = "serial";
+			compatible = "ns16550";
+			reg = <0x4500 0x100>;
+			interrupts = <9 8>;
+			interrupt-parent = <&ipic>;
+			/* filled by u-boot */
+			clock-frequency = <0>;
+		};
+
+		serial1: serial@4600 {
+			device_type = "serial";
+			compatible = "ns16550";
+			reg = <0x4600 0x100>;
+			interrupts = <10 8>;
+			interrupt-parent = <&ipic>;
+			/* filled by u-boot */
+			clock-frequency = <0>;
+		};
+
+		crypto@30000 {
+			compatible = "fsl,sec2-crypto";
+			reg = <0x30000 0x10000>;
+			interrupts = <11 8>;
+			interrupt-parent = <&ipic>;
+			num-channels = <4>;
+			channel-fifo-len = <24>;
+			exec-units-mask = <0x7e>;
+			/*
+			 * desc mask is for rev1.x, we need runtime fixup
+			 * for >=2.x
+			 */
+			descriptor-types-mask = <0x1010ebf>;
+		};
+
+		ipic: interrupt-controller@700 {
+			#address-cells = <0>;
+			#interrupt-cells = <2>;
+			compatible = "fsl,pq2pro-pic", "fsl,ipic";
+			interrupt-controller;
+			reg = <0x700 0x100>;
+		};
+
+		qe_pio_b: gpio-controller@1418 {
+			#gpio-cells = <2>;
+			compatible = "fsl,qe-pario-bank";
+			reg = <0x1418 0x18>;
+			gpio-controller;
+		};
+
+		qe_pio_e: gpio-controller@1460 {
+			#gpio-cells = <2>;
+			compatible = "fsl,qe-pario-bank";
+			reg = <0x1460 0x18>;
+			gpio-controller;
+		};
+
+		qe@100000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			device_type = "qe";
+			compatible = "fsl,qe", "simple-bus";
+			ranges = <0 0x100000 0x100000>;
+			reg = <0x100000 0x480>;
+			/* filled by u-boot */
+			clock-frequency = <0>;
+			bus-frequency = <0>;
+			brg-frequency = <0>;
+
+			muram@10000 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "fsl,qe-muram", "fsl,cpm-muram";
+				ranges = <0 0x10000 0xc000>;
+
+				data-only@0 {
+					compatible = "fsl,qe-muram-data",
+						     "fsl,cpm-muram-data";
+					reg = <0 0xc000>;
+				};
+			};
+
+			timer@440 {
+				compatible = "fsl,qe-gtm", "fsl,gtm";
+				reg = <0x440 0x40>;
+				interrupts = <12 13 14 15>;
+				interrupt-parent = <&qeic>;
+				/* filled by u-boot */
+				clock-frequency = <0>;
+			};
+
+			spi@4c0 {
+				cell-index = <0>;
+				compatible = "fsl,spi";
+				reg = <0x4c0 0x40>;
+				interrupts = <2>;
+				interrupt-parent = <&qeic>;
+				mode = "cpu-qe";
+			};
+
+			spi@500 {
+				cell-index = <1>;
+				compatible = "fsl,spi";
+				reg = <0x500 0x40>;
+				interrupts = <1>;
+				interrupt-parent = <&qeic>;
+				mode = "cpu-qe";
+			};
+
+			enet0: ucc@2000 {
+				device_type = "network";
+				compatible = "ucc_geth";
+				cell-index = <1>;
+				reg = <0x2000 0x200>;
+				interrupts = <32>;
+				interrupt-parent = <&qeic>;
+				rx-clock-name = "none";
+				tx-clock-name = "clk9";
+				phy-handle = <&phy2>;
+				phy-connection-type = "rgmii-rxid";
+				/* filled by u-boot */
+				local-mac-address = [ 00 00 00 00 00 00 ];
+			};
+
+			enet1: ucc@3000 {
+				device_type = "network";
+				compatible = "ucc_geth";
+				cell-index = <2>;
+				reg = <0x3000 0x200>;
+				interrupts = <33>;
+				interrupt-parent = <&qeic>;
+				rx-clock-name = "none";
+				tx-clock-name = "clk4";
+				phy-handle = <&phy4>;
+				phy-connection-type = "rgmii-rxid";
+				/* filled by u-boot */
+				local-mac-address = [ 00 00 00 00 00 00 ];
+			};
+
+			enet2: ucc@2600 {
+				device_type = "network";
+				compatible = "ucc_geth";
+				cell-index = <7>;
+				reg = <0x2600 0x200>;
+				interrupts = <42>;
+				interrupt-parent = <&qeic>;
+				rx-clock-name = "clk20";
+				tx-clock-name = "clk19";
+				phy-handle = <&phy1>;
+				phy-connection-type = "mii";
+				/* filled by u-boot */
+				local-mac-address = [ 00 00 00 00 00 00 ];
+			};
+
+			enet3: ucc@3200 {
+				device_type = "network";
+				compatible = "ucc_geth";
+				cell-index = <4>;
+				reg = <0x3200 0x200>;
+				interrupts = <35>;
+				interrupt-parent = <&qeic>;
+				rx-clock-name = "clk8";
+				tx-clock-name = "clk7";
+				phy-handle = <&phy3>;
+				phy-connection-type = "mii";
+				/* filled by u-boot */
+				local-mac-address = [ 00 00 00 00 00 00 ];
+			};
+
+			mdio@2120 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "fsl,ucc-mdio";
+				reg = <0x2120 0x18>;
+
+				phy1: ethernet-phy@1 {
+					device_type = "ethernet-phy";
+					compatible = "national,DP83848VV";
+					reg = <1>;
+				};
+
+				phy2: ethernet-phy@2 {
+					device_type = "ethernet-phy";
+					compatible = "broadcom,BCM5481UA2KMLG";
+					reg = <2>;
+				};
+
+				phy3: ethernet-phy@3 {
+					device_type = "ethernet-phy";
+					compatible = "national,DP83848VV";
+					reg = <3>;
+				};
+
+				phy4: ethernet-phy@4 {
+					device_type = "ethernet-phy";
+					compatible = "broadcom,BCM5481UA2KMLG";
+					reg = <4>;
+				};
+			};
+
+			serial2: ucc@2400 {
+				device_type = "serial";
+				compatible = "ucc_uart";
+				reg = <0x2400 0x200>;
+				cell-index = <5>;
+				port-number = <0>;
+				rx-clock-name = "brg7";
+				tx-clock-name = "brg8";
+				interrupts = <40>;
+				interrupt-parent = <&qeic>;
+				soft-uart;
+			};
+
+			serial3: ucc@3400 {
+				device_type = "serial";
+				compatible = "ucc_uart";
+				reg = <0x3400 0x200>;
+				cell-index = <6>;
+				port-number = <1>;
+				rx-clock-name = "brg13";
+				tx-clock-name = "brg14";
+				interrupts = <41>;
+				interrupt-parent = <&qeic>;
+				soft-uart;
+			};
+
+			qeic: interrupt-controller@80 {
+				#address-cells = <0>;
+				#interrupt-cells = <1>;
+				compatible = "fsl,qe-ic";
+				interrupt-controller;
+				reg = <0x80 0x80>;
+				big-endian;
+				interrupts = <32 8 33 8>;
+				interrupt-parent = <&ipic>;
+			};
+		};
+	};
+
+	localbus@e0005000 {
+		#address-cells = <2>;
+		#size-cells = <1>;
+		compatible = "fsl,mpc8360-localbus", "fsl,pq2pro-localbus",
+			     "simple-bus";
+		reg = <0xe0005000 0xd8>;
+		ranges = <0 0 0xff800000 0x0800000
+			  1 0 0x60000000 0x0001000
+			  2 0 0x70000000 0x4000000>;
+
+		flash@0,0 {
+			compatible = "intel,PC28F640P30T85", "cfi-flash";
+			reg = <0 0 0x800000>;
+			bank-width = <2>;
+			device-width = <1>;
+		};
+
+		display@2,0 {
+			device_type = "display";
+			compatible = "fujitsu,MB86277", "fujitsu,mint";
+			reg = <2 0 0x4000000>;
+			fujitsu,sh3;
+			little-endian;
+			/* filled by u-boot */
+			address = <0>;
+			depth = <0>;
+			width = <0>;
+			height = <0>;
+			linebytes = <0>;
+			/* linux,opened; - added by uboot */
+		};
+	};
+
+	pci0: pci@e0008500 {
+		#address-cells = <3>;
+		#size-cells = <2>;
+		#interrupt-cells = <1>;
+		device_type = "pci";
+		compatible = "fsl,mpc8360-pci", "fsl,mpc8349-pci";
+		reg = <0xe0008500 0x100>;
+		ranges = <0x02000000 0 0x90000000 0x90000000 0 0x10000000
+			  0x42000000 0 0x80000000 0x80000000 0 0x10000000
+			  0x01000000 0 0xe0300000 0xe0300000 0 0x00100000>;
+		interrupts = <66 8>;
+		interrupt-parent = <&ipic>;
+		interrupt-map-mask = <0xf800 0 0 7>;
+		interrupt-map = </* miniPCI0 IDSEL 0x14 AD20 */
+				 0xa000 0 0 1 &ipic 18 8
+				 0xa000 0 0 2 &ipic 19 8
+
+				 /* PCI1 IDSEL 0x15 AD21 */
+				 0xa800 0 0 1 &ipic 19 8
+				 0xa800 0 0 2 &ipic 20 8
+				 0xa800 0 0 3 &ipic 21 8
+				 0xa800 0 0 4 &ipic 18 8>;
+		/* filled by u-boot */
+		bus-range = <0 0>;
+		clock-frequency = <0>;
+	};
+};
arch/powerpc/configs/83xx/mpc836x_rdk_defconfig new file +1087 -0

1,087 lines not on this page · raw message

arch/powerpc/platforms/83xx/Kconfig +8 -0
index 13587e2..a5f72bb 100644
@@ -58,6 +58,14 @@ config MPC836x_MDS
 	help
 	  This option enables support for the MPC836x MDS Processor Board.
 
+config MPC836x_RDK
+	bool "Freescale/Logic MPC836x RDK"
+	select DEFAULT_UIMAGE
+	select QUICC_ENGINE
+	help
+	  This option enables support for the MPC836x RDK Processor Board,
+	  also known as ZOOM PowerQUICC Kit.
+
 config MPC837x_MDS
 	bool "Freescale MPC837x MDS"
 	select DEFAULT_UIMAGE
arch/powerpc/platforms/83xx/Makefile +1 -0
index 7e6dd3e..1fcda8e 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_MPC832x_RDB)	+= mpc832x_rdb.o
 obj-$(CONFIG_MPC834x_MDS)	+= mpc834x_mds.o
 obj-$(CONFIG_MPC834x_ITX)	+= mpc834x_itx.o
 obj-$(CONFIG_MPC836x_MDS)	+= mpc836x_mds.o
+obj-$(CONFIG_MPC836x_RDK)	+= mpc836x_rdk.o
 obj-$(CONFIG_MPC832x_MDS)	+= mpc832x_mds.o
 obj-$(CONFIG_MPC837x_MDS)	+= mpc837x_mds.o
 obj-$(CONFIG_SBC834x)		+= sbc834x.o
arch/powerpc/platforms/83xx/mpc836x_rdk.c new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
1.5.5
#6 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

In reply to Anton Vorontsov

arch/powerpc/sysdev/qe_lib/Kconfig config UCC · line 26

Quoted 4 lines · Anton Vorontsov
arch/powerpc/sysdev/qe_lib/Kconfig +4 -0
+config QE_USB
+	bool
+	help
+	  QE USB Host Controller support

Don't you need something like "depends on USB"? I would assume that you need core USB support before any USB drivers can be loaded.

arch/powerpc/sysdev/qe_lib/usb.c line 5

Quoted 8 lines
arch/powerpc/sysdev/qe_lib/usb.c new file +5 -0
@@ -0,0 +1,57 @@
+/*
+ * QE USB routines
+ *
+ * Copyright (c) Freescale Semicondutor, Inc. 2006.
+ *               Shlomi Gridish <[email protected]>

Is this code from one of our BSPs?

arch/powerpc/sysdev/qe_lib/usb.c line 27

Quoted 5 lines
arch/powerpc/sysdev/qe_lib/usb.c new file +5 -0
+int qe_usb_clock_set(enum qe_clock clk, int rate)
+{
+	struct qe_mux __iomem *mux = &qe_immr->qmx;
+	unsigned long flags;
+	const bool is_brg = clk < QE_CLK1;

You don't really need "is_brg", since it's only used once.

arch/powerpc/sysdev/qe_lib/usb.c line 51

Quoted 3 lines
arch/powerpc/sysdev/qe_lib/usb.c new file +3 -0
+	spin_lock_irqsave(&cmxgcr_lock, flags);
+
+	clrsetbits_be32(&mux->cmxgcr, QE_CMXGCR_USBCS, val);

Would it be useful if I made the clrsetbits functions atomic, using lwarx/stwcx.?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#7 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

Quoted 5 lines · Timur Tabi

arch/powerpc/sysdev/qe_lib/usb.c line 51

Quoted 3 lines
arch/powerpc/sysdev/qe_lib/usb.c new file +3 -0
+	spin_lock_irqsave(&cmxgcr_lock, flags);
+
+	clrsetbits_be32(&mux->cmxgcr, QE_CMXGCR_USBCS, val);

Would it be useful if I made the clrsetbits functions atomic, using lwarx/stwcx.?

No. clrsetbits operates on I/O registers, not RAM.

-Scott

#8 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

Quoted 1 line · Scott Wood

No. clrsetbits operates on I/O registers, not RAM.

Does lwarx require the EA to be cached memory or something? The reservation is held within the processor, so it should work on I/O.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#9 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

Quoted 5 lines · Timur Tabi
Quoted 1 line · Scott Wood

No. clrsetbits operates on I/O registers, not RAM.

Does lwarx require the EA to be cached memory or something?

That's implementation dependent, and support for accesses to uncached memory is being phased out of book E according to the E500 manual.

Quoted 1 line

The reservation is held within the processor, so it should work on I/O.

Even if the core supports lwarx/stwcx to uncached memory, the I/O bus must support atomic read-modify-write transactions for this to work.

Why do you think you need lwarx/stwcx to I/O?

-Scott

#10 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

Quoted 2 lines · Scott Wood

That's implementation dependent, and support for accesses to uncached memory is being phased out of book E according to the E500 manual.

What's wrong with uncached memory?

Quoted 4 lines
Quoted 1 line

The reservation is held within the processor, so it should work on I/O.

Even if the core supports lwarx/stwcx to uncached memory, the I/O bus must support atomic read-modify-write transactions for this to work.

Why? I thought the way that lwarx/stwcx work is that since the processor detects the reservation collision, and the processor is one doing the writes, that it would know when the reservation collided. Why does the I/O bus need to know anything?

Quoted 1 line

Why do you think you need lwarx/stwcx to I/O?

I figured that if I could use lwarx/stwcx to make clrsetbits atomic, there would be no need to spinlocks protecting an individual register.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#11 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

Quoted 5 lines · Timur Tabi
Quoted 1 line · Scott Wood

That's implementation dependent, and support for accesses to uncached memory is being phased out of book E according to the E500 manual.

What's wrong with uncached memory?

The typical implementation of lwarx/stwcx depends on holding the reserved cache line in exclusive state, and stwcx failing if it is no longer exclusive.

Quoted 2 lines

I figured that if I could use lwarx/stwcx to make clrsetbits atomic, there would be no need to spinlocks protecting an individual register.

OK, so you're not trying to be atomic with respect to the device, just with respect to other cores? Just use the spinlock.

-Scott

#12 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

In reply to Timur Tabi
Quoted 9 lines · Timur Tabi

arch/powerpc/sysdev/qe_lib/usb.c line 27

Quoted 5 lines · Anton Vorontsov
arch/powerpc/sysdev/qe_lib/usb.c new file +5 -0
+int qe_usb_clock_set(enum qe_clock clk, int rate)
+{
+	struct qe_mux __iomem *mux = &qe_immr->qmx;
+	unsigned long flags;
+	const bool is_brg = clk < QE_CLK1;

You don't really need "is_brg", since it's only used once.

I find "is_brg" much more meaningful than "clk < QE_CLK1".

Maybe the computer doesn't need it, but it's helpful to a reader of the code.

-Dale

#13 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

Quoted 4 lines · Dale Farnsworth

I find "is_brg" much more meaningful than "clk < QE_CLK1".

Maybe the computer doesn't need it, but it's helpful to a reader of the code.

That's what comments are for. I'm all for self-documenting code, but not creating additional code to avoid comments.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#14 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

Quoted 8 lines · Timur Tabi
Quoted 4 lines · Dale Farnsworth

I find "is_brg" much more meaningful than "clk < QE_CLK1".

Maybe the computer doesn't need it, but it's helpful to a reader of the code.

That's what comments are for. I'm all for self-documenting code, but not creating additional code to avoid comments.

Well, we disagree then. Self documenting code of this form is far preferable to comments that communicate the same thing.

-Dale

#15 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

In reply to Timur Tabi
Quoted 9 lines · Timur Tabi

arch/powerpc/sysdev/qe_lib/Kconfig config UCC · line 26

Quoted 4 lines · Anton Vorontsov
arch/powerpc/sysdev/qe_lib/Kconfig +4 -0
+config QE_USB
+	bool
+	help
+	  QE USB Host Controller support

Don't you need something like "depends on USB"? I would assume that you need core USB support before any USB drivers can be loaded.

No, I'll add there "default y if USB_HCD_FHCI", but I'll do this at the same time as USB_HCD_FHCI merges, because otherwise I would reference not existent Kconfig symbol.

Quoted 10 lines

arch/powerpc/sysdev/qe_lib/usb.c line 5

Quoted 8 lines
arch/powerpc/sysdev/qe_lib/usb.c new file +5 -0
@@ -0,0 +1,57 @@
+/*
+ * QE USB routines
+ *
+ * Copyright (c) Freescale Semicondutor, Inc. 2006.
+ *               Shlomi Gridish <[email protected]>

Is this code from one of our BSPs?

Well, it is based on. I'm not sure that there is a single line of the original code, but anyway I'd better be safe than remove someone's copyright. The same applies to FSL GTM code.

Quoted 7 lines

arch/powerpc/sysdev/qe_lib/usb.c line 27

Quoted 5 lines
arch/powerpc/sysdev/qe_lib/usb.c new file +5 -0
+int qe_usb_clock_set(enum qe_clock clk, int rate)
+{
+	struct qe_mux __iomem *mux = &qe_immr->qmx;
+	unsigned long flags;
+	const bool is_brg = clk < QE_CLK1;

You don't really need "is_brg", since it's only used once.

Hm, no. This is code that speaks. More than that, I'd prefer this in qe.h:

static inline bool qe_clock_is_brg(enum qe_clock clk)

{
	return clk < QE_CLK1;
}

:-)

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#18 lore raw

Re: [PATCH 3/5] [POWERPC] QE: split par_io_config_pin()

In reply to Anton Vorontsov
Quoted 3 lines · Anton Vorontsov

This patch splits par_io_config_pin so we can use it with GPIO LIB API.

Also add a comment regarding #ifdef CONFIG_PPC_85xx being legacy.

legacy to what?

- k

#16 lore raw

Re: [PATCH 2/5] [POWERPC] QE: add support for QE USB clocks routing

In reply to Anton Vorontsov
Quoted 4 lines · Anton Vorontsov

static inline bool qe_clock_is_brg(enum qe_clock clk)

{
	return clk < QE_CLK1;
}

I have no problem with this function (the UART driver could use it), except that your implementation is wrong. You would need to do this:

static inline bool qe_clock_is_brg(enum qe_clock clk)

{
	return (clk >= QE_BRG1) && (clk <= QE_BRG16);
}
Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#19 lore raw

Re: [PATCH 3/5] [POWERPC] QE: split par_io_config_pin()

In reply to Kumar Gala
Quoted 8 lines · Kumar Gala
Quoted 4 lines · Anton Vorontsov

This patch splits par_io_config_pin so we can use it with GPIO LIB API.

Also add a comment regarding #ifdef CONFIG_PPC_85xx being legacy.

legacy to what?

If we'll ever manage to remove pio fixups from the device tree, we then can safely remove whole par_io_of_config(struct device_node *np) along with par_io_*(u8 port, ...), which only needs this #ifdef CONFIG_PPC_85xx. Users (so far only mpc8323e-rdb IIRC) of par_io_data_set(u8 port, ...) will be converted to GPIO API.

And since device tree fixups considered legacy, I marked this code as legacy too. Am I wrong here?

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#21 lore raw

Re: [PATCH 4/5] [POWERPC] QE: implement support for the GPIO LIB API

In reply to Anton Vorontsov
Quoted 14 lines

index a3f9c3f..a4a195a 100644

arch/powerpc/sysdev/qe_lib/qe_io.c +2 -1
@@ -20,7 +20,8 @@
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
-
+#include <linux/spinlock.h>
+#include <linux/of_gpio.h>
 #include <asm/io.h>
 #include <asm/qe.h>
 #include <asm/prom.h>

arch/powerpc/sysdev/qe_lib/qe_io.c int par_io_of_config(struct device_node *np) · line 216

Quoted 2 lines
arch/powerpc/sysdev/qe_lib/qe_io.c +0 -0
@@ -214,6 +215,140 @@ int par_io_of_config(struct device_node *np)
 }
 EXPORT_SYMBOL(par_io_of_config);

can we split this out into a new file since its pretty much a driver.

Quoted 144 lines
arch/powerpc/sysdev/qe_lib/qe_io.c +134 -0
+/*
+ * GPIO LIB API implementation
+ */
+
+struct qe_gpio_chip {
+	struct of_mm_gpio_chip mm_gc;
+	spinlock_t lock;
+
+	/* shadowed data register to clear/set bits safely */
+	u32 cpdata;
+};
+
+static inline struct qe_gpio_chip *
+to_qe_gpio_chip(struct of_mm_gpio_chip *mm_gc)
+{
+	return container_of(mm_gc, struct qe_gpio_chip, mm_gc);
+}
+
+static void qe_gpio_save_regs(struct of_mm_gpio_chip *mm_gc)
+{
+	struct qe_gpio_chip *qe_gc = to_qe_gpio_chip(mm_gc);
+	struct port_regs __iomem *regs = mm_gc->regs;
+
+	qe_gc->cpdata = in_be32(&regs->cpdata);
+}
+
+static int qe_gpio_get(struct gpio_chip *gc, unsigned int gpio)
+{
+	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+	struct port_regs __iomem *regs = mm_gc->regs;
+	u32 pin_mask;
+
+	/* calculate pin location */
+	pin_mask = (u32) (1 << (NUM_OF_PINS - 1 - gpio));
+
+	return !!(in_be32(&regs->cpdata) & pin_mask);
+}
+
+static void qe_gpio_set(struct gpio_chip *gc, unsigned int gpio,  
 int val)
+{
+	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+	struct qe_gpio_chip *qe_gc = to_qe_gpio_chip(mm_gc);
+	struct port_regs __iomem *regs = mm_gc->regs;
+	unsigned long flags;
+	u32 pin_mask = 1 << (NUM_OF_PINS - 1 - gpio);
+
+	spin_lock_irqsave(&qe_gc->lock, flags);
+
+	if (val)
+		qe_gc->cpdata |= pin_mask;
+	else
+		qe_gc->cpdata &= ~pin_mask;
+
+	out_be32(&regs->cpdata, qe_gc->cpdata);
+
+	spin_unlock_irqrestore(&qe_gc->lock, flags);
+}
+
+static int qe_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
+{
+	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+	struct qe_gpio_chip *qe_gc = to_qe_gpio_chip(mm_gc);
+	unsigned long flags;
+
+	spin_lock_irqsave(&qe_gc->lock, flags);
+
+	__par_io_config_pin(mm_gc->regs, gpio, 2, 0, 0, 0);
+
+	spin_unlock_irqrestore(&qe_gc->lock, flags);
+
+	return 0;
+}
+
+static int qe_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio,  
 int val)
+{
+	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
+	struct qe_gpio_chip *qe_gc = to_qe_gpio_chip(mm_gc);
+	unsigned long flags;
+
+	spin_lock_irqsave(&qe_gc->lock, flags);
+
+	__par_io_config_pin(mm_gc->regs, gpio, 1, 0, 0, 0);
+
+	spin_unlock_irqrestore(&qe_gc->lock, flags);
+
+	qe_gpio_set(gc, gpio, val);
+
+	return 0;
+}
+
+static int __init qe_add_gpiochips(void)
+{
+	int ret;
+	struct device_node *np;
+
+	for_each_compatible_node(np, NULL, "fsl,qe-pario-bank") {
+		struct qe_gpio_chip *qe_gc;
+		struct of_mm_gpio_chip *mm_gc;
+		struct of_gpio_chip *of_gc;
+		struct gpio_chip *gc;
+
+		qe_gc = kzalloc(sizeof(*qe_gc), GFP_KERNEL);
+		if (!qe_gc) {
+			ret = -ENOMEM;
+			goto err;
+		}
+
+		spin_lock_init(&qe_gc->lock);
+
+		mm_gc = &qe_gc->mm_gc;
+		of_gc = &mm_gc->of_gc;
+		gc = &of_gc->gc;
+
+		mm_gc->save_regs = qe_gpio_save_regs;
+		of_gc->gpio_cells = 2;
+		gc->ngpio = NUM_OF_PINS;
+		gc->direction_input = qe_gpio_dir_in;
+		gc->direction_output = qe_gpio_dir_out;
+		gc->get = qe_gpio_get;
+		gc->set = qe_gpio_set;
+
+		ret = of_mm_gpiochip_add(np, mm_gc);
+		if (ret)
+			goto err;
+	}
+
+	return 0;
+err:
+	pr_err("%s: registration failed with status %d\n", np->full_name,  
 ret);
+	of_node_put(np);
+	return ret;
+}
+arch_initcall(qe_add_gpiochips);
+
 #ifdef DEBUG

static void dump_par_io(void)
{

Signature · 1 line
1.5.5
#22 lore raw

Re: [PATCH 4/5] [POWERPC] QE: implement support for the GPIO LIB API

Quoted 10 lines · Kumar Gala
Quoted 10 lines

index a3f9c3f..a4a195a 100644

arch/powerpc/sysdev/qe_lib/qe_io.c +2 -1
@@ -20,7 +20,8 @@
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
-
+#include <linux/spinlock.h>
+#include <linux/of_gpio.h>
Quoted 8 lines

arch/powerpc/sysdev/qe_lib/qe_io.c int par_io_of_config(struct device_node *np) · line 216

Quoted 6 lines
arch/powerpc/sysdev/qe_lib/qe_io.c +0 -0
 #include <asm/io.h>
 #include <asm/qe.h>
 #include <asm/prom.h>
@@ -214,6 +215,140 @@ int par_io_of_config(struct device_node *np)
 }
 EXPORT_SYMBOL(par_io_of_config);

can we split this out into a new file since its pretty much a driver.

No problem. Would you prefer this to go under drivers/gpio/ ?

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#2 lore raw

Re: [PATCH 1/5] [POWERPC] sysdev: implement FSL GTM support

In reply to Anton Vorontsov
Quoted 30 lines · Anton Vorontsov

GTM stands for General-purpose Timers Module and able to generate timer{1,2,3,4} interrupts. These timers are used by the drivers that need time precise interrupts (like for USB transactions scheduling for the Freescale USB Host controller as found in some QE and CPM chips), or these timers could be used as wakeup events from the CPU deep-sleep mode.

Things unimplemented:
1. Cascaded (32 bit) timers (1-2, 3-4).
This is straightforward to implement when needed, two timers should be marked as "requested" and configured as appropriate.
2. Super-cascaded (64 bit) timers (1-2-3-4).
This is also straightforward to implement when needed, all timers should be marked as "requested" and configured as appropriate.

---
 Documentation/powerpc/booting-without-of.txt |   32 +++-
 arch/powerpc/Kconfig                         |    5 +
 arch/powerpc/sysdev/Makefile                 |    1 +
 arch/powerpc/sysdev/fsl_gtm.c                |  362 ++++++++++++++++++++++++++
 include/asm-powerpc/fsl_gtm.h                |  108 ++++++++
 5 files changed, 507 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/sysdev/fsl_gtm.c
 create mode 100644 include/asm-powerpc/fsl_gtm.h
Documentation/powerpc/booting-without-of.txt +0 -0
index 4cc7800..827b630 100644

[...]

Quoted 13 lines
Documentation/powerpc/booting-without-of.txt +13 -0
+/**
+ * gtm_reset_timer16 - reset 16 bit timer with arbitrary precision
+ * @tmr:	pointer to the gtm_timer structure obtained from gtm_get_timer
+ * @usec:	timer interval in microseconds
+ * @reload:	if set, the timer will reset upon expiry rather than
+ *         	continue running free.
+ *
+ * This function (re)sets the GTM timer so that it counts up to the requested
+ * interval value, and fires the interrupt when the value is reached. This
+ * function will reduce the precision of the timer as needed in order for the
+ * requested timeout to fit in a 16-bit register.
+ */
+int gtm_reset_timer16(struct gtm_timer *tmr, unsigned long usec, bool reload)

Documentation/powerpc/booting-without-of.txt

Quoted 10 lines
Documentation/powerpc/booting-without-of.txt +10 -0
+{
+	/* quite obvious, frequency which is enough for µSec precision */
+	int freq = 1000000;
+	unsigned int bit;
+
+	bit = fls_long(usec);
+	if (bit > 15) {
+		freq >>= bit - 15;
+		usec >>= bit - 15;
+	}

if (!freq)

	return -EINVAL;
Quoted 3 lines
Documentation/powerpc/booting-without-of.txt +3 -0
+	return gtm_reset_ref_timer16(tmr, freq, usec, reload);
+}
+EXPORT_SYMBOL(gtm_reset_timer16);
Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#23 lore raw

Re: [PATCH 4/5] [POWERPC] QE: implement support for the GPIO LIB API

In reply to Anton Vorontsov
Quoted 20 lines · Anton Vorontsov
Quoted 10 lines · Kumar Gala
Quoted 10 lines

index a3f9c3f..a4a195a 100644

arch/powerpc/sysdev/qe_lib/qe_io.c +2 -1
@@ -20,7 +20,8 @@
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
-
+#include <linux/spinlock.h>
+#include <linux/of_gpio.h>
Quoted 8 lines

arch/powerpc/sysdev/qe_lib/qe_io.c int par_io_of_config(struct device_node *np) · line 216

Quoted 6 lines
arch/powerpc/sysdev/qe_lib/qe_io.c +0 -0
 #include <asm/io.h>
 #include <asm/qe.h>
 #include <asm/prom.h>
@@ -214,6 +215,140 @@ int par_io_of_config(struct device_node *np)
 }
 EXPORT_SYMBOL(par_io_of_config);

can we split this out into a new file since its pretty much a driver.

Quoted 1 line

No problem. Would you prefer this to go under drivers/gpio/ ?

Yes that would be better. We actively worked on pull drivers out of arch/ppc back in the day.

- k

#3 lore raw

Re: [PATCH 1/5] [POWERPC] sysdev: implement FSL GTM support

In reply to Anton Vorontsov
Quoted 50 lines · Anton Vorontsov
Quoted 36 lines · Anton Vorontsov

GTM stands for General-purpose Timers Module and able to generate timer{1,2,3,4} interrupts. These timers are used by the drivers that need time precise interrupts (like for USB transactions scheduling =20=

for
the Freescale USB Host controller as found in some QE and CPM chips), or these timers could be used as wakeup events from the CPU deep-=20 sleep
mode.

Things unimplemented:
1. Cascaded (32 bit) timers (1-2, 3-4).
This is straightforward to implement when needed, two timers should be marked as "requested" and configured as appropriate.
2. Super-cascaded (64 bit) timers (1-2-3-4).
This is also straightforward to implement when needed, all timers should be marked as "requested" and configured as appropriate.

---

Documentation/powerpc/booting-without-of.txt |   32 +++-
arch/powerpc/Kconfig                         |    5 +
arch/powerpc/sysdev/Makefile                 |    1 +
arch/powerpc/sysdev/fsl_gtm.c                |  362 ++++++++++++++++=20=

++++++++++
include/asm-powerpc/fsl_gtm.h | 108 ++++++++

5 files changed, 507 insertions(+), 1 deletions(-)

create mode 100644 arch/powerpc/sysdev/fsl_gtm.c
create mode 100644 include/asm-powerpc/fsl_gtm.h

=20 renamed from Documentation/powerpc/booting-without-of.txt +0 -0

Documentation/powerpc/booting-without-of.txt
index 4cc7800..827b630 100644

Documentation/powerpc/booting-without-of.txt +0 -0

[...]

Quoted 12 lines

+/**
+ * gtm_reset_timer16 - reset 16 bit timer with arbitrary precision
+ * @tmr: pointer to the gtm_timer structure obtained from =20
gtm_get_timer
+ * @usec: timer interval in microseconds
+ * @reload: if set, the timer will reset upon expiry rather than
+ * continue running free.
+ *
+ * This function (re)sets the GTM timer so that it counts up to =20 the requested
+ * interval value, and fires the interrupt when the value is =20 reached. This

Quoted 8 lines

Documentation/powerpc/booting-without-of.txt

Quoted 8 lines

+ * function will reduce the precision of the timer as needed in =20 order for the
+ * requested timeout to fit in a 16-bit register.
+ */
+int gtm_reset_timer16(struct gtm_timer *tmr, unsigned long usec, =20 bool reload)

Documentation/powerpc/booting-without-of.txt +2 -0
+{
+	/* quite obvious, frequency which is enough for =C2=B5Sec =

precision */

Quoted 11 lines

Documentation/powerpc/booting-without-of.txt

Quoted 8 lines
Documentation/powerpc/booting-without-of.txt +8 -0
+	int freq =3D 1000000;
+	unsigned int bit;
+
+	bit =3D fls_long(usec);
+	if (bit > 15) {
+		freq >>=3D bit - 15;
+		usec >>=3D bit - 15;
+	}

if (!freq)

	return -EINVAL;

do you want me to fix this up on commit or are you going to respin the =20=

patch set based on feedback?

- k=

#4 lore raw

Re: [PATCH 1/5] [POWERPC] sysdev: implement FSL GTM support

On Thu, Apr 17, 2008 at 11:19:39PM -0500, Kumar Gala wrote:
[...]

Quoted 22 lines
Quoted 20 lines
Quoted 8 lines

+ * interval value, and fires the interrupt when the value is reached. This
+ * function will reduce the precision of the timer as needed in order for the
+ * requested timeout to fit in a 16-bit register.
+ */
+int gtm_reset_timer16(struct gtm_timer *tmr, unsigned long usec, bool reload)

arch/powerpc/sysdev/fsl_gtm.c line 205

Quoted 10 lines
arch/powerpc/sysdev/fsl_gtm.c new file +10 -0
+{
+	/* quite obvious, frequency which is enough for µSec precision */
+	int freq = 1000000;
+	unsigned int bit;
+
+	bit = fls_long(usec);
+	if (bit > 15) {
+		freq >>= bit - 15;
+		usec >>= bit - 15;
+	}

if (!freq)

Quoted 1 line
	return -EINVAL;
Quoted 2 lines

do you want me to fix this up on commit or are you going to respin the patch set based on feedback?

I would better respin the whole thing. Will do this today.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2