Skip to contentSkip to conversation

ARM: pxa: add clk_set_rate()

PATCH New Haojian Zhuang 5 participants 25 messages Apr 1, 2011 – Jul 5, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/9 ARM: pxa: add clk_set_rate()

Since there're mulitple clock rates in some device controllers, enable clk_set_rate() for this usage.

---
 arch/arm/mach-mmp/clock.c |   15 +++++++++++++++
 arch/arm/mach-mmp/clock.h |    1 +
 arch/arm/mach-pxa/clock.c |   15 +++++++++++++++
 arch/arm/mach-pxa/clock.h |    1 +
 4 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/clock.c +15 -0
index 886e056..7c6f95f 100644
@@ -88,3 +88,18 @@ unsigned long clk_get_rate(struct clk *clk)
 	return rate;
 }
 EXPORT_SYMBOL(clk_get_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+	unsigned long flags;
+	int ret = -EINVAL;
+
+	if (clk->ops->setrate) {
+		spin_lock_irqsave(&clocks_lock, flags);
+		ret = clk->ops->setrate(clk, rate);
+		spin_unlock_irqrestore(&clocks_lock, flags);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(clk_set_rate);
arch/arm/mach-mmp/clock.h +1 -0
index 9b027d7..3143e99 100644
@@ -12,6 +12,7 @@ struct clkops {
 	void			(*enable)(struct clk *);
 	void			(*disable)(struct clk *);
 	unsigned long		(*getrate)(struct clk *);
+	int			(*setrate)(struct clk *, unsigned long);
 };
 
 struct clk {
arch/arm/mach-pxa/clock.c +15 -0
index d515222..4d46610 100644
@@ -53,6 +53,21 @@ unsigned long clk_get_rate(struct clk *clk)
 }
 EXPORT_SYMBOL(clk_get_rate);
 
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+	unsigned long flags;
+	int ret = -EINVAL;
+
+	if (clk->ops->setrate) {
+		spin_lock_irqsave(&clocks_lock, flags);
+		ret = clk->ops->setrate(clk, rate);
+		spin_unlock_irqrestore(&clocks_lock, flags);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
 void clk_dummy_enable(struct clk *clk)
 {
 }
arch/arm/mach-pxa/clock.h +1 -0
index f9f349a..7373853 100644
@@ -5,6 +5,7 @@ struct clkops {
 	void			(*enable)(struct clk *);
 	void			(*disable)(struct clk *);
 	unsigned long		(*getrate)(struct clk *);
+	int			(*setrate)(struct clk *, unsigned long);
 };
 
 struct clk {
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 2/9 ARM: pxa: enable sparsemem in saarb

Make sparsemem to support 512MB low memory with two banks in SAARB.

Change-Id I1688dde366b5f3b13b48b7167bf6b88afc4f9a92
---
 arch/arm/mach-pxa/Kconfig               |    1 +
 arch/arm/mach-pxa/include/mach/memory.h |   36 ++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/Kconfig +1 -0
index 2fc9f94..e8615ee 100644
@@ -53,6 +53,7 @@ config MACH_SAAR
 config MACH_SAARB
 	bool "PXA955 Handheld Platform (aka SAARB)"
 	select CPU_PXA955
+	select ARCH_SPARSEMEM_ENABLE
 
 comment "Third Party Dev Platforms (sorted by vendor name)"
 
arch/arm/mach-pxa/include/mach/memory.h +35 -1
index 92361a6..9a3f265 100644
@@ -3,6 +3,7 @@
  *
  * Author:	Nicolas Pitre
  * Copyright:	(C) 2001 MontaVista Software Inc.
+ * Copyright:	(C) 2010 Marvell Semiconductor Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -27,4 +28,37 @@ void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);
 #define MAX_DMA_ADDRESS		(PAGE_OFFSET + SZ_64M)
 #endif
 
-#endif
+
+#ifdef CONFIG_SPARSEMEM
+
+#if defined(CONFIG_MACH_SAARB) || defined(CONFIG_MACH_SAARB_MG1)
+/*
+ * There're two DRAM banks in PXA955 Saarb board.
+ *
+ * The macros below define sections with 256MB size and a non-linear virtual to
+ * physical mapping:
+ *
+ * node 0: 0x80000000-0x8fffffff -> 0xc0000000-0xcfffffff
+ * node 1: 0xc0000000-0xcfffffff -> 0xd0000000-0xdfffffff
+ *
+ * Since DRAM can be wrapped, 0xa0000000 equals to 0x80000000.
+ */
+#define MAX_PHYSMEM_BITS	32
+#define SECTION_SIZE_BITS	28
+
+/* bank page offsets */
+#define BANK_PAGE_OFFSET	(PAGE_OFFSET + 0x10000000)
+
+#define __phys_to_virt(phys)						\
+	((phys) >= 0xc0000000 ? (phys) - 0xc0000000 + BANK_PAGE_OFFSET :\
+	 (phys) >= 0xa0000000 ? (phys) - 0xa0000000 + PAGE_OFFSET :	\
+	 (phys) - 0x80000000 + PAGE_OFFSET)				\
+
+#define __virt_to_phys(virt)						\
+	((virt) >= BANK_PAGE_OFFSET ? (virt) - BANK_PAGE_OFFSET + 0xc0000000 :\
+	 (virt) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
+#endif	/* CONFIG_MACH_SAARB || CONFIG_MACH_SAARB_MG1 */
+
+#endif	/* CONFIG_SPARSEMEM */
+
+#endif	/* __ASM_ARCH_MEMORY_H */
Signature · 1 line
1.5.6.5
#2 lore raw

PATCH 3/9 ARM: mmp: remove redundant macro definition in mfp

There're two layers in MFP implementation. One is MFP layer that is logical pin setting. And the other is MFPR layer that is physical register setting.

MFP drive setting is different between PXA168 and PXA910. But the difference was stored in logical layer, not physical layer. And some unnecessary macro definition were added for ARCH_MMP.

---
 arch/arm/mach-mmp/include/mach/mfp-mmp2.h   |    7 +----
 arch/arm/mach-mmp/include/mach/mfp-pxa168.h |    7 +----
 arch/arm/mach-mmp/include/mach/mfp-pxa910.h |    7 +----
 arch/arm/mach-mmp/include/mach/mfp.h        |   34 ---------------------------
 arch/arm/mach-mmp/mmp2.c                    |    2 +-
 arch/arm/mach-mmp/pxa168.c                  |    2 +-
 arch/arm/mach-mmp/pxa910.c                  |    2 +-
 arch/arm/plat-pxa/include/plat/mfp.h        |    4 +++
 arch/arm/plat-pxa/mfp.c                     |   22 +++++++++++++++-
 9 files changed, 30 insertions(+), 57 deletions(-)
 delete mode 100644 arch/arm/mach-mmp/include/mach/mfp.h
arch/arm/mach-mmp/include/mach/mfp-mmp2.h +1 -6
index 4ad3862..c66eaea 100644
@@ -1,12 +1,7 @@
 #ifndef __ASM_MACH_MFP_MMP2_H
 #define __ASM_MACH_MFP_MMP2_H
 
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW	(0x0 << 13)
-#define MFP_DRIVE_SLOW		(0x2 << 13)
-#define MFP_DRIVE_MEDIUM	(0x4 << 13)
-#define MFP_DRIVE_FAST		(0x6 << 13)
+#include <plat/mfp.h>
 
 /* GPIO */
 #define GPIO0_GPIO	MFP_CFG(GPIO0, AF0)
arch/arm/mach-mmp/include/mach/mfp-pxa168.h +1 -6
index 4621067..4aadbea 100644
@@ -1,12 +1,7 @@
 #ifndef __ASM_MACH_MFP_PXA168_H
 #define __ASM_MACH_MFP_PXA168_H
 
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW	(0x0 << 13)
-#define MFP_DRIVE_SLOW		(0x1 << 13)
-#define MFP_DRIVE_MEDIUM	(0x2 << 13)
-#define MFP_DRIVE_FAST		(0x3 << 13)
+#include <plat/mfp.h>
 
 /* GPIO */
 #define GPIO0_GPIO		MFP_CFG(GPIO0, AF5)
arch/arm/mach-mmp/include/mach/mfp-pxa910.h +1 -6
index fbd7ee8..f5d33be 100644
@@ -1,12 +1,7 @@
 #ifndef __ASM_MACH_MFP_PXA910_H
 #define __ASM_MACH_MFP_PXA910_H
 
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW	(0x0 << 13)
-#define MFP_DRIVE_SLOW		(0x2 << 13)
-#define MFP_DRIVE_MEDIUM	(0x4 << 13)
-#define MFP_DRIVE_FAST		(0x6 << 13)
+#include <plat/mfp.h>
 
 /* UART2 */
 #define GPIO47_UART2_RXD	MFP_CFG(GPIO47, AF6)
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -34
deleted file mode 100644
index 62e510e..0000000
@@ -1,34 +0,0 @@
-#ifndef __ASM_MACH_MFP_H
-#define __ASM_MACH_MFP_H
-
-#include <plat/mfp.h>
-
-/*
- * NOTE: the MFPR register bit definitions on PXA168 processor lines are a
- * bit different from those on PXA3xx.  Bit [7:10] are now reserved, which
- * were SLEEP_OE_N, SLEEP_DATA, SLEEP_SEL and the LSB of DRIVE bits.
- *
- * To cope with this difference and re-use the pxa3xx mfp code as much as
- * possible, we make the following compromise:
- *
- * 1. SLEEP_OE_N will always be programmed to '1' (by MFP_LPM_FLOAT)
- * 2. DRIVE strength definitions redefined to include the reserved bit
- *    - the reserved bit differs between pxa168 and pxa910, and the
- *      MFP_DRIVE_* macros are individually defined in mfp-pxa{168,910}.h
- * 3. Override MFP_CFG() and MFP_CFG_DRV()
- * 4. Drop the use of MFP_CFG_LPM() and MFP_CFG_X()
- */
-
-#undef MFP_CFG
-#undef MFP_CFG_DRV
-#undef MFP_CFG_LPM
-#undef MFP_CFG_X
-#undef MFP_CFG_DEFAULT
-
-#define MFP_CFG(pin, af)		\
-	(MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_MEDIUM)
-
-#define MFP_CFG_DRV(pin, af, drv)	\
-	(MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_##drv)
-
-#endif /* __ASM_MACH_MFP_H */
arch/arm/mach-mmp/mmp2.c +1 -1
index 8e6c3ac..14e6a23 100644
@@ -24,10 +24,10 @@
 #include <mach/cputype.h>
 #include <mach/irqs.h>
 #include <mach/dma.h>
-#include <mach/mfp.h>
 #include <mach/gpio.h>
 #include <mach/devices.h>
 #include <mach/mmp2.h>
+#include <plat/mfp.h>
 
 #include "common.h"
 #include "clock.h"
arch/arm/mach-mmp/pxa168.c +1 -1
index 72b4e76..34df2b1 100644
@@ -24,7 +24,7 @@
 #include <mach/gpio.h>
 #include <mach/dma.h>
 #include <mach/devices.h>
-#include <mach/mfp.h>
+#include <plat/mfp.h>
 
 #include "common.h"
 #include "clock.h"
arch/arm/mach-mmp/pxa910.c +1 -1
index 8f92ccd..93b3b25 100644
@@ -22,8 +22,8 @@
 #include <mach/irqs.h>
 #include <mach/gpio.h>
 #include <mach/dma.h>
-#include <mach/mfp.h>
 #include <mach/devices.h>
+#include <plat/mfp.h>
 
 #include "common.h"
 #include "clock.h"
arch/arm/plat-pxa/include/plat/mfp.h +4 -0
index 75f6564..b7dde0c 100644
@@ -378,6 +378,10 @@ typedef unsigned long mfp_cfg_t;
 #define MFP_DS13X		(0x7 << 13)
 #define MFP_DS_MASK		(0x7 << 13)
 #define MFP_DS(x)		(((x) >> 13) & 0x7)
+#define MFP_VERY_SLOW		MFP_DS01X
+#define MFP_SLOW		MFP_DS02X
+#define MFP_MEDIUM		MFP_DS03X
+#define MFP_FAST		MFP_DS04X
 
 #define MFP_LPM_DEFAULT		(0x0 << 16)
 #define MFP_LPM_DRIVE_LOW	(0x1 << 16)
arch/arm/plat-pxa/mfp.c +20 -2
index a9aa5ad..d335551 100644
@@ -19,6 +19,10 @@
 #include <linux/io.h>
 #include <linux/sysdev.h>
 
+#ifdef CONFIG_ARCH_MMP
+#include <mach/cputype.h>
+#endif
+
 #include <plat/mfp.h>
 
 #define MFPR_SIZE	(PAGE_SIZE)
@@ -165,8 +169,14 @@ static inline void __mfp_config_lpm(struct mfp_pin *p)
 void mfp_config(unsigned long *mfp_cfgs, int num)
 {
 	unsigned long flags;
-	int i;
-
+	int i, drv_b11 = 0, no_lpm = 0;
+
+#ifdef CONFIG_ARCH_MMP
+	if (cpu_is_pxa910() || cpu_is_mmp2())
+		drv_b11 = 1;
+	if (cpu_is_pxa168() || cpu_is_pxa910())
+		no_lpm = 1;
+#endif
 	spin_lock_irqsave(&mfp_spin_lock, flags);
 
 	for (i = 0; i < num; i++, mfp_cfgs++) {
@@ -183,6 +193,10 @@ void mfp_config(unsigned long *mfp_cfgs, int num)
 		lpm = MFP_LPM_STATE(c);
 		edge = MFP_LPM_EDGE(c);
 		pull = MFP_PULL(c);
+		if (drv_b11)
+			drv = drv << 1;
+		if (no_lpm)
+			lpm = 0;
 
 		/* run-mode pull settings will conflict with MFPR bits of
 		 * low power mode state,  calculate mfpr_run and mfpr_lpm
@@ -272,6 +286,10 @@ void mfp_config_lpm(void)
 	struct mfp_pin *p = &mfp_table[0];
 	int pin;
 
+#ifdef CONFIG_ARCH_MMP
+	if (cpu_is_pxa168() || cpu_is_pxa910())
+		return;
+#endif
 	for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++, p++)
 		__mfp_config_lpm(p);
 }
Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 4/9 ARM: pxa: use gpio reset

Watchdog reset will clear RTC and some configuration registers. GPIO reset doesn't have this impact. So replace watchdog reset by gpio reset.

---
 arch/arm/mach-pxa/include/mach/pxa3xx-regs.h |    8 ++++++++
 arch/arm/mach-pxa/reset.c                    |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +8 -0
index e4fb466..28bc2a9 100644
@@ -37,6 +37,14 @@
 #define PVCR		__REG(0x40F50100)	/* Power Manager Voltage Change Control Register */
 #define PCMD(x)		__REG(0x40F50110 + ((x) << 2))
 
+#define PMCR_BIE	(1 << 0)		/* Interrupt Enable for nBATT_FAULT */
+#define PMCR_BIS	(1 << 1)		/* Interrupt Status for nBATT_FAULT */
+#define PMCR_TIE	(1 << 10)		/* Interrupt Enable for XScale Core Frequency Change */
+#define PMCR_TIS	(1 << 11)		/* Interrupt Status for XScale Core Frequency Change */
+#define PMCR_VIE	(1 << 12)		/* Interrupt Enable for VCC_APPS and VCC_SRAM Voltage Change */
+#define PMCR_VIS	(1 << 13)		/* Interrupt Status for VCC_APPS and VCC_SRAM Voltage Change */
+#define PMCR_SWGR	(1 << 31)		/* Software GPIO Reset */
+
 /*
  * Slave Power Managment Unit
  */
arch/arm/mach-pxa/reset.c +12 -4
index 01e9d64..611d537 100644
@@ -12,6 +12,7 @@
 
 #include <mach/regs-ost.h>
 #include <mach/reset.h>
+#include <mach/pxa3xx-regs.h>
 
 unsigned int reset_status;
 EXPORT_SYMBOL(reset_status);
@@ -75,10 +76,17 @@ static void do_gpio_reset(void)
 
 static void do_hw_reset(void)
 {
-	/* Initialize the watchdog and let it fire */
-	OWER = OWER_WME;
-	OSSR = OSSR_M3;
-	OSMR3 = OSCR + 368640;	/* ... in 100 ms */
+	if (cpu_is_pxa3xx() || cpu_is_pxa95x()) {
+		/* GPIO reset that is defined in silicons */
+		PSPR = 0x5c014000;
+		PMCR = (PMCR & (PMCR_BIE | PMCR_TIE | PMCR_VIE))
+			| PMCR_SWGR;
+	} else {
+		/* Initialize the watchdog and let it fire */
+		OWER = OWER_WME;
+		OSSR = OSSR_M3;
+		OSMR3 = OSCR + 368640;	/* ... in 100 ms */
+	}
 }
 
 void arch_reset(char mode, const char *cmd)
Signature · 1 line
1.5.6.5
#4 lore raw

PATCH 5/9 ARM: mmp: set correct uart according to board

UART3 is the default console in jasper, brownstone and avengers lite.

Change-Id Iacfe665cc0e20a47d50e0b2ad8724097f28e7d2c
---
 arch/arm/mach-mmp/include/mach/debug-macro.S |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/include/mach/debug-macro.S +6 -0
index 7e2ebd3..b353785 100644
@@ -14,8 +14,14 @@
 		.macro	addruart, rp, rv
 		ldr	\rp, =APB_PHYS_BASE		@ physical
 		ldr	\rv, =APB_VIRT_BASE		@ virtual
+#if defined(CONFIG_MACH_BROWNSTONE) || defined(CONFIG_MACH_MARVELL_JASPER) \
+	|| defined(CONFIG_MACH_AVENGERS_LITE)
+		orr	\rp, \rp, #0x00018000
+		orr	\rv, \rv, #0x00018000
+#else
 		orr	\rp, \rp, #0x00017000
 		orr	\rv, \rv, #0x00017000
+#endif
 		.endm
 
 #define UART_SHIFT	2
Signature · 1 line
1.5.6.5
#5 lore raw

PATCH 6/9 ARM: mmp: update the reset implementation

Both PXA910 and MMP2 need watchdog reset, so add these features.

---
 arch/arm/mach-mmp/Makefile                   |    2 +-
 arch/arm/mach-mmp/include/mach/regs-mpmu.h   |   52 +++++++++++++
 arch/arm/mach-mmp/include/mach/regs-timers.h |    2 +
 arch/arm/mach-mmp/include/mach/system.h      |    8 +--
 arch/arm/mach-mmp/reset.c                    |  100 ++++++++++++++++++++++++++
 5 files changed, 156 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/mach-mmp/include/mach/regs-mpmu.h
 create mode 100644 arch/arm/mach-mmp/reset.c
arch/arm/mach-mmp/Makefile +1 -1
index 5c68382..6043f31 100644
@@ -2,7 +2,7 @@
 # Makefile for Marvell's PXA168 processors line
 #
 
-obj-y				+= common.o clock.o devices.o time.o
+obj-y				+= common.o clock.o devices.o time.o reset.o
 
 # SoC support
 obj-$(CONFIG_CPU_PXA168)	+= pxa168.o irq-pxa168.o
arch/arm/mach-mmp/include/mach/regs-mpmu.h new file +52 -0

52 lines not on this page · raw message

arch/arm/mach-mmp/include/mach/regs-timers.h +2 -0
index 45589fe..17f56fe 100644
@@ -15,6 +15,8 @@
 
 #define TIMERS1_VIRT_BASE	(APB_VIRT_BASE + 0x14000)
 #define TIMERS2_VIRT_BASE	(APB_VIRT_BASE + 0x16000)
+#define CP_TIMERS2_VIRT_BASE	(APB_VIRT_BASE + 0x80000)
+#define MMP2_TIMERS2_VIRT_BASE	(APB_VIRT_BASE + 0x80000)
 
 #define TMR_CCR		(0x0000)
 #define TMR_TN_MM(n, m)	(0x0004 + ((n) << 3) + (((n) + (m)) << 2))
arch/arm/mach-mmp/include/mach/system.h +1 -7
index 1a8a25e..31e15cf 100644
@@ -16,11 +16,5 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode, const char *cmd)
-{
-	if (cpu_is_pxa168())
-		cpu_reset(0xffff0000);
-	else
-		cpu_reset(0);
-}
+extern void arch_reset(char mode, const char *cmd);
 #endif /* __ASM_MACH_SYSTEM_H */
arch/arm/mach-mmp/reset.c new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#6 lore raw

PATCH 7/9 ARM: pxa: align NR_BUILTIN_GPIO with GPIO interrupt number

Avoid to mismatch between NR_BUILTIN_GPIO and GPIO interrupt number

---
 arch/arm/mach-pxa/include/mach/gpio.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/include/mach/gpio.h +1 -1
index b024a8b..48ef925 100644
@@ -99,7 +99,7 @@
 #define GAFR(x)		GPIO_REG(0x54 + (((x) & 0x70) >> 2))
 
 
-#define NR_BUILTIN_GPIO 128
+#define NR_BUILTIN_GPIO		PXA_GPIO_IRQ_NUM
 
 #define gpio_to_bank(gpio)	((gpio) >> 5)
 #define gpio_to_irq(gpio)	IRQ_GPIO(gpio)
Signature · 1 line
1.5.6.5
#7 lore raw

PATCH 8/9 ARM: mmp: align NR_BUILTIN_GPIO with gpio interrupt number

Avoid to mismatch between NR_BUILTIN_GPIO and gpio interrupt number.

---
 arch/arm/mach-mmp/include/mach/gpio.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/include/mach/gpio.h +1 -1
index ee8b02e..7bfb827 100644
@@ -10,7 +10,7 @@
 #define BANK_OFF(n)	(((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
 #define GPIO_REG(x)	(*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
 
-#define NR_BUILTIN_GPIO	(192)
+#define NR_BUILTIN_GPIO		IRQ_GPIO_NUM
 
 #define gpio_to_bank(gpio)	((gpio) >> 5)
 #define gpio_to_irq(gpio)	(IRQ_GPIO_START + (gpio))
Signature · 1 line
1.5.6.5
#8 lore raw

PATCH 9/9 ARM: mmp: enable max7312 gpio expander in dkb

Support max7312 gpio expander in TTC DKB.

---
 arch/arm/mach-mmp/ttc_dkb.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/ttc_dkb.c +30 -1
index e411039..9d3ef01 100644
@@ -15,17 +15,29 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
 #include <linux/interrupt.h>
+#include <linux/i2c/pca953x.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 #include <mach/addr-map.h>
+#include <mach/gpio.h>
 #include <mach/mfp-pxa910.h>
 #include <mach/pxa910.h>
 
 #include "common.h"
 
-#define TTCDKB_NR_IRQS		(IRQ_BOARD_START + 24)
+#define TTCDKB_GPIO_EXT0(x)	(NR_BUILTIN_GPIO + ((x < 0) ? 0 :	\
+				((x < 16) ? x : 15)))
+#define TTCDKB_GPIO_EXT1(x)	(NR_BUILTIN_GPIO + 16 + ((x < 0) ? 0 :	\
+				((x < 16) ? x : 15)))
+
+/*
+ * 16 board interrupts -- MAX7312 GPIO expander
+ * 16 board interrupts -- PCA9575 GPIO expander
+ * 24 board interrupts -- 88PM860x PMIC
+ */
+#define TTCDKB_NR_IRQS		(IRQ_BOARD_START + 16 + 16 + 24)
 
 static unsigned long ttc_dkb_pin_config[] __initdata = {
 	/* UART2 */
@@ -113,6 +125,22 @@ static struct platform_device *ttc_dkb_devices[] = {
 	&ttc_dkb_device_onenand,
 };
 
+static struct pca953x_platform_data max7312_data[] = {
+	{
+		.gpio_base	= TTCDKB_GPIO_EXT0(0),
+		.irq_base	= IRQ_BOARD_START,
+	},
+};
+
+static struct i2c_board_info ttc_dkb_i2c_info[] = {
+	{
+		.type		= "max7312",
+		.addr		= 0x23,
+		.irq		= IRQ_GPIO(80),
+		.platform_data	= &max7312_data,
+	},
+};
+
 static void __init ttc_dkb_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
@@ -121,6 +149,7 @@ static void __init ttc_dkb_init(void)
 	pxa910_add_uart(1);
 
 	/* off-chip devices */
+	pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
 	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
 }
 
Signature · 1 line
1.5.6.5
#9 lore raw

PATCH 9/9 ARM: mmp: enable max7312 gpio expander in dkb

Quoted 5 lines · Haojian Zhuang

#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>
#include <mach/addr-map.h>
+#include <mach/gpio.h>

linux/gpio.h

#10 lore raw

PATCH 9/9 ARM: mmp: enable max7312 gpio expander in dkb

Quoted 9 lines · Russell King - ARM Linux
Quoted 5 lines · Haojian Zhuang

?#include <asm/mach-types.h>
?#include <asm/mach/arch.h>
?#include <asm/mach/flash.h>
?#include <mach/addr-map.h>
+#include <mach/gpio.h>

linux/gpio.h

Applied with the above change.

#11 lore raw

PATCH 4/9 ARM: pxa: use gpio reset

In reply to Haojian Zhuang
Quoted 50 lines · Haojian Zhuang

Watchdog reset will clear RTC and some configuration registers. GPIO reset doesn't have this impact. So replace watchdog reset by gpio reset.

---
 arch/arm/mach-pxa/include/mach/pxa3xx-regs.h |    8 ++++++++
 arch/arm/mach-pxa/reset.c                    |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +8 -0
index e4fb466..28bc2a9 100644
@@ -37,6 +37,14 @@
 #define PVCR		__REG(0x40F50100)	/* Power Manager Voltage Change Control Register */
 #define PCMD(x)		__REG(0x40F50110 + ((x) << 2))
 
+#define PMCR_BIE	(1 << 0)		/* Interrupt Enable for nBATT_FAULT */
+#define PMCR_BIS	(1 << 1)		/* Interrupt Status for nBATT_FAULT */
+#define PMCR_TIE	(1 << 10)		/* Interrupt Enable for XScale Core Frequency Change */
+#define PMCR_TIS	(1 << 11)		/* Interrupt Status for XScale Core Frequency Change */
+#define PMCR_VIE	(1 << 12)		/* Interrupt Enable for VCC_APPS and VCC_SRAM Voltage Change */
+#define PMCR_VIS	(1 << 13)		/* Interrupt Status for VCC_APPS and VCC_SRAM Voltage Change */
+#define PMCR_SWGR	(1 << 31)		/* Software GPIO Reset */
+
 /*
  * Slave Power Managment Unit
  */
arch/arm/mach-pxa/reset.c +3 -4
index 01e9d64..611d537 100644
@@ -12,6 +12,7 @@
 
 #include <mach/regs-ost.h>
 #include <mach/reset.h>
+#include <mach/pxa3xx-regs.h>
 
 unsigned int reset_status;
 EXPORT_SYMBOL(reset_status);
@@ -75,10 +76,17 @@ static void do_gpio_reset(void)
 
 static void do_hw_reset(void)
 {
-	/* Initialize the watchdog and let it fire */
-	OWER = OWER_WME;
-	OSSR = OSSR_M3;
-	OSMR3 = OSCR + 368640;	/* ... in 100 ms */
+	if (cpu_is_pxa3xx() || cpu_is_pxa95x()) {
+		/* GPIO reset that is defined in silicons */

arch/arm/mach-pxa/reset.c static void do_gpio_reset(void) · line 90

Quoted 10 lines
arch/arm/mach-pxa/reset.c +9 -0
+		PSPR = 0x5c014000;
+		PMCR = (PMCR & (PMCR_BIE | PMCR_TIE | PMCR_VIE))
+			| PMCR_SWGR;
+	} else {
+		/* Initialize the watchdog and let it fire */
+		OWER = OWER_WME;
+		OSSR = OSSR_M3;
+		OSMR3 = OSCR + 368640;	/* ... in 100 ms */
+	}
 }

Why not separate the above into two functions - do_wd_reset() and do_gpio_reset(), and have the selection of which is to be used in the initialization path?

#12 lore raw

PATCH 4/9 ARM: pxa: use gpio reset

In reply to Haojian Zhuang

Hi Haojian,

Quoted 2 lines · Haojian Zhuang

Watchdog reset will clear RTC and some configuration registers. GPIO reset doesn't have this impact. So replace watchdog reset by gpio reset.

It is also preserves the memory controller configuration registers and puts the external DDR into self refresh.

Quoted 12 lines
---
 arch/arm/mach-pxa/include/mach/pxa3xx-regs.h |    8 ++++++++
 arch/arm/mach-pxa/reset.c                    |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)
arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +0 -0
index e4fb466..28bc2a9 100644
@@ -37,6 +37,14 @@
 #define PVCR		__REG(0x40F50100)	/* Power Manager Voltage Change Control Register */

arch/arm/mach-pxa/include/mach/pxa3xx-regs.h line 47

Quoted 10 lines
arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +8 -0
 #define PCMD(x)		__REG(0x40F50110 + ((x) << 2))
 
+#define PMCR_BIE	(1 << 0)		/* Interrupt Enable for nBATT_FAULT */
+#define PMCR_BIS	(1 << 1)		/* Interrupt Status for nBATT_FAULT */
+#define PMCR_TIE	(1 << 10)		/* Interrupt Enable for XScale Core Frequency Change */
+#define PMCR_TIS	(1 << 11)		/* Interrupt Status for XScale Core Frequency Change */
+#define PMCR_VIE	(1 << 12)		/* Interrupt Enable for VCC_APPS and VCC_SRAM Voltage Change */
+#define PMCR_VIS	(1 << 13)		/* Interrupt Status for VCC_APPS and VCC_SRAM Voltage Change */
+#define PMCR_SWGR	(1 << 31)		/* Software GPIO Reset */
+

Here, there is no real need in longer then 80 characters lines.

Quoted 26 lines
arch/arm/mach-pxa/include/mach/pxa3xx-regs.h +0 -0
 /*
  * Slave Power Managment Unit
  */
arch/arm/mach-pxa/reset.c +4 -4
index 01e9d64..611d537 100644
@@ -12,6 +12,7 @@
 
 #include <mach/regs-ost.h>
 #include <mach/reset.h>
+#include <mach/pxa3xx-regs.h>
 
 unsigned int reset_status;
 EXPORT_SYMBOL(reset_status);
@@ -75,10 +76,17 @@ static void do_gpio_reset(void)
 
 static void do_hw_reset(void)
 {
-	/* Initialize the watchdog and let it fire */
-	OWER = OWER_WME;
-	OSSR = OSSR_M3;
-	OSMR3 = OSCR + 368640;	/* ... in 100 ms */
+	if (cpu_is_pxa3xx() || cpu_is_pxa95x()) {
+		/* GPIO reset that is defined in silicons */
+		PSPR = 0x5c014000;

arch/arm/mach-pxa/reset.c static void do_gpio_reset(void) · line 91

Quoted 10 lines
arch/arm/mach-pxa/reset.c +8 -0
+		PMCR = (PMCR & (PMCR_BIE | PMCR_TIE | PMCR_VIE))
+			| PMCR_SWGR;
+	} else {
+		/* Initialize the watchdog and let it fire */
+		OWER = OWER_WME;
+		OSSR = OSSR_M3;
+		OSMR3 = OSCR + 368640;	/* ... in 100 ms */
+	}
 }
 

This affects all PXA3xx based platforms and boards...
I still haven't had a chance to test this (probably in a couple of days I will), but given that the memory controller (and the DDR) is affected by this patch, we'd better give it a good test as it can bring issues on existing platforms which relay on the WD reset.

Signature · 2 lines
Regards,
Igor.
#13 lore raw

PATCH 3/9 ARM: mmp: remove redundant macro definition in mfp

In reply to Haojian Zhuang
Quoted 6 lines · Haojian Zhuang

There're two layers in MFP implementation. One is MFP layer that is logical pin setting. And the other is MFPR layer that is physical register setting.

MFP drive setting is different between PXA168 and PXA910. But the difference was stored in logical layer, not physical layer. And some unnecessary macro definition were added for ARCH_MMP.

The implementation is indeed a bit complicated, yet I don't see the change here is necessary so far.

The MFPR bit definitions for pxa168/910 and mmp2 are basically following the pxa3xx's.

And definitions like DRIVE_SLOW, DRIVE_VERY_SLOW are really pxa168/910, mmp2 specific. And it's no equivalent to DS01X, DS02X ..., which is more pxa3xx specific.

BTW, does the existing code cause any bug/limitation?

Quoted 225 lines

---

?arch/arm/mach-mmp/include/mach/mfp-mmp2.h ? | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa168.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa910.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp.h ? ? ? ?| ? 34 ---------------------------
?arch/arm/mach-mmp/mmp2.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa168.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa910.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/plat-pxa/include/plat/mfp.h ? ? ? ?| ? ?4 +++
?arch/arm/plat-pxa/mfp.c ? ? ? ? ? ? ? ? ? ? | ? 22 +++++++++++++++-

?9 files changed, 30 insertions(+), 57 deletions(-) ?delete mode 100644 arch/arm/mach-mmp/include/mach/mfp.h

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +0 -0
index 4ad3862..c66eaea 100644
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_MMP2_H
?#define __ASM_MACH_MFP_MMP2_H

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

?/* GPIO */
?#define GPIO0_GPIO ? ? MFP_CFG(GPIO0, AF0)

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +0 -0
index 4621067..4aadbea 100644
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA168_H
?#define __ASM_MACH_MFP_PXA168_H

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x1 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x2 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x3 << 13)
+#include <plat/mfp.h>

?/* GPIO */
?#define GPIO0_GPIO ? ? ? ? ? ? MFP_CFG(GPIO0, AF5)

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +0 -0
index fbd7ee8..f5d33be 100644
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA910_H
?#define __ASM_MACH_MFP_PXA910_H

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

?/* UART2 */
?#define GPIO47_UART2_RXD ? ? ? MFP_CFG(GPIO47, AF6)

arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -34
deleted file mode 100644
index 62e510e..0000000
@@ -1,34 +0,0 @@
-#ifndef __ASM_MACH_MFP_H
-#define __ASM_MACH_MFP_H
-
-#include <plat/mfp.h>
-
-/*
- * NOTE: the MFPR register bit definitions on PXA168 processor lines are a
- * bit different from those on PXA3xx. ?Bit [7:10] are now reserved, which
- * were SLEEP_OE_N, SLEEP_DATA, SLEEP_SEL and the LSB of DRIVE bits.
- *
- * To cope with this difference and re-use the pxa3xx mfp code as much as
- * possible, we make the following compromise:
- *
- * 1. SLEEP_OE_N will always be programmed to '1' (by MFP_LPM_FLOAT)
- * 2. DRIVE strength definitions redefined to include the reserved bit
- * ? ?- the reserved bit differs between pxa168 and pxa910, and the
- * ? ? ?MFP_DRIVE_* macros are individually defined in mfp-pxa{168,910}.h
- * 3. Override MFP_CFG() and MFP_CFG_DRV()
- * 4. Drop the use of MFP_CFG_LPM() and MFP_CFG_X()
- */
-
-#undef MFP_CFG
-#undef MFP_CFG_DRV
-#undef MFP_CFG_LPM
-#undef MFP_CFG_X
-#undef MFP_CFG_DEFAULT
-
-#define MFP_CFG(pin, af) ? ? ? ? ? ? ? \
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_MEDIUM)
-
-#define MFP_CFG_DRV(pin, af, drv) ? ? ?\
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af | MFP_DRIVE_##drv)
-
-#endif /* __ASM_MACH_MFP_H */
arch/arm/mach-mmp/mmp2.c +0 -0
index 8e6c3ac..14e6a23 100644
@@ -24,10 +24,10 @@

?#include <mach/cputype.h>
?#include <mach/irqs.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/gpio.h>
?#include <mach/devices.h>
?#include <mach/mmp2.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa168.c +0 -0
index 72b4e76..34df2b1 100644
@@ -24,7 +24,7 @@

?#include <mach/gpio.h>
?#include <mach/dma.h>
?#include <mach/devices.h>

arch/arm/mach-mmp/pxa168.c +1 -1
-#include <mach/mfp.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa910.c +0 -0
index 8f92ccd..93b3b25 100644
@@ -22,8 +22,8 @@

?#include <mach/irqs.h>
?#include <mach/gpio.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/devices.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/plat-pxa/include/plat/mfp.h +4 -0
index 75f6564..b7dde0c 100644
@@ -378,6 +378,10 @@ typedef unsigned long mfp_cfg_t;
 ?#define MFP_DS13X ? ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS_MASK ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS(x) ? ? ? ? ? ? ?(((x) >> 13) & 0x7)
+#define MFP_VERY_SLOW ? ? ? ? ?MFP_DS01X
+#define MFP_SLOW ? ? ? ? ? ? ? MFP_DS02X
+#define MFP_MEDIUM ? ? ? ? ? ? MFP_DS03X
+#define MFP_FAST ? ? ? ? ? ? ? MFP_DS04X
 
 ?#define MFP_LPM_DEFAULT ? ? ? ? ? ? ? ?(0x0 << 16)
 ?#define MFP_LPM_DRIVE_LOW ? ? ?(0x1 << 16)
arch/arm/plat-pxa/mfp.c +0 -0
index a9aa5ad..d335551 100644
@@ -19,6 +19,10 @@

?#include <linux/io.h>
?#include <linux/sysdev.h>

arch/arm/plat-pxa/mfp.c +4 -0
+#ifdef CONFIG_ARCH_MMP
+#include <mach/cputype.h>
+#endif
+

?#include <plat/mfp.h>

?#define MFPR_SIZE ? ? ?(PAGE_SIZE)

arch/arm/plat-pxa/mfp.c +12 -2
@@ -165,8 +169,14 @@ static inline void __mfp_config_lpm(struct mfp_pin *p)
 ?void mfp_config(unsigned long *mfp_cfgs, int num)
 ?{
 ? ? ? ?unsigned long flags;
- ? ? ? int i;
-
+ ? ? ? int i, drv_b11 = 0, no_lpm = 0;
+
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa910() || cpu_is_mmp2())
+ ? ? ? ? ? ? ? drv_b11 = 1;
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? no_lpm = 1;
+#endif
 ? ? ? ?spin_lock_irqsave(&mfp_spin_lock, flags);
 
 ? ? ? ?for (i = 0; i < num; i++, mfp_cfgs++) {
@@ -183,6 +193,10 @@ void mfp_config(unsigned long *mfp_cfgs, int num)
 ? ? ? ? ? ? ? ?lpm = MFP_LPM_STATE(c);
 ? ? ? ? ? ? ? ?edge = MFP_LPM_EDGE(c);
 ? ? ? ? ? ? ? ?pull = MFP_PULL(c);
+ ? ? ? ? ? ? ? if (drv_b11)
+ ? ? ? ? ? ? ? ? ? ? ? drv = drv << 1;
+ ? ? ? ? ? ? ? if (no_lpm)
+ ? ? ? ? ? ? ? ? ? ? ? lpm = 0;
 

? ? ? ? ? ? ? ?/* run-mode pull settings will conflict with MFPR bits of ? ? ? ? ? ? ? ? * low power mode state, ?calculate mfpr_run and mfpr_lpm

arch/arm/plat-pxa/mfp.c +4 -1
@@ -272,6 +286,10 @@ void mfp_config_lpm(void)
 ? ? ? ?struct mfp_pin *p = &mfp_table[0];
 ? ? ? ?int pin;
 
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? return;
+#endif
 ? ? ? ?for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++, p++)
 ? ? ? ? ? ? ? ?__mfp_config_lpm(p);
 ?}
--

1.5.6.5

#14 lore raw

PATCH 3/9 ARM: mmp: remove redundant macro definition in mfp

Quoted 26 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 12:51 PM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 3/9] ARM: mmp: remove redundant macro definition in mfp

Quoted 1 line · Haojian Zhuang

There're two layers in MFP implementation. One is MFP layer that is

logical

Quoted 1 line

pin setting. And the other is MFPR layer that is physical register

setting.

Quoted 2 lines

MFP drive setting is different between PXA168 and PXA910. But the

difference

Quoted 1 line

was stored in logical layer, not physical layer. And some unnecessary

macro

Quoted 1 line

definition were added for ARCH_MMP.

The implementation is indeed a bit complicated, yet I don't see the change here is necessary so far.

Quoted 9 lines

The MFPR bit definitions for pxa168/910 and mmp2 are basically following the pxa3xx's.

And definitions like DRIVE_SLOW, DRIVE_VERY_SLOW are really pxa168/910, mmp2 specific. And it's no equivalent to DS01X, DS02X ..., which is more pxa3xx specific.

BTW, does the existing code cause any bug/limitation?

Yes, there's some limitation in existing code since it's for pxa3xx. For example, driver strength is bit[12..10] in PXA3xx. In PXA955/910/MMP2, it's bit[12..11]. In PXA168, it's bit[11..10]. And there's no sleep mode in PXA168. Sleep mode bit is different in PXA910.

Quoted 241 lines
Quoted 7 lines

---

?arch/arm/mach-mmp/include/mach/mfp-mmp2.h ? | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa168.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa910.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp.h ? ? ? ?| ? 34 ------------------

---------

Review

Quoted 9 lines
?arch/arm/mach-mmp/mmp2.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa168.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa910.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/plat-pxa/include/plat/mfp.h ? ? ? ?| ? ?4 +++
?arch/arm/plat-pxa/mfp.c ? ? ? ? ? ? ? ? ? ? | ? 22 +++++++++++++++-

?9 files changed, 30 insertions(+), 57 deletions(-) ?delete mode 100644 arch/arm/mach-mmp/include/mach/mfp.h

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-mmp2.h

Quoted 15 lines

index 4ad3862..c66eaea 100644

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_MMP2_H
?#define __ASM_MACH_MFP_MMP2_H

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? MFP_CFG(GPIO0, AF0)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h

Quoted 15 lines

index 4621067..4aadbea 100644

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA168_H
?#define __ASM_MACH_MFP_PXA168_H

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x1 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x2 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x3 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? ? ? ? ? MFP_CFG(GPIO0, AF5)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h

arch/arm/mach-

Quoted 18 lines

index fbd7ee8..f5d33be 100644

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA910_H
?#define __ASM_MACH_MFP_PXA910_H

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

?/* UART2 */
?#define GPIO47_UART2_RXD ? ? ? MFP_CFG(GPIO47, AF6)

arch/arm/mach- renamed from arch/arm/mach-mmp/include/mach/mfp.h +0 -0

mmp/include/mach/mfp.h

arch/arm/mach-mmp/include/mach/mfp.h line 7

Quoted 12 lines

deleted file mode 100644
index 62e510e..0000000

arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -7
@@ -1,34 +0,0 @@
-#ifndef __ASM_MACH_MFP_H
-#define __ASM_MACH_MFP_H
-
-#include <plat/mfp.h>
-
-/*
- * NOTE: the MFPR register bit definitions on PXA168 processor lines

are a

arch/arm/mach-mmp/include/mach/mfp.h line 8

Quoted 1 line
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -1
- * bit different from those on PXA3xx. ?Bit [7:10] are now reserved,

which

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
- * were SLEEP_OE_N, SLEEP_DATA, SLEEP_SEL and the LSB of DRIVE bits.
- *
- * To cope with this difference and re-use the pxa3xx mfp code as

much as

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 4 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -4
- * possible, we make the following compromise:
- *
- * 1. SLEEP_OE_N will always be programmed to '1' (by MFP_LPM_FLOAT)
- * 2. DRIVE strength definitions redefined to include the reserved

bit

arch/arm/mach-mmp/include/mach/mfp.h line 17

Quoted 2 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
- * ? ?- the reserved bit differs between pxa168 and pxa910, and the
- * ? ? ?MFP_DRIVE_* macros are individually defined in mfp-

pxa{168,910}.h

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 12 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -12
- * 3. Override MFP_CFG() and MFP_CFG_DRV()
- * 4. Drop the use of MFP_CFG_LPM() and MFP_CFG_X()
- */
-
-#undef MFP_CFG
-#undef MFP_CFG_DRV
-#undef MFP_CFG_LPM
-#undef MFP_CFG_X
-#undef MFP_CFG_DEFAULT
-
-#define MFP_CFG(pin, af) ? ? ? ? ? ? ? \
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_MEDIUM)

arch/arm/mach-mmp/include/mach/mfp.h line 32

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
-
-#define MFP_CFG_DRV(pin, af, drv) ? ? ?\
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_##drv)

arch/arm/plat-

Quoted 46 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
-
-#endif /* __ASM_MACH_MFP_H */
arch/arm/mach-mmp/mmp2.c +0 -0
index 8e6c3ac..14e6a23 100644
@@ -24,10 +24,10 @@

?#include <mach/cputype.h>
?#include <mach/irqs.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/gpio.h>
?#include <mach/devices.h>
?#include <mach/mmp2.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa168.c +0 -0
index 72b4e76..34df2b1 100644
@@ -24,7 +24,7 @@

?#include <mach/gpio.h>
?#include <mach/dma.h>
?#include <mach/devices.h>

arch/arm/mach-mmp/pxa168.c +1 -1
-#include <mach/mfp.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa910.c +0 -0
index 8f92ccd..93b3b25 100644
@@ -22,8 +22,8 @@

?#include <mach/irqs.h>
?#include <mach/gpio.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/devices.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/plat- renamed from arch/arm/plat-pxa/include/plat/mfp.h +0 -0

pxa/include/plat/mfp.h

arch/arm/plat-pxa/mfp.c static inline void __mfp_config_lpm(struct

Quoted 30 lines

index 75f6564..b7dde0c 100644

arch/arm/plat-pxa/include/plat/mfp.h +4 -0
@@ -378,6 +378,10 @@ typedef unsigned long mfp_cfg_t;
 ?#define MFP_DS13X ? ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS_MASK ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS(x) ? ? ? ? ? ? ?(((x) >> 13) & 0x7)
+#define MFP_VERY_SLOW ? ? ? ? ?MFP_DS01X
+#define MFP_SLOW ? ? ? ? ? ? ? MFP_DS02X
+#define MFP_MEDIUM ? ? ? ? ? ? MFP_DS03X
+#define MFP_FAST ? ? ? ? ? ? ? MFP_DS04X
 
 ?#define MFP_LPM_DEFAULT ? ? ? ? ? ? ? ?(0x0 << 16)
 ?#define MFP_LPM_DRIVE_LOW ? ? ?(0x1 << 16)
arch/arm/plat-pxa/mfp.c +0 -0
index a9aa5ad..d335551 100644
@@ -19,6 +19,10 @@

?#include <linux/io.h>
?#include <linux/sysdev.h>

arch/arm/plat-pxa/mfp.c +4 -0
+#ifdef CONFIG_ARCH_MMP
+#include <mach/cputype.h>
+#endif
+

?#include <plat/mfp.h>

?#define MFPR_SIZE ? ? ?(PAGE_SIZE)

arch/arm/plat-pxa/mfp.c +0 -0
@@ -165,8 +169,14 @@ static inline void __mfp_config_lpm(struct

mfp_pin *p)

Quoted 25 lines
arch/arm/plat-pxa/mfp.c +12 -2
 ?void mfp_config(unsigned long *mfp_cfgs, int num)
 ?{
 ? ? ? ?unsigned long flags;
- ? ? ? int i;
-
+ ? ? ? int i, drv_b11 = 0, no_lpm = 0;
+
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa910() || cpu_is_mmp2())
+ ? ? ? ? ? ? ? drv_b11 = 1;
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? no_lpm = 1;
+#endif
 ? ? ? ?spin_lock_irqsave(&mfp_spin_lock, flags);
 
 ? ? ? ?for (i = 0; i < num; i++, mfp_cfgs++) {
@@ -183,6 +193,10 @@ void mfp_config(unsigned long *mfp_cfgs, int num)
 ? ? ? ? ? ? ? ?lpm = MFP_LPM_STATE(c);
 ? ? ? ? ? ? ? ?edge = MFP_LPM_EDGE(c);
 ? ? ? ? ? ? ? ?pull = MFP_PULL(c);
+ ? ? ? ? ? ? ? if (drv_b11)
+ ? ? ? ? ? ? ? ? ? ? ? drv = drv << 1;
+ ? ? ? ? ? ? ? if (no_lpm)
+ ? ? ? ? ? ? ? ? ? ? ? lpm = 0;
 
Quoted 1 line

? ? ? ? ? ? ? ?/* run-mode pull settings will conflict with MFPR bits

of

Quoted 1 line

? ? ? ? ? ? ? ? * low power mode state, ?calculate mfpr_run and

mfpr_lpm

Quoted 15 lines
arch/arm/plat-pxa/mfp.c +4 -1
@@ -272,6 +286,10 @@ void mfp_config_lpm(void)
 ? ? ? ?struct mfp_pin *p = &mfp_table[0];
 ? ? ? ?int pin;
 
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? return;
+#endif
 ? ? ? ?for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++, p++)
 ? ? ? ? ? ? ? ?__mfp_config_lpm(p);
 ?}
--

1.5.6.5

#15 lore raw

PATCH 3/9 ARM: mmp: remove redundant macro definition in mfp

Quoted 29 lines · Haojian Zhuang
Quoted 29 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 12:51 PM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 3/9] ARM: mmp: remove redundant macro definition in mfp

Quoted 1 line · Haojian Zhuang

There're two layers in MFP implementation. One is MFP layer that is

logical

Quoted 1 line

pin setting. And the other is MFPR layer that is physical register

setting.

Quoted 2 lines

MFP drive setting is different between PXA168 and PXA910. But the

difference

Quoted 1 line

was stored in logical layer, not physical layer. And some unnecessary

macro

Quoted 1 line

definition were added for ARCH_MMP.

The implementation is indeed a bit complicated, yet I don't see the change here is necessary so far.

The MFPR bit definitions for pxa168/910 and mmp2 are basically following the pxa3xx's.

Quoted 7 lines
Quoted 6 lines

And definitions like DRIVE_SLOW, DRIVE_VERY_SLOW are really pxa168/910, mmp2 specific. And it's no equivalent to DS01X, DS02X ..., which is more pxa3xx specific.

BTW, does the existing code cause any bug/limitation?

Yes, there's some limitation in existing code since it's for pxa3xx. For example, driver strength is bit[12..10] in PXA3xx. In PXA955/910/MMP2, it's bit[12..11]. In PXA168, it's bit[11..10].

This can be covered by definitions of DRIVE_SLOW, DRIVE_FAST, and it's transparent to the API usage.

Quoted 1 line

And there's no sleep mode in PXA168.

Thus there will be no MFP_LPM_* usage in pxa168 board file.

Quoted 1 line

Sleep mode bit is different in PXA910.

Example, like?

Quoted 243 lines
Quoted 242 lines
Quoted 8 lines

---

?arch/arm/mach-mmp/include/mach/mfp-mmp2.h ? | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa168.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa910.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp.h ? ? ? ?| ? 34 ------------------

---------

Review

Quoted 9 lines
?arch/arm/mach-mmp/mmp2.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa168.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa910.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/plat-pxa/include/plat/mfp.h ? ? ? ?| ? ?4 +++
?arch/arm/plat-pxa/mfp.c ? ? ? ? ? ? ? ? ? ? | ? 22 +++++++++++++++-

?9 files changed, 30 insertions(+), 57 deletions(-) ?delete mode 100644 arch/arm/mach-mmp/include/mach/mfp.h

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-mmp2.h

Quoted 15 lines

index 4ad3862..c66eaea 100644

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_MMP2_H
?#define __ASM_MACH_MFP_MMP2_H

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? MFP_CFG(GPIO0, AF0)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h

Quoted 15 lines

index 4621067..4aadbea 100644

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA168_H
?#define __ASM_MACH_MFP_PXA168_H

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x1 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x2 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x3 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? ? ? ? ? MFP_CFG(GPIO0, AF5)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h

arch/arm/mach-

Quoted 18 lines

index fbd7ee8..f5d33be 100644

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA910_H
?#define __ASM_MACH_MFP_PXA910_H

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

?/* UART2 */
?#define GPIO47_UART2_RXD ? ? ? MFP_CFG(GPIO47, AF6)

arch/arm/mach- renamed from arch/arm/mach-mmp/include/mach/mfp.h +0 -0

mmp/include/mach/mfp.h

arch/arm/mach-mmp/include/mach/mfp.h line 7

Quoted 12 lines

deleted file mode 100644
index 62e510e..0000000

arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -7
@@ -1,34 +0,0 @@
-#ifndef __ASM_MACH_MFP_H
-#define __ASM_MACH_MFP_H
-
-#include <plat/mfp.h>
-
-/*
- * NOTE: the MFPR register bit definitions on PXA168 processor lines

are a

arch/arm/mach-mmp/include/mach/mfp.h line 8

Quoted 1 line
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -1
- * bit different from those on PXA3xx. ?Bit [7:10] are now reserved,

which

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
- * were SLEEP_OE_N, SLEEP_DATA, SLEEP_SEL and the LSB of DRIVE bits.
- *
- * To cope with this difference and re-use the pxa3xx mfp code as

much as

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 4 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -4
- * possible, we make the following compromise:
- *
- * 1. SLEEP_OE_N will always be programmed to '1' (by MFP_LPM_FLOAT)
- * 2. DRIVE strength definitions redefined to include the reserved

bit

arch/arm/mach-mmp/include/mach/mfp.h line 17

Quoted 2 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
- * ? ?- the reserved bit differs between pxa168 and pxa910, and the
- * ? ? ?MFP_DRIVE_* macros are individually defined in mfp-

pxa{168,910}.h

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 12 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -12
- * 3. Override MFP_CFG() and MFP_CFG_DRV()
- * 4. Drop the use of MFP_CFG_LPM() and MFP_CFG_X()
- */
-
-#undef MFP_CFG
-#undef MFP_CFG_DRV
-#undef MFP_CFG_LPM
-#undef MFP_CFG_X
-#undef MFP_CFG_DEFAULT
-
-#define MFP_CFG(pin, af) ? ? ? ? ? ? ? \
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_MEDIUM)

arch/arm/mach-mmp/include/mach/mfp.h line 32

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
-
-#define MFP_CFG_DRV(pin, af, drv) ? ? ?\
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_##drv)

arch/arm/plat-

Quoted 46 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
-
-#endif /* __ASM_MACH_MFP_H */
arch/arm/mach-mmp/mmp2.c +0 -0
index 8e6c3ac..14e6a23 100644
@@ -24,10 +24,10 @@

?#include <mach/cputype.h>
?#include <mach/irqs.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/gpio.h>
?#include <mach/devices.h>
?#include <mach/mmp2.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa168.c +0 -0
index 72b4e76..34df2b1 100644
@@ -24,7 +24,7 @@

?#include <mach/gpio.h>
?#include <mach/dma.h>
?#include <mach/devices.h>

arch/arm/mach-mmp/pxa168.c +1 -1
-#include <mach/mfp.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa910.c +0 -0
index 8f92ccd..93b3b25 100644
@@ -22,8 +22,8 @@

?#include <mach/irqs.h>
?#include <mach/gpio.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/devices.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/plat- renamed from arch/arm/plat-pxa/include/plat/mfp.h +0 -0

pxa/include/plat/mfp.h

arch/arm/plat-pxa/mfp.c static inline void __mfp_config_lpm(struct

Quoted 30 lines

index 75f6564..b7dde0c 100644

arch/arm/plat-pxa/include/plat/mfp.h +4 -0
@@ -378,6 +378,10 @@ typedef unsigned long mfp_cfg_t;
 ?#define MFP_DS13X ? ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS_MASK ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS(x) ? ? ? ? ? ? ?(((x) >> 13) & 0x7)
+#define MFP_VERY_SLOW ? ? ? ? ?MFP_DS01X
+#define MFP_SLOW ? ? ? ? ? ? ? MFP_DS02X
+#define MFP_MEDIUM ? ? ? ? ? ? MFP_DS03X
+#define MFP_FAST ? ? ? ? ? ? ? MFP_DS04X
 
 ?#define MFP_LPM_DEFAULT ? ? ? ? ? ? ? ?(0x0 << 16)
 ?#define MFP_LPM_DRIVE_LOW ? ? ?(0x1 << 16)
arch/arm/plat-pxa/mfp.c +0 -0
index a9aa5ad..d335551 100644
@@ -19,6 +19,10 @@

?#include <linux/io.h>
?#include <linux/sysdev.h>

arch/arm/plat-pxa/mfp.c +4 -0
+#ifdef CONFIG_ARCH_MMP
+#include <mach/cputype.h>
+#endif
+

?#include <plat/mfp.h>

?#define MFPR_SIZE ? ? ?(PAGE_SIZE)

arch/arm/plat-pxa/mfp.c +0 -0
@@ -165,8 +169,14 @@ static inline void __mfp_config_lpm(struct

mfp_pin *p)

Quoted 25 lines
arch/arm/plat-pxa/mfp.c +12 -2
 ?void mfp_config(unsigned long *mfp_cfgs, int num)
 ?{
 ? ? ? ?unsigned long flags;
- ? ? ? int i;
-
+ ? ? ? int i, drv_b11 = 0, no_lpm = 0;
+
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa910() || cpu_is_mmp2())
+ ? ? ? ? ? ? ? drv_b11 = 1;
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? no_lpm = 1;
+#endif
 ? ? ? ?spin_lock_irqsave(&mfp_spin_lock, flags);
 
 ? ? ? ?for (i = 0; i < num; i++, mfp_cfgs++) {
@@ -183,6 +193,10 @@ void mfp_config(unsigned long *mfp_cfgs, int num)
 ? ? ? ? ? ? ? ?lpm = MFP_LPM_STATE(c);
 ? ? ? ? ? ? ? ?edge = MFP_LPM_EDGE(c);
 ? ? ? ? ? ? ? ?pull = MFP_PULL(c);
+ ? ? ? ? ? ? ? if (drv_b11)
+ ? ? ? ? ? ? ? ? ? ? ? drv = drv << 1;
+ ? ? ? ? ? ? ? if (no_lpm)
+ ? ? ? ? ? ? ? ? ? ? ? lpm = 0;
 
Quoted 1 line

? ? ? ? ? ? ? ?/* run-mode pull settings will conflict with MFPR bits

of

Quoted 1 line

? ? ? ? ? ? ? ? * low power mode state, ?calculate mfpr_run and

mfpr_lpm

Quoted 15 lines
arch/arm/plat-pxa/mfp.c +4 -1
@@ -272,6 +286,10 @@ void mfp_config_lpm(void)
 ? ? ? ?struct mfp_pin *p = &mfp_table[0];
 ? ? ? ?int pin;
 
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? return;
+#endif
 ? ? ? ?for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++, p++)
 ? ? ? ? ? ? ? ?__mfp_config_lpm(p);
 ?}
--

1.5.6.5

#16 lore raw

PATCH 3/9 ARM: mmp: remove redundant macro definition in mfp

Quoted 47 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 1:31 PM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 3/9] ARM: mmp: remove redundant macro definition in mfp

Quoted 8 lines · Haojian Zhuang
Quoted 8 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 12:51 PM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 3/9] ARM: mmp: remove redundant macro definition

in

Quoted 4 lines
Quoted 4 lines

mfp

On Fri, Apr 1, 2011 at 10:39 AM, Haojian Zhuang
<[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

There're two layers in MFP implementation. One is MFP layer that is

logical

Quoted 1 line

pin setting. And the other is MFPR layer that is physical register

setting.

Quoted 2 lines

MFP drive setting is different between PXA168 and PXA910. But the

difference

Quoted 1 line

was stored in logical layer, not physical layer. And some

unnecessary

Quoted 13 lines
Quoted 13 lines

macro

Quoted 1 line

definition were added for ARCH_MMP.

The implementation is indeed a bit complicated, yet I don't see the change here is necessary so far.

The MFPR bit definitions for pxa168/910 and mmp2 are basically following the pxa3xx's.

And definitions like DRIVE_SLOW, DRIVE_VERY_SLOW are really pxa168/910, mmp2 specific. And it's no equivalent to DS01X, DS02X ..., which is more pxa3xx specific.

Quoted 9 lines
Quoted 3 lines
Quoted 2 lines

BTW, does the existing code cause any bug/limitation?

Yes, there's some limitation in existing code since it's for pxa3xx.

For example, driver strength is bit[12..10] in PXA3xx. In PXA955/910/MMP2, it's bit[12..11]. In PXA168, it's bit[11..10].

This can be covered by definitions of DRIVE_SLOW, DRIVE_FAST, and it's transparent to the API usage.

But driver strength are different in logical layer for different SoCs. Actually it's hard reading and caused some error before. As my understanding, difference can only exists in physical layer. Logical layer should keep consistent.

Quoted 4 lines
Quoted 1 line

And there's no sleep mode in PXA168.

Thus there will be no MFP_LPM_* usage in pxa168 board file.

It was touched in mfpr_lpm. Since LPM_INPUT is used by default. Those bits should not be touched if no requirement. I can use MFPR_FLOAT by default, so no_lpm can be avoided.

Quoted 4 lines
Quoted 1 line

Sleep mode bit is different in PXA910.

Example, like?

Bit 7 should be always on in PXA910.

Quoted 247 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

---

?arch/arm/mach-mmp/include/mach/mfp-mmp2.h ? | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa168.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa910.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp.h ? ? ? ?| ? 34 ----------------

--

Quoted 68 lines
Quoted 68 lines

---------

Review

Quoted 9 lines
?arch/arm/mach-mmp/mmp2.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa168.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa910.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/plat-pxa/include/plat/mfp.h ? ? ? ?| ? ?4 +++
?arch/arm/plat-pxa/mfp.c ? ? ? ? ? ? ? ? ? ? | ? 22 +++++++++++++++-

?9 files changed, 30 insertions(+), 57 deletions(-) ?delete mode 100644 arch/arm/mach-mmp/include/mach/mfp.h

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-mmp2.h

Quoted 15 lines

index 4ad3862..c66eaea 100644

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_MMP2_H
?#define __ASM_MACH_MFP_MMP2_H

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? MFP_CFG(GPIO0, AF0)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h

Quoted 15 lines

index 4621067..4aadbea 100644

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA168_H
?#define __ASM_MACH_MFP_PXA168_H

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x1 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x2 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x3 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? ? ? ? ? MFP_CFG(GPIO0, AF5)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h

arch/arm/mach-

Quoted 18 lines

index fbd7ee8..f5d33be 100644

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA910_H
?#define __ASM_MACH_MFP_PXA910_H

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

?/* UART2 */
?#define GPIO47_UART2_RXD ? ? ? MFP_CFG(GPIO47, AF6)

arch/arm/mach- renamed from arch/arm/mach-mmp/include/mach/mfp.h +0 -0

mmp/include/mach/mfp.h

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines

deleted file mode 100644
index 62e510e..0000000

arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -0
Quoted 8 lines

arch/arm/mach-mmp/include/mach/mfp.h line 7

Quoted 8 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -7
@@ -1,34 +0,0 @@
-#ifndef __ASM_MACH_MFP_H
-#define __ASM_MACH_MFP_H
-
-#include <plat/mfp.h>
-
-/*
- * NOTE: the MFPR register bit definitions on PXA168 processor

lines

Quoted 125 lines
Quoted 125 lines

are a

arch/arm/mach-mmp/include/mach/mfp.h line 8

Quoted 1 line
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -1
- * bit different from those on PXA3xx. ?Bit [7:10] are now reserved,

which

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
- * were SLEEP_OE_N, SLEEP_DATA, SLEEP_SEL and the LSB of DRIVE bits.
- *
- * To cope with this difference and re-use the pxa3xx mfp code as

much as

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 4 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -4
- * possible, we make the following compromise:
- *
- * 1. SLEEP_OE_N will always be programmed to '1' (by MFP_LPM_FLOAT)
- * 2. DRIVE strength definitions redefined to include the reserved

bit

arch/arm/mach-mmp/include/mach/mfp.h line 17

Quoted 2 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
- * ? ?- the reserved bit differs between pxa168 and pxa910, and the
- * ? ? ?MFP_DRIVE_* macros are individually defined in mfp-

pxa{168,910}.h

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 12 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -12
- * 3. Override MFP_CFG() and MFP_CFG_DRV()
- * 4. Drop the use of MFP_CFG_LPM() and MFP_CFG_X()
- */
-
-#undef MFP_CFG
-#undef MFP_CFG_DRV
-#undef MFP_CFG_LPM
-#undef MFP_CFG_X
-#undef MFP_CFG_DEFAULT
-
-#define MFP_CFG(pin, af) ? ? ? ? ? ? ? \
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_MEDIUM)

arch/arm/mach-mmp/include/mach/mfp.h line 32

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
-
-#define MFP_CFG_DRV(pin, af, drv) ? ? ?\
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_##drv)

arch/arm/plat-

Quoted 46 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
-
-#endif /* __ASM_MACH_MFP_H */
arch/arm/mach-mmp/mmp2.c +0 -0
index 8e6c3ac..14e6a23 100644
@@ -24,10 +24,10 @@

?#include <mach/cputype.h>
?#include <mach/irqs.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/gpio.h>
?#include <mach/devices.h>
?#include <mach/mmp2.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa168.c +0 -0
index 72b4e76..34df2b1 100644
@@ -24,7 +24,7 @@

?#include <mach/gpio.h>
?#include <mach/dma.h>
?#include <mach/devices.h>

arch/arm/mach-mmp/pxa168.c +1 -1
-#include <mach/mfp.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa910.c +0 -0
index 8f92ccd..93b3b25 100644
@@ -22,8 +22,8 @@

?#include <mach/irqs.h>
?#include <mach/gpio.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/devices.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/plat- renamed from arch/arm/plat-pxa/include/plat/mfp.h +0 -0

pxa/include/plat/mfp.h

arch/arm/plat-pxa/mfp.c static inline void __mfp_config_lpm(struct

Quoted 30 lines

index 75f6564..b7dde0c 100644

arch/arm/plat-pxa/include/plat/mfp.h +4 -0
@@ -378,6 +378,10 @@ typedef unsigned long mfp_cfg_t;
 ?#define MFP_DS13X ? ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS_MASK ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS(x) ? ? ? ? ? ? ?(((x) >> 13) & 0x7)
+#define MFP_VERY_SLOW ? ? ? ? ?MFP_DS01X
+#define MFP_SLOW ? ? ? ? ? ? ? MFP_DS02X
+#define MFP_MEDIUM ? ? ? ? ? ? MFP_DS03X
+#define MFP_FAST ? ? ? ? ? ? ? MFP_DS04X
 
 ?#define MFP_LPM_DEFAULT ? ? ? ? ? ? ? ?(0x0 << 16)
 ?#define MFP_LPM_DRIVE_LOW ? ? ?(0x1 << 16)
arch/arm/plat-pxa/mfp.c +0 -0
index a9aa5ad..d335551 100644
@@ -19,6 +19,10 @@

?#include <linux/io.h>
?#include <linux/sysdev.h>

arch/arm/plat-pxa/mfp.c +4 -0
+#ifdef CONFIG_ARCH_MMP
+#include <mach/cputype.h>
+#endif
+

?#include <plat/mfp.h>

?#define MFPR_SIZE ? ? ?(PAGE_SIZE)

arch/arm/plat-pxa/mfp.c +0 -0
@@ -165,8 +169,14 @@ static inline void __mfp_config_lpm(struct

mfp_pin *p)

Quoted 15 lines
arch/arm/plat-pxa/mfp.c +8 -2
 ?void mfp_config(unsigned long *mfp_cfgs, int num)
 ?{
 ? ? ? ?unsigned long flags;
- ? ? ? int i;
-
+ ? ? ? int i, drv_b11 = 0, no_lpm = 0;
+
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa910() || cpu_is_mmp2())
+ ? ? ? ? ? ? ? drv_b11 = 1;
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? no_lpm = 1;
+#endif
 ? ? ? ?spin_lock_irqsave(&mfp_spin_lock, flags);
 
Quoted 2 lines
Quoted 2 lines

arch/arm/plat-pxa/mfp.c void mfp_config(unsigned long *mfp_cfgs, int

Quoted 2 lines
arch/arm/plat-pxa/mfp.c +0 -0
 ? ? ? ?for (i = 0; i < num; i++, mfp_cfgs++) {
@@ -183,6 +193,10 @@ void mfp_config(unsigned long *mfp_cfgs, int

num)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
arch/arm/plat-pxa/mfp.c +4 -0
 ? ? ? ? ? ? ? ?lpm = MFP_LPM_STATE(c);
 ? ? ? ? ? ? ? ?edge = MFP_LPM_EDGE(c);
 ? ? ? ? ? ? ? ?pull = MFP_PULL(c);
+ ? ? ? ? ? ? ? if (drv_b11)
+ ? ? ? ? ? ? ? ? ? ? ? drv = drv << 1;
+ ? ? ? ? ? ? ? if (no_lpm)
+ ? ? ? ? ? ? ? ? ? ? ? lpm = 0;
 

? ? ? ? ? ? ? ?/* run-mode pull settings will conflict with MFPR

bits

Quoted 19 lines
Quoted 18 lines

of

Quoted 1 line

? ? ? ? ? ? ? ? * low power mode state, ?calculate mfpr_run and

mfpr_lpm

Quoted 15 lines
arch/arm/plat-pxa/mfp.c +4 -1
@@ -272,6 +286,10 @@ void mfp_config_lpm(void)
 ? ? ? ?struct mfp_pin *p = &mfp_table[0];
 ? ? ? ?int pin;
 
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? return;
+#endif
 ? ? ? ?for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++, p++)
 ? ? ? ? ? ? ? ?__mfp_config_lpm(p);
 ?}
--

1.5.6.5

#17 lore raw

PATCH 3/9 ARM: mmp: remove redundant macro definition in mfp

Quoted 50 lines · Haojian Zhuang
Quoted 50 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 1:31 PM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 3/9] ARM: mmp: remove redundant macro definition in mfp

Quoted 8 lines · Haojian Zhuang
Quoted 8 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 12:51 PM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 3/9] ARM: mmp: remove redundant macro definition

in

Quoted 4 lines
Quoted 4 lines

mfp

On Fri, Apr 1, 2011 at 10:39 AM, Haojian Zhuang
<[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

There're two layers in MFP implementation. One is MFP layer that is

logical

Quoted 1 line

pin setting. And the other is MFPR layer that is physical register

setting.

Quoted 2 lines

MFP drive setting is different between PXA168 and PXA910. But the

difference

Quoted 1 line

was stored in logical layer, not physical layer. And some

unnecessary

Quoted 16 lines
Quoted 6 lines

macro

Quoted 1 line

definition were added for ARCH_MMP.

The implementation is indeed a bit complicated, yet I don't see the change here is necessary so far.

Quoted 9 lines

The MFPR bit definitions for pxa168/910 and mmp2 are basically following the pxa3xx's.

And definitions like DRIVE_SLOW, DRIVE_VERY_SLOW are really pxa168/910, mmp2 specific. And it's no equivalent to DS01X, DS02X ..., which is more pxa3xx specific.

BTW, does the existing code cause any bug/limitation?

Yes, there's some limitation in existing code since it's for pxa3xx.

Quoted 9 lines
Quoted 6 lines

For example, driver strength is bit[12..10] in PXA3xx. In PXA955/910/MMP2, it's bit[12..11]. In PXA168, it's bit[11..10].

This can be covered by definitions of DRIVE_SLOW, DRIVE_FAST, and it's transparent to the API usage.

But driver strength are different in logical layer for different SoCs. Actually it's hard reading and caused some error before. As my understanding, difference can only exists in physical layer. Logical layer should keep consistent.

The problem is, the drive strength is already defined differently across SoCs. Like we defined:

_DRIVE_{VERY_SLOW, SLOW, MEDIUM, FAST} for MMP series _DS{01X,02X,03X,...08X, 10X, 13X} for pxa3xx

And there is no such thing for pxa2xx.

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

And there's no sleep mode in PXA168.

Thus there will be no MFP_LPM_* usage in pxa168 board file.

It was touched in mfpr_lpm. Since LPM_INPUT is used by default. Those bits should not be touched if no requirement. I can use MFPR_FLOAT by default, so no_lpm can be avoided.

Yes please.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Sleep mode bit is different in PXA910.

Example, like?

Bit 7 should be always on in PXA910.

Can we solve this in mfp-pxa910.h by defining a pxa910 specific MFP_CFG() macro?

Quoted 248 lines
Quoted 247 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

---

?arch/arm/mach-mmp/include/mach/mfp-mmp2.h ? | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa168.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp-pxa910.h | ? ?7 +----
?arch/arm/mach-mmp/include/mach/mfp.h ? ? ? ?| ? 34 ----------------

--

Quoted 68 lines
Quoted 68 lines

---------

Review

Quoted 9 lines
?arch/arm/mach-mmp/mmp2.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa168.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-mmp/pxa910.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/plat-pxa/include/plat/mfp.h ? ? ? ?| ? ?4 +++
?arch/arm/plat-pxa/mfp.c ? ? ? ? ? ? ? ? ? ? | ? 22 +++++++++++++++-

?9 files changed, 30 insertions(+), 57 deletions(-) ?delete mode 100644 arch/arm/mach-mmp/include/mach/mfp.h

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-mmp2.h

Quoted 15 lines

index 4ad3862..c66eaea 100644

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_MMP2_H
?#define __ASM_MACH_MFP_MMP2_H

arch/arm/mach-mmp/include/mach/mfp-mmp2.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? MFP_CFG(GPIO0, AF0)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h

Quoted 15 lines

index 4621067..4aadbea 100644

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA168_H
?#define __ASM_MACH_MFP_PXA168_H

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x1 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x2 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x3 << 13)
+#include <plat/mfp.h>

Review

Quoted 3 lines

?/* GPIO */
?#define GPIO0_GPIO ? ? ? ? ? ? MFP_CFG(GPIO0, AF5)

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/mfp-pxa910.h

arch/arm/mach-

Quoted 18 lines

index fbd7ee8..f5d33be 100644

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +0 -0
@@ -1,12 +1,7 @@

?#ifndef __ASM_MACH_MFP_PXA910_H
?#define __ASM_MACH_MFP_PXA910_H

arch/arm/mach-mmp/include/mach/mfp-pxa910.h +1 -6
-#include <mach/mfp.h>
-
-#define MFP_DRIVE_VERY_SLOW ? ?(0x0 << 13)
-#define MFP_DRIVE_SLOW ? ? ? ? (0x2 << 13)
-#define MFP_DRIVE_MEDIUM ? ? ? (0x4 << 13)
-#define MFP_DRIVE_FAST ? ? ? ? (0x6 << 13)
+#include <plat/mfp.h>

?/* UART2 */
?#define GPIO47_UART2_RXD ? ? ? MFP_CFG(GPIO47, AF6)

arch/arm/mach- renamed from arch/arm/mach-mmp/include/mach/mfp.h +0 -0

mmp/include/mach/mfp.h

Quoted 12 lines
Quoted 4 lines
Quoted 4 lines

deleted file mode 100644
index 62e510e..0000000

arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -0
Quoted 8 lines

arch/arm/mach-mmp/include/mach/mfp.h line 7

Quoted 8 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -7
@@ -1,34 +0,0 @@
-#ifndef __ASM_MACH_MFP_H
-#define __ASM_MACH_MFP_H
-
-#include <plat/mfp.h>
-
-/*
- * NOTE: the MFPR register bit definitions on PXA168 processor

lines

Quoted 125 lines
Quoted 125 lines

are a

arch/arm/mach-mmp/include/mach/mfp.h line 8

Quoted 1 line
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -1
- * bit different from those on PXA3xx. ?Bit [7:10] are now reserved,

which

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
- * were SLEEP_OE_N, SLEEP_DATA, SLEEP_SEL and the LSB of DRIVE bits.
- *
- * To cope with this difference and re-use the pxa3xx mfp code as

much as

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 4 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -4
- * possible, we make the following compromise:
- *
- * 1. SLEEP_OE_N will always be programmed to '1' (by MFP_LPM_FLOAT)
- * 2. DRIVE strength definitions redefined to include the reserved

bit

arch/arm/mach-mmp/include/mach/mfp.h line 17

Quoted 2 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
- * ? ?- the reserved bit differs between pxa168 and pxa910, and the
- * ? ? ?MFP_DRIVE_* macros are individually defined in mfp-

pxa{168,910}.h

arch/arm/mach-mmp/include/mach/mfp.h

Quoted 12 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -12
- * 3. Override MFP_CFG() and MFP_CFG_DRV()
- * 4. Drop the use of MFP_CFG_LPM() and MFP_CFG_X()
- */
-
-#undef MFP_CFG
-#undef MFP_CFG_DRV
-#undef MFP_CFG_LPM
-#undef MFP_CFG_X
-#undef MFP_CFG_DEFAULT
-
-#define MFP_CFG(pin, af) ? ? ? ? ? ? ? \
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_MEDIUM)

arch/arm/mach-mmp/include/mach/mfp.h line 32

Quoted 3 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -3
-
-#define MFP_CFG_DRV(pin, af, drv) ? ? ?\
- ? ? ? (MFP_LPM_FLOAT | MFP_PIN(MFP_PIN_##pin) | MFP_##af |

MFP_DRIVE_##drv)

arch/arm/plat-

Quoted 46 lines
arch/arm/mach-mmp/include/mach/mfp.h deleted +0 -2
-
-#endif /* __ASM_MACH_MFP_H */
arch/arm/mach-mmp/mmp2.c +0 -0
index 8e6c3ac..14e6a23 100644
@@ -24,10 +24,10 @@

?#include <mach/cputype.h>
?#include <mach/irqs.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/gpio.h>
?#include <mach/devices.h>
?#include <mach/mmp2.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa168.c +0 -0
index 72b4e76..34df2b1 100644
@@ -24,7 +24,7 @@

?#include <mach/gpio.h>
?#include <mach/dma.h>
?#include <mach/devices.h>

arch/arm/mach-mmp/pxa168.c +1 -1
-#include <mach/mfp.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/mach-mmp/pxa910.c +0 -0
index 8f92ccd..93b3b25 100644
@@ -22,8 +22,8 @@

?#include <mach/irqs.h>
?#include <mach/gpio.h>
?#include <mach/dma.h>
-#include <mach/mfp.h>
?#include <mach/devices.h>
+#include <plat/mfp.h>

?#include "common.h"
?#include "clock.h"

arch/arm/plat- renamed from arch/arm/plat-pxa/include/plat/mfp.h +0 -0

pxa/include/plat/mfp.h

arch/arm/plat-pxa/mfp.c static inline void __mfp_config_lpm(struct

Quoted 30 lines

index 75f6564..b7dde0c 100644

arch/arm/plat-pxa/include/plat/mfp.h +4 -0
@@ -378,6 +378,10 @@ typedef unsigned long mfp_cfg_t;
 ?#define MFP_DS13X ? ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS_MASK ? ? ? ? ? ?(0x7 << 13)
 ?#define MFP_DS(x) ? ? ? ? ? ? ?(((x) >> 13) & 0x7)
+#define MFP_VERY_SLOW ? ? ? ? ?MFP_DS01X
+#define MFP_SLOW ? ? ? ? ? ? ? MFP_DS02X
+#define MFP_MEDIUM ? ? ? ? ? ? MFP_DS03X
+#define MFP_FAST ? ? ? ? ? ? ? MFP_DS04X
 
 ?#define MFP_LPM_DEFAULT ? ? ? ? ? ? ? ?(0x0 << 16)
 ?#define MFP_LPM_DRIVE_LOW ? ? ?(0x1 << 16)
arch/arm/plat-pxa/mfp.c +0 -0
index a9aa5ad..d335551 100644
@@ -19,6 +19,10 @@

?#include <linux/io.h>
?#include <linux/sysdev.h>

arch/arm/plat-pxa/mfp.c +4 -0
+#ifdef CONFIG_ARCH_MMP
+#include <mach/cputype.h>
+#endif
+

?#include <plat/mfp.h>

?#define MFPR_SIZE ? ? ?(PAGE_SIZE)

arch/arm/plat-pxa/mfp.c +0 -0
@@ -165,8 +169,14 @@ static inline void __mfp_config_lpm(struct

mfp_pin *p)

Quoted 15 lines
arch/arm/plat-pxa/mfp.c +8 -2
 ?void mfp_config(unsigned long *mfp_cfgs, int num)
 ?{
 ? ? ? ?unsigned long flags;
- ? ? ? int i;
-
+ ? ? ? int i, drv_b11 = 0, no_lpm = 0;
+
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa910() || cpu_is_mmp2())
+ ? ? ? ? ? ? ? drv_b11 = 1;
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? no_lpm = 1;
+#endif
 ? ? ? ?spin_lock_irqsave(&mfp_spin_lock, flags);
 
Quoted 2 lines
Quoted 2 lines

arch/arm/plat-pxa/mfp.c void mfp_config(unsigned long *mfp_cfgs, int

Quoted 2 lines
arch/arm/plat-pxa/mfp.c +0 -0
 ? ? ? ?for (i = 0; i < num; i++, mfp_cfgs++) {
@@ -183,6 +193,10 @@ void mfp_config(unsigned long *mfp_cfgs, int

num)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
arch/arm/plat-pxa/mfp.c +4 -0
 ? ? ? ? ? ? ? ?lpm = MFP_LPM_STATE(c);
 ? ? ? ? ? ? ? ?edge = MFP_LPM_EDGE(c);
 ? ? ? ? ? ? ? ?pull = MFP_PULL(c);
+ ? ? ? ? ? ? ? if (drv_b11)
+ ? ? ? ? ? ? ? ? ? ? ? drv = drv << 1;
+ ? ? ? ? ? ? ? if (no_lpm)
+ ? ? ? ? ? ? ? ? ? ? ? lpm = 0;
 

? ? ? ? ? ? ? ?/* run-mode pull settings will conflict with MFPR

bits

Quoted 19 lines
Quoted 18 lines

of

Quoted 1 line

? ? ? ? ? ? ? ? * low power mode state, ?calculate mfpr_run and

mfpr_lpm

Quoted 15 lines
arch/arm/plat-pxa/mfp.c +4 -1
@@ -272,6 +286,10 @@ void mfp_config_lpm(void)
 ? ? ? ?struct mfp_pin *p = &mfp_table[0];
 ? ? ? ?int pin;
 
+#ifdef CONFIG_ARCH_MMP
+ ? ? ? if (cpu_is_pxa168() || cpu_is_pxa910())
+ ? ? ? ? ? ? ? return;
+#endif
 ? ? ? ?for (pin = 0; pin < ARRAY_SIZE(mfp_table); pin++, p++)
 ? ? ? ? ? ? ? ?__mfp_config_lpm(p);
 ?}
--

1.5.6.5

#18 lore raw

PATCH 2/9 ARM: pxa: enable sparsemem in saarb

In reply to Haojian Zhuang
Quoted 4 lines · Haojian Zhuang

Make sparsemem to support 512MB low memory with two banks in SAARB.

Change-Id I1688dde366b5f3b13b48b7167bf6b88afc4f9a92

The concern is that this will exclude SAARB from being built into a single binary with other boards. Did you ever try HIGHMEM?

Quoted 72 lines

---
?arch/arm/mach-pxa/Kconfig ? ? ? ? ? ? ? | ? ?1 + ?arch/arm/mach-pxa/include/mach/memory.h | ? 36 ++++++++++++++++++++++++++++++- ?2 files changed, 36 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/Kconfig +0 -0
index 2fc9f94..e8615ee 100644
@@ -53,6 +53,7 @@ config MACH_SAAR

?config MACH_SAARB
? ? ? ?bool "PXA955 Handheld Platform (aka SAARB)" ? ? ? ?select CPU_PXA955
+ ? ? ? select ARCH_SPARSEMEM_ENABLE

?comment "Third Party Dev Platforms (sorted by vendor name)"

arch/arm/mach-pxa/include/mach/memory.h +0 -0
index 92361a6..9a3f265 100644
@@ -3,6 +3,7 @@

?*
?* Author: ? ? Nicolas Pitre
?* Copyright: ?(C) 2001 MontaVista Software Inc.
+ * Copyright: ?(C) 2010 Marvell Semiconductor Inc.
?*
?* This program is free software; you can redistribute it and/or modify ?* it under the terms of the GNU General Public License version 2 as

arch/arm/mach-pxa/include/mach/memory.h +0 -0
@@ -27,4 +28,37 @@ void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);
 ?#define MAX_DMA_ADDRESS ? ? ? ? ? ? ? ?(PAGE_OFFSET + SZ_64M)

?#endif

arch/arm/mach-pxa/include/mach/memory.h +34 -2
-#endif
+
+#ifdef CONFIG_SPARSEMEM
+
+#if defined(CONFIG_MACH_SAARB) || defined(CONFIG_MACH_SAARB_MG1)
+/*
+ * There're two DRAM banks in PXA955 Saarb board.
+ *
+ * The macros below define sections with 256MB size and a non-linear virtual to
+ * physical mapping:
+ *
+ * node 0: 0x80000000-0x8fffffff -> 0xc0000000-0xcfffffff
+ * node 1: 0xc0000000-0xcfffffff -> 0xd0000000-0xdfffffff
+ *
+ * Since DRAM can be wrapped, 0xa0000000 equals to 0x80000000.
+ */
+#define MAX_PHYSMEM_BITS ? ? ? 32
+#define SECTION_SIZE_BITS ? ? ?28
+
+/* bank page offsets */
+#define BANK_PAGE_OFFSET ? ? ? (PAGE_OFFSET + 0x10000000)
+
+#define __phys_to_virt(phys) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? ((phys) >= 0xc0000000 ? (phys) - 0xc0000000 + BANK_PAGE_OFFSET :\
+ ? ? ? ?(phys) >= 0xa0000000 ? (phys) - 0xa0000000 + PAGE_OFFSET : ? ? \
+ ? ? ? ?(phys) - 0x80000000 + PAGE_OFFSET) ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
+
+#define __virt_to_phys(virt) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
+ ? ? ? ((virt) >= BANK_PAGE_OFFSET ? (virt) - BANK_PAGE_OFFSET + 0xc0000000 :\
+ ? ? ? ?(virt) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
+#endif /* CONFIG_MACH_SAARB || CONFIG_MACH_SAARB_MG1 */
+
+#endif /* CONFIG_SPARSEMEM */
+
+#endif /* __ASM_ARCH_MEMORY_H */
--

1.5.6.5

#19 lore raw

PATCH 2/9 ARM: pxa: enable sparsemem in saarb

Quoted 11 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 11:46 AM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 2/9] ARM: pxa: enable sparsemem in saarb

On Fri, Apr 1, 2011 at 10:39 AM, Haojian Zhuang
<[email protected]> wrote:

Quoted 9 lines
Quoted 4 lines

Make sparsemem to support 512MB low memory with two banks in SAARB.

Change-Id I1688dde366b5f3b13b48b7167bf6b88afc4f9a92

The concern is that this will exclude SAARB from being built into a single
binary with other boards. Did you ever try HIGHMEM?

If I use HIGHMEM now, our some drivers and apps should be changed also. We don't want to change them.

Quoted 83 lines
Quoted 3 lines

---
?arch/arm/mach-pxa/Kconfig ? ? ? ? ? ? ? | ? ?1 +
?arch/arm/mach-pxa/include/mach/memory.h | ? 36

++++++++++++++++++++++++++++++-

arch/arm/mach-

Quoted 15 lines

?2 files changed, 36 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/Kconfig +0 -0
index 2fc9f94..e8615ee 100644
@@ -53,6 +53,7 @@ config MACH_SAAR

?config MACH_SAARB
? ? ? ?bool "PXA955 Handheld Platform (aka SAARB)" ? ? ? ?select CPU_PXA955
+ ? ? ? select ARCH_SPARSEMEM_ENABLE

?comment "Third Party Dev Platforms (sorted by vendor name)"

arch/arm/mach- renamed from arch/arm/mach-pxa/include/mach/memory.h +0 -0

pxa/include/mach/memory.h

Quoted 10 lines

index 92361a6..9a3f265 100644

arch/arm/mach-pxa/include/mach/memory.h +0 -0
@@ -3,6 +3,7 @@

?*
?* Author: ? ? Nicolas Pitre
?* Copyright: ?(C) 2001 MontaVista Software Inc.
+ * Copyright: ?(C) 2010 Marvell Semiconductor Inc.
?*
?* This program is free software; you can redistribute it and/or

modify

arch/arm/mach-pxa/include/mach/memory.h void cmx2xx_pci_adjust_zones(unsigned long *size,

Quoted 2 lines

?* it under the terms of the GNU General Public License version 2 as

arch/arm/mach-pxa/include/mach/memory.h +0 -0
@@ -27,4 +28,37 @@ void cmx2xx_pci_adjust_zones(unsigned long *size,

unsigned long *holes);

arch/arm/mach-pxa/include/mach/memory.h void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);

Quoted 12 lines
arch/arm/mach-pxa/include/mach/memory.h +0 -0
 ?#define MAX_DMA_ADDRESS ? ? ? ? ? ? ? ?(PAGE_OFFSET + SZ_64M)

?#endif

arch/arm/mach-pxa/include/mach/memory.h +8 -1
-#endif
+
+#ifdef CONFIG_SPARSEMEM
+
+#if defined(CONFIG_MACH_SAARB) || defined(CONFIG_MACH_SAARB_MG1)
+/*
+ * There're two DRAM banks in PXA955 Saarb board.
+ *
+ * The macros below define sections with 256MB size and a non-linear

virtual to

Quoted 7 lines

+ * physical mapping:
+ *
+ * node 0: 0x80000000-0x8fffffff -> 0xc0000000-0xcfffffff
+ * node 1: 0xc0000000-0xcfffffff -> 0xd0000000-0xdfffffff
+ *
+ * Since DRAM can be wrapped, 0xa0000000 equals to 0x80000000.
+ */

arch/arm/mach-pxa/include/mach/memory.h

Quoted 7 lines
arch/arm/mach-pxa/include/mach/memory.h +7 -0
+#define MAX_PHYSMEM_BITS ? ? ? 32
+#define SECTION_SIZE_BITS ? ? ?28
+
+/* bank page offsets */
+#define BANK_PAGE_OFFSET ? ? ? (PAGE_OFFSET + 0x10000000)
+
+#define

__phys_to_virt(phys) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

Quoted 1 line

+ ? ? ? ((phys) >= 0xc0000000 ? (phys) - 0xc0000000 +

BANK_PAGE_OFFSET :\

Quoted 1 line

+ ? ? ? ?(phys) >= 0xa0000000 ? (phys) - 0xa0000000 +

PAGE_OFFSET : ? ? \

Quoted 1 line

+ ? ? ? ?(phys) - 0x80000000 +

PAGE_OFFSET) ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

arch/arm/mach-pxa/include/mach/memory.h

Quoted 2 lines
arch/arm/mach-pxa/include/mach/memory.h +2 -0
+
+#define

__virt_to_phys(virt) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

Quoted 1 line

+ ? ? ? ((virt) >= BANK_PAGE_OFFSET ? (virt) - BANK_PAGE_OFFSET +

0xc0000000 :\

Quoted 10 lines

+ ? ? ? ?(virt) - PAGE_OFFSET + PLAT_PHYS_OFFSET)

arch/arm/mach-pxa/include/mach/memory.h +5 -1
+#endif /* CONFIG_MACH_SAARB || CONFIG_MACH_SAARB_MG1 */
+
+#endif /* CONFIG_SPARSEMEM */
+
+#endif /* __ASM_ARCH_MEMORY_H */
--

1.5.6.5

#20 lore raw

PATCH 2/9 ARM: pxa: enable sparsemem in saarb

Quoted 13 lines · Haojian Zhuang
Quoted 13 lines

-----Original Message-----
From: Eric Miao [mailto:eric.y.miao at gmail.com]
Sent: 2011?4?1? 11:46 AM
To: Haojian Zhuang
Cc: linux at arm.linux.org.uk; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH 2/9] ARM: pxa: enable sparsemem in saarb

Quoted 2 lines · Haojian Zhuang

Make sparsemem to support 512MB low memory with two banks in SAARB.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
Change-Id I1688dde366b5f3b13b48b7167bf6b88afc4f9a92

The concern is that this will exclude SAARB from being built into a single
binary with other boards. Did you ever try HIGHMEM?

If I use HIGHMEM now, our some drivers and apps should be changed also. We don't want to change them.

I don't understand this will cause side effects to other drivers and apps?

Quoted 85 lines
Quoted 84 lines
Quoted 4 lines

---
?arch/arm/mach-pxa/Kconfig ? ? ? ? ? ? ? | ? ?1 +
?arch/arm/mach-pxa/include/mach/memory.h | ? 36

++++++++++++++++++++++++++++++-

arch/arm/mach-

Quoted 15 lines

?2 files changed, 36 insertions(+), 1 deletions(-)

arch/arm/mach-pxa/Kconfig +0 -0
index 2fc9f94..e8615ee 100644
@@ -53,6 +53,7 @@ config MACH_SAAR

?config MACH_SAARB
? ? ? ?bool "PXA955 Handheld Platform (aka SAARB)" ? ? ? ?select CPU_PXA955
+ ? ? ? select ARCH_SPARSEMEM_ENABLE

?comment "Third Party Dev Platforms (sorted by vendor name)"

arch/arm/mach- renamed from arch/arm/mach-pxa/include/mach/memory.h +0 -0

pxa/include/mach/memory.h

Quoted 10 lines

index 92361a6..9a3f265 100644

arch/arm/mach-pxa/include/mach/memory.h +0 -0
@@ -3,6 +3,7 @@

?*
?* Author: ? ? Nicolas Pitre
?* Copyright: ?(C) 2001 MontaVista Software Inc.
+ * Copyright: ?(C) 2010 Marvell Semiconductor Inc.
?*
?* This program is free software; you can redistribute it and/or

modify

arch/arm/mach-pxa/include/mach/memory.h void cmx2xx_pci_adjust_zones(unsigned long *size,

Quoted 2 lines

?* it under the terms of the GNU General Public License version 2 as

arch/arm/mach-pxa/include/mach/memory.h +0 -0
@@ -27,4 +28,37 @@ void cmx2xx_pci_adjust_zones(unsigned long *size,

unsigned long *holes);

arch/arm/mach-pxa/include/mach/memory.h void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);

Quoted 12 lines
arch/arm/mach-pxa/include/mach/memory.h +0 -0
 ?#define MAX_DMA_ADDRESS ? ? ? ? ? ? ? ?(PAGE_OFFSET + SZ_64M)

?#endif

arch/arm/mach-pxa/include/mach/memory.h +8 -1
-#endif
+
+#ifdef CONFIG_SPARSEMEM
+
+#if defined(CONFIG_MACH_SAARB) || defined(CONFIG_MACH_SAARB_MG1)
+/*
+ * There're two DRAM banks in PXA955 Saarb board.
+ *
+ * The macros below define sections with 256MB size and a non-linear

virtual to

Quoted 7 lines

+ * physical mapping:
+ *
+ * node 0: 0x80000000-0x8fffffff -> 0xc0000000-0xcfffffff
+ * node 1: 0xc0000000-0xcfffffff -> 0xd0000000-0xdfffffff
+ *
+ * Since DRAM can be wrapped, 0xa0000000 equals to 0x80000000.
+ */

arch/arm/mach-pxa/include/mach/memory.h

Quoted 7 lines
arch/arm/mach-pxa/include/mach/memory.h +7 -0
+#define MAX_PHYSMEM_BITS ? ? ? 32
+#define SECTION_SIZE_BITS ? ? ?28
+
+/* bank page offsets */
+#define BANK_PAGE_OFFSET ? ? ? (PAGE_OFFSET + 0x10000000)
+
+#define

__phys_to_virt(phys) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

Quoted 1 line

+ ? ? ? ((phys) >= 0xc0000000 ? (phys) - 0xc0000000 +

BANK_PAGE_OFFSET :\

Quoted 1 line

+ ? ? ? ?(phys) >= 0xa0000000 ? (phys) - 0xa0000000 +

PAGE_OFFSET : ? ? \

Quoted 1 line

+ ? ? ? ?(phys) - 0x80000000 +

PAGE_OFFSET) ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

arch/arm/mach-pxa/include/mach/memory.h

Quoted 2 lines
arch/arm/mach-pxa/include/mach/memory.h +2 -0
+
+#define

__virt_to_phys(virt) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

Quoted 1 line

+ ? ? ? ((virt) >= BANK_PAGE_OFFSET ? (virt) - BANK_PAGE_OFFSET +

0xc0000000 :\

Quoted 10 lines

+ ? ? ? ?(virt) - PAGE_OFFSET + PLAT_PHYS_OFFSET)

arch/arm/mach-pxa/include/mach/memory.h +5 -1
+#endif /* CONFIG_MACH_SAARB || CONFIG_MACH_SAARB_MG1 */
+
+#endif /* CONFIG_SPARSEMEM */
+
+#endif /* __ASM_ARCH_MEMORY_H */
--

1.5.6.5

#21 lore raw

PATCH 2/9 ARM: pxa: enable sparsemem in saarb

Quoted 4 lines · Eric Miao
Quoted 1 line · Haojian Zhuang

If I use HIGHMEM now, our some drivers and apps should be changed also. We don't want to change them.

I don't understand this will cause side effects to other drivers and apps?

If they're not using kmap_atomic() but are dealing directly with page addresses, they'll fail if the pages are coming from highmem.

Given Linus' complaints in the OMAP pull request thread, I think we should refuse, and have the drivers fixed to work with highmem.

#22 lore raw

PATCH 2/9 ARM: pxa: enable sparsemem in saarb

Quoted 4 lines · Russell King - ARM Linux
Quoted 3 lines · Eric Miao
Quoted 1 line · Haojian Zhuang

If I use HIGHMEM now, our some drivers and apps should be changed also. We don't want to change them.

Quoted 8 lines
Quoted 1 line

I don't understand this will cause side effects to other drivers and apps?

If they're not using kmap_atomic() but are dealing directly with page addresses, they'll fail if the pages are coming from highmem.

Given Linus' complaints in the OMAP pull request thread, I think we should refuse, and have the drivers fixed to work with highmem.

That's what I thought as well.

Haojian,

Please work on enabling highmem, anything that's going to prevent us from having a single kernel binary, will just make the situation worse. Thanks

#23 lore raw

PATCH 2/9 ARM: pxa: enable sparsemem in saarb

In reply to Haojian Zhuang
Quoted 57 lines · Haojian Zhuang

Make sparsemem to support 512MB low memory with two banks in SAARB.

Change-Id I1688dde366b5f3b13b48b7167bf6b88afc4f9a92
---
 arch/arm/mach-pxa/Kconfig               |    1 +
 arch/arm/mach-pxa/include/mach/memory.h |   36 ++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletions(-)
arch/arm/mach-pxa/Kconfig +1 -0
index 2fc9f94..e8615ee 100644
@@ -53,6 +53,7 @@ config MACH_SAAR
 config MACH_SAARB
 	bool "PXA955 Handheld Platform (aka SAARB)"
 	select CPU_PXA955
+	select ARCH_SPARSEMEM_ENABLE
 
 comment "Third Party Dev Platforms (sorted by vendor name)"
 
arch/arm/mach-pxa/include/mach/memory.h +20 -1
index 92361a6..9a3f265 100644
@@ -3,6 +3,7 @@
  *
  * Author:	Nicolas Pitre
  * Copyright:	(C) 2001 MontaVista Software Inc.
+ * Copyright:	(C) 2010 Marvell Semiconductor Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -27,4 +28,37 @@ void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);
 #define MAX_DMA_ADDRESS		(PAGE_OFFSET + SZ_64M)
 #endif
 
-#endif
+
+#ifdef CONFIG_SPARSEMEM
+
+#if defined(CONFIG_MACH_SAARB) || defined(CONFIG_MACH_SAARB_MG1)
+/*
+ * There're two DRAM banks in PXA955 Saarb board.
+ *
+ * The macros below define sections with 256MB size and a non-linear virtual to
+ * physical mapping:
+ *
+ * node 0: 0x80000000-0x8fffffff -> 0xc0000000-0xcfffffff
+ * node 1: 0xc0000000-0xcfffffff -> 0xd0000000-0xdfffffff
+ *
+ * Since DRAM can be wrapped, 0xa0000000 equals to 0x80000000.
+ */
+#define MAX_PHYSMEM_BITS	32
+#define SECTION_SIZE_BITS	28
+
+/* bank page offsets */

arch/arm/mach-pxa/include/mach/memory.h void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes); · line 59

Quoted 10 lines
arch/arm/mach-pxa/include/mach/memory.h +10 -0
+#define BANK_PAGE_OFFSET	(PAGE_OFFSET + 0x10000000)
+
+#define __phys_to_virt(phys)						\
+	((phys) >= 0xc0000000 ? (phys) - 0xc0000000 + BANK_PAGE_OFFSET :\
+	 (phys) >= 0xa0000000 ? (phys) - 0xa0000000 + PAGE_OFFSET :	\
+	 (phys) - 0x80000000 + PAGE_OFFSET)				\
+
+#define __virt_to_phys(virt)						\
+	((virt) >= BANK_PAGE_OFFSET ? (virt) - BANK_PAGE_OFFSET + 0xc0000000 :\
+	 (virt) - PAGE_OFFSET + PLAT_PHYS_OFFSET)

This immediately means that you can't use the dynamic P2V stuff on PXA, and so PXA can't be integrated with any other platform. Is there a reason why you can't use highmem rather than squashing both 256MB banks into one 512MB region?

#24 lore raw

PATCH 1/9 ARM: pxa: add clk_set_rate()

In reply to Haojian Zhuang
Quoted 4 lines · Haojian Zhuang

Since there're mulitple clock rates in some device controllers, enable clk_set_rate() for this usage.

OK, looks good.

Quoted 84 lines

---

?arch/arm/mach-mmp/clock.c | ? 15 +++++++++++++++
?arch/arm/mach-mmp/clock.h | ? ?1 +
?arch/arm/mach-pxa/clock.c | ? 15 +++++++++++++++
?arch/arm/mach-pxa/clock.h | ? ?1 +

?4 files changed, 32 insertions(+), 0 deletions(-)

arch/arm/mach-mmp/clock.c +15 -0
index 886e056..7c6f95f 100644
@@ -88,3 +88,18 @@ unsigned long clk_get_rate(struct clk *clk)
 ? ? ? ?return rate;
 ?}
 ?EXPORT_SYMBOL(clk_get_rate);
+
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+ ? ? ? unsigned long flags;
+ ? ? ? int ret = -EINVAL;
+
+ ? ? ? if (clk->ops->setrate) {
+ ? ? ? ? ? ? ? spin_lock_irqsave(&clocks_lock, flags);
+ ? ? ? ? ? ? ? ret = clk->ops->setrate(clk, rate);
+ ? ? ? ? ? ? ? spin_unlock_irqrestore(&clocks_lock, flags);
+ ? ? ? }
+
+ ? ? ? return ret;
+}
+EXPORT_SYMBOL(clk_set_rate);
arch/arm/mach-mmp/clock.h +1 -0
index 9b027d7..3143e99 100644
@@ -12,6 +12,7 @@ struct clkops {
 ? ? ? ?void ? ? ? ? ? ? ? ? ? ?(*enable)(struct clk *);
 ? ? ? ?void ? ? ? ? ? ? ? ? ? ?(*disable)(struct clk *);
 ? ? ? ?unsigned long ? ? ? ? ? (*getrate)(struct clk *);
+ ? ? ? int ? ? ? ? ? ? ? ? ? ? (*setrate)(struct clk *, unsigned long);
 ?};
 
 ?struct clk {
arch/arm/mach-pxa/clock.c +15 -0
index d515222..4d46610 100644
@@ -53,6 +53,21 @@ unsigned long clk_get_rate(struct clk *clk)
 ?}
 ?EXPORT_SYMBOL(clk_get_rate);
 
+int clk_set_rate(struct clk *clk, unsigned long rate)
+{
+ ? ? ? unsigned long flags;
+ ? ? ? int ret = -EINVAL;
+
+ ? ? ? if (clk->ops->setrate) {
+ ? ? ? ? ? ? ? spin_lock_irqsave(&clocks_lock, flags);
+ ? ? ? ? ? ? ? ret = clk->ops->setrate(clk, rate);
+ ? ? ? ? ? ? ? spin_unlock_irqrestore(&clocks_lock, flags);
+ ? ? ? }
+
+ ? ? ? return ret;
+}
+EXPORT_SYMBOL(clk_set_rate);
+
 ?void clk_dummy_enable(struct clk *clk)
 ?{
 ?}
arch/arm/mach-pxa/clock.h +1 -1
index f9f349a..7373853 100644
@@ -5,6 +5,7 @@ struct clkops {
 ? ? ? ?void ? ? ? ? ? ? ? ? ? ?(*enable)(struct clk *);
 ? ? ? ?void ? ? ? ? ? ? ? ? ? ?(*disable)(struct clk *);
 ? ? ? ?unsigned long ? ? ? ? ? (*getrate)(struct clk *);
+ ? ? ? int ? ? ? ? ? ? ? ? ? ? (*setrate)(struct clk *, unsigned long);
 ?};
 
 ?struct clk {
--

1.5.6.5