Skip to contentSkip to conversation

Omap3 updates for the merge window after 2.6.29

PATCH In review Tony Lindgren 6 participants 49 messages Mar 10, 2009 – May 12, 2009

Subsystems (16)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover Omap3 updates for the merge window after 2.6.29

Hi all,

Here are the patches I promised last week, sorry for the delay in posting them. I ended up leaving out the mach-omap3/board-*.c files as they still need a bit of work.

I may post one more series after this to add few more omap3 boards if we have enough time.

Cheers,

Tony

---

Adrian Hunter (3):
ARM: OMAP3: mmc-twl4030 allow arbitrary slot names
ARM: OMAP3: mmc-twl4030 add cover switch
ARM: OMAP3: mmc-twl4030 fix name buffer length

David Brownell (3):
ARM: OMAP3: mmc-twl4030 fix for vmmc = 0
ARM: OMAP3: mmc-twl4030 init passes device nodes back
ARM: OMAP3: mmc-twl4030 voltage cleanup

Felipe Balbi (1):
ARM: OMAP3: MUSB initialization for omap hw

Grazvydas Ignotas (1):
ARM: OMAP3: mmc-twl4030 add MMC3 support

Jarkko Nikula (1):
ARM: OMAP3: Remove unused CONFIG_I2C2_OMAP_BEAGLE

Juha Yrjola (1):
ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Tony Lindgren (2):
ARM: OMAP3: Add base address definitions and resources for OMAP 3 IS
ARM: OMAP3: Add more GPIO mux options

 arch/arm/mach-omap2/Makefile               |    2 
 arch/arm/mach-omap2/board-2430sdp.c        |    2 
 arch/arm/mach-omap2/board-ldp.c            |    2 
 arch/arm/mach-omap2/board-omap3beagle.c    |    5 -
 arch/arm/mach-omap2/board-omap3pandora.c   |    9 +
 arch/arm/mach-omap2/board-overo.c          |    3 
 arch/arm/mach-omap2/devices.c              |  108 ++++++++++++++++
 arch/arm/mach-omap2/mmc-twl4030.c          |  186 ++++++++++++++++++++--------
 arch/arm/mach-omap2/mmc-twl4030.h          |    6 +
 arch/arm/mach-omap2/mux.c                  |   27 ++++
 arch/arm/mach-omap2/prcm.c                 |   14 ++
 arch/arm/mach-omap2/usb-musb.c             |  185 ++++++++++++++++++++++++++++
 arch/arm/plat-omap/devices.c               |    3 
 arch/arm/plat-omap/include/mach/control.h  |    9 +
 arch/arm/plat-omap/include/mach/mmc.h      |    2 
 arch/arm/plat-omap/include/mach/mux.h      |   13 ++
 arch/arm/plat-omap/include/mach/omap34xx.h |   27 ++++
 arch/arm/plat-omap/include/mach/usb.h      |    8 +
 18 files changed, 549 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm/mach-omap2/usb-musb.c
Signature · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/12 ARM: OMAP3: Remove unused CONFIG_I2C2_OMAP_BEAGLE

From: Jarkko Nikula <[email protected]>

There is no CONFIG_I2C2_OMAP_BEAGLE in mainline and it is under removal in linux-omap also so remove this dead code now.

---
 arch/arm/mach-omap2/board-omap3beagle.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/board-omap3beagle.c +0 -3
index e39cd2c..e3c8628 100644
@@ -175,9 +175,6 @@ static int __init omap3_beagle_i2c_init(void)
 {
 	omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo,
 			ARRAY_SIZE(beagle_i2c_boardinfo));
-#ifdef CONFIG_I2C2_OMAP_BEAGLE
-	omap_register_i2c_bus(2, 400, NULL, 0);
-#endif
 	/* Bus 3 is attached to the DVI port where devices like the pico DLP
 	 * projector don't work reliably with 400kHz */
 	omap_register_i2c_bus(3, 100, NULL, 0);
author maintainer
#2 lore raw

PATCH 2/12 ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

In reply to Tony Lindgren

From: Juha Yrjola <[email protected]>

The reboot mode can be communicated to a bootloader (or the kernel itself) with a scratchpad register. This functionality is especially useful, if userspace is allowed to change the reboot mode.

Patch updated by Tony to also define the BOODMOD registers.

---
 arch/arm/mach-omap2/prcm.c                |   14 ++++++++++++--
 arch/arm/plat-omap/include/mach/control.h |    9 +++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/prcm.c +12 -2
index f945156..12c0e03 100644
@@ -19,6 +19,7 @@
 #include <linux/io.h>
 
 #include <mach/common.h>
+#include <mach/control.h>
 #include <mach/prcm.h>
 
 #include "clock.h"
@@ -43,9 +44,18 @@ void omap_prcm_arch_reset(char mode)
 
 	if (cpu_is_omap24xx())
 		prcm_offs = WKUP_MOD;
-	else if (cpu_is_omap34xx())
+	else if (cpu_is_omap34xx()) {
+		u32 l;
+
 		prcm_offs = OMAP3430_GR_MOD;
-	else
+		l = ('B' << 24) | ('M' << 16) | mode;
+		/* Reserve the first word in scratchpad for communicating
+		 * with the boot ROM. A pointer to a data structure
+		 * describing the boot process can be stored there,
+		 * cf. OMAP34xx TRM, Initialization / Software Booting
+		 * Configuration. */
+		omap_writel(l, OMAP343X_SCRATCHPAD + 4);
+	} else
 		WARN_ON(1);
 
 	prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL);
arch/arm/plat-omap/include/mach/control.h +9 -0
index 269147f..1e1bcff 100644
@@ -189,6 +189,15 @@
 #define OMAP2_PBIASLITEPWRDNZ0		(1 << 1)
 #define OMAP2_PBIASLITEVMODE0		(1 << 0)
 
+/* CONTROL_IVA2_BOOTMOD bits */
+#define OMAP3_IVA2_BOOTMOD_SHIFT	0
+#define OMAP3_IVA2_BOOTMOD_MASK		(0xf << 0)
+#define OMAP3_IVA2_BOOTMOD_IDLE		(0x1 << 0)
+
+#define OMAP343X_SCRATCHPAD_ROM		(OMAP343X_CTRL_BASE + 0x860)
+#define OMAP343X_SCRATCHPAD		(OMAP343X_CTRL_BASE + 0x910)
+#define OMAP343X_SCRATCHPAD_ROM_OFFSET	0x19C
+
 #ifndef __ASSEMBLY__
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 extern void __iomem *omap_ctrl_base_get(void);
author maintainer
#15 lore raw

PATCH 3/12 ARM: OMAP3: Add more GPIO mux options

In reply to Tony Lindgren

This patch adds several new GPIO pins and updates the pin naming comments.

The patch is based on earlier patches on linux-omap list by Manikandan Pillai <[email protected]>, Vaibhav Hiremath <[email protected]> and David Brownell <[email protected]>.

---
 arch/arm/mach-omap2/mux.c             |   27 +++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/mux.h |   13 +++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mux.c +27 -0
index dacb41f..026c4fc 100644
@@ -453,10 +453,37 @@ MUX_CFG_34XX("AC1_3430_USB3FS_PHY_MM3_TXEN_N", 0x18a,
 
 
 /* 34XX GPIO - bidirectional, unless the name has an "_OUT" suffix.
+ * (Always specify PIN_INPUT, except for names suffixed by "_OUT".)
  * No internal pullup/pulldown without "_UP" or "_DOWN" suffix.
  */
+MUX_CFG_34XX("AF26_34XX_GPIO0", 0x1e0,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("AF22_34XX_GPIO9", 0xa18,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
 MUX_CFG_34XX("AH8_34XX_GPIO29", 0x5fa,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("U8_34XX_GPIO54_OUT", 0x0b4,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("U8_34XX_GPIO54_DOWN", 0x0b4,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLDOWN)
+MUX_CFG_34XX("L8_34XX_GPIO63", 0x0ce,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("G25_34XX_GPIO86_OUT", 0x0fc,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("AG4_34XX_GPIO134_OUT", 0x160,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("AE4_34XX_GPIO136_OUT", 0x164,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
+MUX_CFG_34XX("AF6_34XX_GPIO140_UP", 0x16c,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
+MUX_CFG_34XX("AE6_34XX_GPIO141", 0x16e,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("AF5_34XX_GPIO142", 0x170,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("AE5_34XX_GPIO143", 0x172,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
+MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
+		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
 MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
 		OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
 };
arch/arm/plat-omap/include/mach/mux.h +13 -0
index f4362b8..f7e298a 100644
@@ -788,7 +788,20 @@ enum omap34xx_index {
 	 *  - "_DOWN" suffix (GPIO3_DOWN) with internal pulldown
 	 *  - "_OUT" suffix (GPIO3_OUT) for output-only pins (unlike 24xx)
 	 */
+	AF26_34XX_GPIO0,
+	AF22_34XX_GPIO9,
 	AH8_34XX_GPIO29,
+	U8_34XX_GPIO54_OUT,
+	U8_34XX_GPIO54_DOWN,
+	L8_34XX_GPIO63,
+	G25_34XX_GPIO86_OUT,
+	AG4_34XX_GPIO134_OUT,
+	AE4_34XX_GPIO136_OUT,
+	AF6_34XX_GPIO140_UP,
+	AE6_34XX_GPIO141,
+	AF5_34XX_GPIO142,
+	AE5_34XX_GPIO143,
+	H19_34XX_GPIO164_OUT,
 	J25_34XX_GPIO170,
 };
 
author maintainer
#16 lore raw

PATCH 4/12 ARM: OMAP3: mmc-twl4030 fix name buffer length

In reply to Tony Lindgren

From: Adrian Hunter <[email protected]>

Add 1 to buffer length for null terminator.

---
 arch/arm/mach-omap2/mmc-twl4030.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +1 -1
index 437f520..909f57c 100644
@@ -59,7 +59,7 @@ static struct twl_mmc_controller {
 	struct omap_mmc_platform_data	*mmc;
 	u8		twl_vmmc_dev_grp;
 	u8		twl_mmc_dedicated;
-	char		name[HSMMC_NAME_LEN];
+	char		name[HSMMC_NAME_LEN + 1];
 } hsmmc[] = {
 	{
 		.twl_vmmc_dev_grp		= VMMC1_DEV_GRP,
author maintainer
#22 lore raw

PATCH 5/12 ARM: OMAP3: mmc-twl4030 voltage cleanup

In reply to Tony Lindgren

From: David Brownell <[email protected]>

Correct twl4030 MMC power switching: fix voltage ranges reported for each slot, and handle them fully.

Lies corrected:
- MMC-1 doesn't support the 2.6-2.7 Volt range
- MMC-2 can't normally support anything except 1.8V
Omissions corrected
- MMC-1 *does* handle the 2.8-2.9 Volt range
- MMC-2 can handle 2.5-3.2 Volt cards, given a transceiver

Add transciever support for MMC-2; enable it for Overo and Pandora. (Depends on something else to have set up pinmuxing for control signals instead of as MMC2_DAT4..7 pins.)

Also shrink twl4030_hsmmc_info a smidgeon ... padding is all gone.

---
 arch/arm/mach-omap2/board-omap3pandora.c |    1 
 arch/arm/mach-omap2/board-overo.c        |    1 
 arch/arm/mach-omap2/mmc-twl4030.c        |  127 +++++++++++++++++++-----------
 arch/arm/mach-omap2/mmc-twl4030.h        |    3 -
 4 files changed, 84 insertions(+), 48 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +1 -0
index b319610..7a46a65 100644
@@ -53,6 +53,7 @@ static struct twl4030_hsmmc_info omap3pandora_mmc[] = {
 		.gpio_cd	= -EINVAL,
 		.gpio_wp	= 127,
 		.ext_clock	= 1,
+		.transceiver	= true,
 	},
 	{}	/* Terminator */
 };
arch/arm/mach-omap2/board-overo.c +1 -0
index 82b3dc5..61f8e23 100644
@@ -209,6 +209,7 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
 		.wires		= 4,
 		.gpio_cd	= -EINVAL,
 		.gpio_wp	= -EINVAL,
+		.transceiver	= true,
 	},
 	{}	/* Terminator */
 };
arch/arm/mach-omap2/mmc-twl4030.c +80 -47

173 lines not on this page · raw message

arch/arm/mach-omap2/mmc-twl4030.h +2 -1
index e1c8076..380dde7 100644
@@ -9,9 +9,10 @@
 struct twl4030_hsmmc_info {
 	u8	mmc;		/* controller 1/2/3 */
 	u8	wires;		/* 1/4/8 wires */
+	bool	transceiver;	/* MMC-2 option */
+	bool	ext_clock;	/* use external pin for input clock */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
-	int	ext_clock:1;	/* use external pin for input clock */
 };
 
 #if	defined(CONFIG_TWL4030_CORE) && \
author maintainer
#23 lore raw

PATCH 6/12 ARM: OMAP3: mmc-twl4030 init passes device nodes back

In reply to Tony Lindgren

From: David Brownell <[email protected]>

When setting up HSMMC devices, pass pass the device nodes back so board code can linking them to their power supply regulators.

---
 arch/arm/mach-omap2/mmc-twl4030.c     |   10 ++++++++++
 arch/arm/mach-omap2/mmc-twl4030.h     |    1 +
 arch/arm/plat-omap/devices.c          |    3 +++
 arch/arm/plat-omap/include/mach/mmc.h |    2 ++
 4 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +10 -0
index 42ac13f..6399874 100644
@@ -17,6 +17,7 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/i2c/twl4030.h>
+#include <linux/regulator/machine.h>
 
 #include <mach/hardware.h>
 #include <mach/control.h>
@@ -436,6 +437,15 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 	}
 
 	omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
+
+	/* pass the device nodes back to board setup code */
+	for (c = controllers; c->mmc; c++) {
+		struct omap_mmc_platform_data *mmc = hsmmc_data[c->mmc - 1];
+
+		if (!c->mmc || c->mmc > nr_hsmmc)
+			continue;
+		c->dev = mmc->dev;
+	}
 }
 
 #endif
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
index 380dde7..21d3572 100644
@@ -13,6 +13,7 @@ struct twl4030_hsmmc_info {
 	bool	ext_clock;	/* use external pin for input clock */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
+	struct device *dev;	/* returned: pointer to mmc adapter */
 };
 
 #if	defined(CONFIG_TWL4030_CORE) && \
arch/arm/plat-omap/devices.c +3 -0
index 208dbb1..87fb7ff 100644
@@ -228,6 +228,9 @@ int __init omap_mmc_add(const char *name, int id, unsigned long base,
 	ret = platform_device_add(pdev);
 	if (ret)
 		goto fail;
+
+	/* return device handle to board setup code */
+	data->dev = &pdev->dev;
 	return 0;
 
 fail:
arch/arm/plat-omap/include/mach/mmc.h +2 -0
index 73a9e15..4435bd4 100644
@@ -37,6 +37,8 @@
 #define OMAP_MMC_MAX_SLOTS	2
 
 struct omap_mmc_platform_data {
+	/* back-link to device */
+	struct device *dev;
 
 	/* number of slots per controller */
 	unsigned nr_slots:2;
author maintainer
#27 lore raw

PATCH 7/12 ARM: OMAP3: mmc-twl4030 add MMC3 support

In reply to Tony Lindgren

From: Grazvydas Ignotas <[email protected]>

Device connected to MMC3 is assumed to be self-powered, so set_power() function is empty. It can't be omited because host driver requires it. Array size for hsmmc[] is specified because hsmmc[2].name is needed for MMC3 name.

Also fix a leak which happens if invalid controller id is passed.

---
 arch/arm/mach-omap2/board-omap3pandora.c |    6 ++++++
 arch/arm/mach-omap2/mmc-twl4030.c        |   19 +++++++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +6 -0
index 7a46a65..6e17180 100644
@@ -55,6 +55,12 @@ static struct twl4030_hsmmc_info omap3pandora_mmc[] = {
 		.ext_clock	= 1,
 		.transceiver	= true,
 	},
+	{
+		.mmc		= 3,
+		.wires		= 4,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+	},
 	{}	/* Terminator */
 };
 
arch/arm/mach-omap2/mmc-twl4030.c +17 -2
index 6399874..042035c 100644
@@ -62,7 +62,7 @@ static struct twl_mmc_controller {
 	u8		twl_vmmc_dev_grp;
 	u8		twl_mmc_dedicated;
 	char		name[HSMMC_NAME_LEN + 1];
-} hsmmc[] = {
+} hsmmc[OMAP34XX_NR_MMC] = {
 	{
 		.twl_vmmc_dev_grp		= VMMC1_DEV_GRP,
 		.twl_mmc_dedicated		= VMMC1_DEDICATED,
@@ -347,6 +347,16 @@ static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vd
 	return ret;
 }
 
+static int twl_mmc3_set_power(struct device *dev, int slot, int power_on,
+		int vdd)
+{
+	/*
+	 * Assume MMC3 has self-powered device connected, for example on-board
+	 * chip with external power source.
+	 */
+	return 0;
+}
+
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 
 void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
@@ -414,7 +424,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 
 		/* NOTE:  we assume OMAP's MMC1 and MMC2 use
 		 * the TWL4030's VMMC1 and VMMC2, respectively;
-		 * and that OMAP's MMC3 isn't used.
+		 * and that MMC3 device has it's own power source.
 		 */
 
 		switch (c->mmc) {
@@ -429,8 +439,13 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			else
 				mmc->slots[0].ocr_mask = MMC_VDD_165_195;
 			break;
+		case 3:
+			mmc->slots[0].set_power = twl_mmc3_set_power;
+			mmc->slots[0].ocr_mask = MMC_VDD_165_195;
+			break;
 		default:
 			pr_err("MMC%d configuration not supported!\n", c->mmc);
+			kfree(mmc);
 			continue;
 		}
 		hsmmc_data[c->mmc - 1] = mmc;
author maintainer
#32 lore raw

PATCH 8/12 ARM: OMAP3: mmc-twl4030 fix for vmmc = 0

In reply to Tony Lindgren

From: David Brownell <[email protected]>

Resolve longstanding issue noted by Adrian Hunter: confusion between settting VSEL=0 (which is 1.8V on MMC1) and poweroff.

Also, leave VSEL alone if we're just powering the regulator off.

---
 arch/arm/mach-omap2/mmc-twl4030.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +10 -8
index 042035c..2becaf3 100644
@@ -178,7 +178,10 @@ static int twl_mmc_resume(struct device *dev, int slot)
 static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
 {
 	int ret;
-	u8 vmmc, dev_grp_val;
+	u8 vmmc = 0, dev_grp_val;
+
+	if (!vdd)
+		goto doit;
 
 	if (c->twl_vmmc_dev_grp == VMMC1_DEV_GRP) {
 		/* VMMC1:  max 220 mA.  And for 8-bit mode,
@@ -203,8 +206,7 @@ static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
 			/* error if VSIM needed */
 			break;
 		default:
-			vmmc = 0;
-			break;
+			return -EINVAL;
 		}
 	} else if (c->twl_vmmc_dev_grp == VMMC2_DEV_GRP) {
 		/* VMMC2:  max 100 mA */
@@ -230,21 +232,21 @@ static int twl_mmc_set_voltage(struct twl_mmc_controller *c, int vdd)
 			vmmc = VMMC2_315V;
 			break;
 		default:
-			vmmc = 0;
-			break;
+			return -EINVAL;
 		}
 	} else {
-		return 0;
+		return -EINVAL;
 	}
 
-	if (vmmc)
+doit:
+	if (vdd)
 		dev_grp_val = VMMC_DEV_GRP_P1;	/* Power up */
 	else
 		dev_grp_val = LDO_CLR;		/* Power down */
 
 	ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
 					dev_grp_val, c->twl_vmmc_dev_grp);
-	if (ret)
+	if (ret || !vdd)
 		return ret;
 
 	ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
author maintainer
#33 lore raw

PATCH 9/12 ARM: OMAP3: mmc-twl4030 add cover switch

In reply to Tony Lindgren

From: Adrian Hunter <[email protected]>

Allow a cover switch to be used to cause a rescan of the MMC slot.

---
 arch/arm/mach-omap2/mmc-twl4030.c |   13 ++++++++++++-
 arch/arm/mach-omap2/mmc-twl4030.h |    1 +
 2 files changed, 13 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +12 -1
index 2becaf3..9f53d22 100644
@@ -100,6 +100,14 @@ static int twl_mmc_get_ro(struct device *dev, int slot)
 	return gpio_get_value_cansleep(mmc->slots[0].gpio_wp);
 }
 
+static int twl_mmc_get_cover_state(struct device *dev, int slot)
+{
+	struct omap_mmc_platform_data *mmc = dev->platform_data;
+
+	/* NOTE: assumes card detect signal is active-low */
+	return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
+}
+
 /*
  * MMC Slot Initialization.
  */
@@ -410,7 +418,10 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 
 			mmc->slots[0].switch_pin = c->gpio_cd;
 			mmc->slots[0].card_detect_irq = gpio_to_irq(c->gpio_cd);
-			mmc->slots[0].card_detect = twl_mmc_card_detect;
+			if (c->cover_only)
+				mmc->slots[0].get_cover_state = twl_mmc_get_cover_state;
+			else
+				mmc->slots[0].card_detect = twl_mmc_card_detect;
 		} else
 			mmc->slots[0].switch_pin = -EINVAL;
 
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
index 21d3572..0aa1686 100644
@@ -11,6 +11,7 @@ struct twl4030_hsmmc_info {
 	u8	wires;		/* 1/4/8 wires */
 	bool	transceiver;	/* MMC-2 option */
 	bool	ext_clock;	/* use external pin for input clock */
+	bool	cover_only;	/* No card detect - just cover switch */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
 	struct device *dev;	/* returned: pointer to mmc adapter */
author maintainer
#34 lore raw

PATCH 10/12 ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

In reply to Tony Lindgren

From: Adrian Hunter <[email protected]>

---
 arch/arm/mach-omap2/mmc-twl4030.c |    5 ++++-
 arch/arm/mach-omap2/mmc-twl4030.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +4 -1
index 9f53d22..9831b2b 100644
@@ -402,7 +402,10 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			return;
 		}
 
-		sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+		if (c->name)
+			strncpy(twl->name, c->name, HSMMC_NAME_LEN);
+		else
+			sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
 		mmc->slots[0].name = twl->name;
 		mmc->nr_slots = 1;
 		mmc->slots[0].wires = c->wires;
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
index 0aa1686..ea59e86 100644
@@ -14,6 +14,7 @@ struct twl4030_hsmmc_info {
 	bool	cover_only;	/* No card detect - just cover switch */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
+	char	*name;		/* or NULL for default */
 	struct device *dev;	/* returned: pointer to mmc adapter */
 };
 
author maintainer
#40 lore raw

PATCH 11/12 ARM: OMAP3: Add base address definitions and resources for OMAP 3 IS

In reply to Tony Lindgren

This replaces earlier patch from Sergio Aguirre titled "[REVIEW PATCH 03/14]
OMAP34XX: CAM: Resources fixes".

---
 arch/arm/mach-omap2/devices.c              |  108 ++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/omap34xx.h |   27 +++++++
 2 files changed, 135 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/devices.c +108 -0
index ce03fa7..bf84305 100644
@@ -28,6 +28,113 @@
 #include <mach/eac.h>
 #include <mach/mmc.h>
 
+#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
+
+static struct resource cam_resources[] = {
+	{
+		.start		= OMAP24XX_CAMERA_BASE,
+		.end		= OMAP24XX_CAMERA_BASE + 0xfff,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= INT_24XX_CAM_IRQ,
+		.flags		= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device omap_cam_device = {
+	.name		= "omap24xxcam",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(cam_resources),
+	.resource	= cam_resources,
+};
+
+static inline void omap_init_camera(void)
+{
+	platform_device_register(&omap_cam_device);
+}
+
+#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
+
+static struct resource omap3isp_resources[] = {
+	{
+		.start		= OMAP3430_ISP_BASE,
+		.end		= OMAP3430_ISP_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CBUFF_BASE,
+		.end		= OMAP3430_ISP_CBUFF_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CCP2_BASE,
+		.end		= OMAP3430_ISP_CCP2_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CCDC_BASE,
+		.end		= OMAP3430_ISP_CCDC_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_HIST_BASE,
+		.end		= OMAP3430_ISP_HIST_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_H3A_BASE,
+		.end		= OMAP3430_ISP_H3A_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_PREV_BASE,
+		.end		= OMAP3430_ISP_PREV_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_RESZ_BASE,
+		.end		= OMAP3430_ISP_RESZ_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_SBL_BASE,
+		.end		= OMAP3430_ISP_SBL_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CSI2A_BASE,
+		.end		= OMAP3430_ISP_CSI2A_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CSI2PHY_BASE,
+		.end		= OMAP3430_ISP_CSI2PHY_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= INT_34XX_CAM_IRQ,
+		.flags		= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device omap3isp_device = {
+	.name		= "omap3isp",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(omap3isp_resources),
+	.resource	= omap3isp_resources,
+};
+
+static inline void omap_init_camera(void)
+{
+	platform_device_register(&omap3isp_device);
+}
+#else
+static inline void omap_init_camera(void)
+{
+}
+#endif
+
 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
 #define OMAP2_MBOX_BASE		IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
 
@@ -506,6 +613,7 @@ static int __init omap2_init_devices(void)
 	 * in alphabetical order so they're easier to sort through.
 	 */
 	omap_hsmmc_reset();
+	omap_init_camera();
 	omap_init_mbox();
 	omap_init_mcspi();
 	omap_hdq_init();
arch/arm/plat-omap/include/mach/omap34xx.h +27 -0
index 8e0479f..e50c98f 100644
@@ -49,6 +49,33 @@
 #define OMAP343X_CTRL_BASE	OMAP343X_SCM_BASE
 
 #define OMAP34XX_IC_BASE	0x48200000
+
+#define OMAP3430_ISP_BASE		(L4_34XX_BASE + 0xBC000)
+#define OMAP3430_ISP_CBUFF_BASE		(OMAP3430_ISP_BASE + 0x0100)
+#define OMAP3430_ISP_CCP2_BASE		(OMAP3430_ISP_BASE + 0x0400)
+#define OMAP3430_ISP_CCDC_BASE		(OMAP3430_ISP_BASE + 0x0600)
+#define OMAP3430_ISP_HIST_BASE		(OMAP3430_ISP_BASE + 0x0A00)
+#define OMAP3430_ISP_H3A_BASE		(OMAP3430_ISP_BASE + 0x0C00)
+#define OMAP3430_ISP_PREV_BASE		(OMAP3430_ISP_BASE + 0x0E00)
+#define OMAP3430_ISP_RESZ_BASE		(OMAP3430_ISP_BASE + 0x1000)
+#define OMAP3430_ISP_SBL_BASE		(OMAP3430_ISP_BASE + 0x1200)
+#define OMAP3430_ISP_MMU_BASE		(OMAP3430_ISP_BASE + 0x1400)
+#define OMAP3430_ISP_CSI2A_BASE		(OMAP3430_ISP_BASE + 0x1800)
+#define OMAP3430_ISP_CSI2PHY_BASE	(OMAP3430_ISP_BASE + 0x1970)
+
+#define OMAP3430_ISP_END		(OMAP3430_ISP_BASE         + 0x06F)
+#define OMAP3430_ISP_CBUFF_END		(OMAP3430_ISP_CBUFF_BASE   + 0x077)
+#define OMAP3430_ISP_CCP2_END		(OMAP3430_ISP_CCP2_BASE    + 0x1EF)
+#define OMAP3430_ISP_CCDC_END		(OMAP3430_ISP_CCDC_BASE    + 0x0A7)
+#define OMAP3430_ISP_HIST_END		(OMAP3430_ISP_HIST_BASE    + 0x047)
+#define OMAP3430_ISP_H3A_END		(OMAP3430_ISP_H3A_BASE     + 0x05F)
+#define OMAP3430_ISP_PREV_END		(OMAP3430_ISP_PREV_BASE    + 0x09F)
+#define OMAP3430_ISP_RESZ_END		(OMAP3430_ISP_RESZ_BASE    + 0x0AB)
+#define OMAP3430_ISP_SBL_END		(OMAP3430_ISP_SBL_BASE     + 0x0FB)
+#define OMAP3430_ISP_MMU_END		(OMAP3430_ISP_MMU_BASE     + 0x06F)
+#define OMAP3430_ISP_CSI2A_END		(OMAP3430_ISP_CSI2A_BASE   + 0x16F)
+#define OMAP3430_ISP_CSI2PHY_END	(OMAP3430_ISP_CSI2PHY_BASE + 0x007)
+
 #define OMAP34XX_IVA_INTC_BASE	0x40000000
 #define OMAP34XX_HSUSB_OTG_BASE	(L4_34XX_BASE + 0xAB000)
 #define OMAP34XX_HSUSB_HOST_BASE	(L4_34XX_BASE + 0x64000)
author maintainer
#42 lore raw

PATCH 12/12 ARM: OMAP3: MUSB initialization for omap hw

In reply to Tony Lindgren

From: Felipe Balbi <[email protected]>

Create a generic board-file for initializing usb
on omap2430 and omap3 boards.

Patch modified by Tony to build the module based on CONFIG_USB_MUSB_SOC. Also merged in a patch adding the nop xceiv from Ajay Kumar Gupta <[email protected]>.

---
 arch/arm/mach-omap2/Makefile             |    2 
 arch/arm/mach-omap2/board-2430sdp.c      |    2 
 arch/arm/mach-omap2/board-ldp.c          |    2 
 arch/arm/mach-omap2/board-omap3beagle.c  |    2 
 arch/arm/mach-omap2/board-omap3pandora.c |    2 
 arch/arm/mach-omap2/board-overo.c        |    2 
 arch/arm/mach-omap2/usb-musb.c           |  185 ++++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/usb.h    |    8 +
 8 files changed, 205 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/usb-musb.c
arch/arm/mach-omap2/Makefile +2 -0
index bbd12bc..53403a0 100644
@@ -39,3 +39,5 @@ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
 obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
 					   mmc-twl4030.o
 
+# Platform specific device init code
+obj-$(CONFIG_USB_MUSB_SOC)		+= usb-musb.o
arch/arm/mach-omap2/board-2430sdp.c +2 -0
index 83fa372..9619e25 100644
@@ -35,6 +35,7 @@
 #include <mach/board.h>
 #include <mach/common.h>
 #include <mach/gpmc.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -251,6 +252,7 @@ static void __init omap_2430sdp_init(void)
 	omap_board_config_size = ARRAY_SIZE(sdp2430_config);
 	omap_serial_init();
 	twl4030_mmc_init(mmc);
+	usb_musb_init();
 }
 
 static void __init omap_2430sdp_map_io(void)
arch/arm/mach-omap2/board-ldp.c +2 -0
index f6a1345..b7dbc6c 100644
@@ -38,6 +38,7 @@
 #include <asm/io.h>
 #include <asm/delay.h>
 #include <mach/control.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -162,6 +163,7 @@ static void __init omap_ldp_init(void)
 	omap_board_config_size = ARRAY_SIZE(ldp_config);
 	omap_serial_init();
 	twl4030_mmc_init(mmc);
+	usb_musb_init();
 }
 
 static void __init omap_ldp_map_io(void)
arch/arm/mach-omap2/board-omap3beagle.c +2 -0
index e3c8628..2f3d821 100644
@@ -41,6 +41,7 @@
 #include <mach/gpmc.h>
 #include <mach/nand.h>
 #include <mach/mux.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -313,6 +314,7 @@ static void __init omap3_beagle_init(void)
 	/* REVISIT leave DVI powered down until it's needed ... */
 	gpio_direction_output(170, true);
 
+	usb_musb_init();
 	omap3beagle_flash_init();
 }
 
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
index 6e17180..16e2128 100644
@@ -34,6 +34,7 @@
 #include <mach/gpio.h>
 #include <mach/hardware.h>
 #include <mach/mcspi.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -200,6 +201,7 @@ static void __init omap3pandora_init(void)
 	spi_register_board_info(omap3pandora_spi_board_info,
 			ARRAY_SIZE(omap3pandora_spi_board_info));
 	omap3pandora_ads7846_init();
+	usb_musb_init();
 }
 
 static void __init omap3pandora_map_io(void)
arch/arm/mach-omap2/board-overo.c +2 -0
index 61f8e23..d785aa8 100644
@@ -44,6 +44,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -223,6 +224,7 @@ static void __init overo_init(void)
 	omap_serial_init();
 	twl4030_mmc_init(mmc);
 	overo_flash_init();
+	usb_musb_init();
 
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
arch/arm/mach-omap2/usb-musb.c new file +185 -0

185 lines not on this page · raw message

arch/arm/plat-omap/include/mach/usb.h +8 -0
index e033e51..69f0cee 100644
@@ -27,6 +27,14 @@
 #define UDC_BASE			OMAP2_UDC_BASE
 #define OMAP_OHCI_BASE			OMAP2_OHCI_BASE
 
+#ifdef CONFIG_USB_MUSB_SOC
+extern void usb_musb_init(void);
+#else
+static inline void usb_musb_init(void)
+{
+}
+#endif
+
 #endif
 
 void omap_usb_init(struct omap_usb_config *pdata);
#3 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

In reply to Tony Lindgren
Quoted 6 lines · Tony Lindgren

From: Juha Yrjola <[email protected]>

The reboot mode can be communicated to a bootloader (or the kernel itself) with a scratchpad register. This functionality is especially useful, if userspace is allowed to change the reboot mode.

The reason for this being...

#28 lore raw

Re: [PATCH 07/12] ARM: OMAP3: mmc-twl4030 add MMC3 support

In reply to Tony Lindgren
Quoted 2 lines · Tony Lindgren

... Array size for hsmmc[] is specified
because hsmmc[2].name is needed for MMC3 name.

I see nothing in this patch which requires that.

arch/arm/mach-omap2/mmc-twl4030.c static struct twl_mmc_controller { · line 65

Quoted 10 lines
arch/arm/mach-omap2/mmc-twl4030.c +1 -1
index 6399874..042035c 100644
@@ -62,7 +62,7 @@ static struct twl_mmc_controller {
 	u8		twl_vmmc_dev_grp;
 	u8		twl_mmc_dedicated;
 	char		name[HSMMC_NAME_LEN + 1];
-} hsmmc[] = {
+} hsmmc[OMAP34XX_NR_MMC] = {

so this change looks like it can be omitted.

#35 lore raw

Re: [PATCH 10/12] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

In reply to Tony Lindgren
Quoted 15 lines · Tony Lindgren

From: Adrian Hunter <[email protected]>

---
 arch/arm/mach-omap2/mmc-twl4030.c |    5 ++++-
 arch/arm/mach-omap2/mmc-twl4030.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +0 -0
index 9f53d22..9831b2b 100644

arch/arm/mach-omap2/mmc-twl4030.c void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers) · line 406

Quoted 6 lines
arch/arm/mach-omap2/mmc-twl4030.c +2 -1
@@ -402,7 +402,10 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			return;
 		}
 
-		sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+		if (c->name)
+			strncpy(twl->name, c->name, HSMMC_NAME_LEN);

Bug. strncpy can result in a non-null terminated string, and it just so happens that twl->name has been declared as being HSMMC_NAME_LEN+1 in size.

That's rather unsafe. Using strlcpy() and sizeof(twl->name) instead will ensure that no matter what happens to the size of the array declaration, the code remains correct.

arch/arm/mach-omap2/mmc-twl4030.h struct twl4030_hsmmc_info { · line 17

Quoted 9 lines
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
index 0aa1686..ea59e86 100644
@@ -14,6 +14,7 @@ struct twl4030_hsmmc_info {
 	bool	cover_only;	/* No card detect - just cover switch */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
+	char	*name;		/* or NULL for default */

const?

#43 lore raw

Re: [PATCH 12/12] ARM: OMAP3: MUSB initialization for omap hw

In reply to Tony Lindgren
Quoted 2 lines · Tony Lindgren

Patch modified by Tony to build the module based on CONFIG_USB_MUSB_SOC.

I don't see this.

arch/arm/mach-omap2/Makefile obj-$(CONFIG_MACH_OVERO) += board-overo.o \ · line 43

Quoted 2 lines
arch/arm/mach-omap2/Makefile +2 -0
+# Platform specific device init code
+obj-$(CONFIG_USB_MUSB_SOC)		+= usb-musb.o

So, if this can be a module, the file itself doesn't export any symbols and doesn't have any module_init or module_exit functions. So, if this gets built as a module, it isn't useful.

arch/arm/mach-omap2/usb-musb.c line 166

Quoted 5 lines
arch/arm/mach-omap2/usb-musb.c new file +5 -0
+void __init usb_musb_init(void)
+{
+	if (cpu_is_omap243x()) {
+		musb_resources[0].start = OMAP243X_HS_BASE;
+		musb_plat.clock = "usbhs_ick";

kill kill kill.

arch/arm/mach-omap2/usb-musb.c line 169

Quoted 3 lines
arch/arm/mach-omap2/usb-musb.c new file +3 -0
+	} else {
+		musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
+		musb_plat.clock = "hsotgusb_ick";

kill kill kill.

clkdev removes the need for this sort of crap.

#29 lore raw

Re: [PATCH 07/12] ARM: OMAP3: mmc-twl4030 add MMC3 support

In reply to Russell King - ARM Linux
Quoted 5 lines · Russell King - ARM Linux
Quoted 2 lines · Tony Lindgren

... Array size for hsmmc[] is specified
because hsmmc[2].name is needed for MMC3 name.

I see nothing in this patch which requires that.

Right, but there is already some code in twl4030_mmc_init() of mmc-twl4030.c:

struct twl_mmc_controller *twl = hsmmc + c->mmc - 1;
<snip>
sprintf(twl->name, "mmc%islot%i", c->mmc, 1);

.. which basically writes to hsmmc[2].name for MMC3.

Quoted 4 lines
Quoted 4 lines
arch/arm/mach-omap2/mmc-twl4030.c +0 -0
index 6399874..042035c 100644
Quoted 8 lines

arch/arm/mach-omap2/mmc-twl4030.c static struct twl_mmc_controller { · line 65

Quoted 6 lines
arch/arm/mach-omap2/mmc-twl4030.c +1 -1
@@ -62,7 +62,7 @@ static struct twl_mmc_controller {
       u8              twl_vmmc_dev_grp;
       u8              twl_mmc_dedicated;
       char            name[HSMMC_NAME_LEN + 1];
-} hsmmc[] = {
+} hsmmc[OMAP34XX_NR_MMC] = {

so this change looks like it can be omitted.

No, that would bring some painful memory corruption issues. --
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#30 lore raw

Re: [PATCH 07/12] ARM: OMAP3: mmc-twl4030 add MMC3 support

Quoted 8 lines · Grazvydas Ignotas
Quoted 5 lines · Russell King - ARM Linux
Quoted 2 lines · Tony Lindgren

... Array size for hsmmc[] is specified
because hsmmc[2].name is needed for MMC3 name.

I see nothing in this patch which requires that.

Quoted 7 lines

Right, but there is already some code in twl4030_mmc_init() of mmc-twl4030.c:

struct twl_mmc_controller *twl = hsmmc + c->mmc - 1;
<snip>
sprintf(twl->name, "mmc%islot%i", c->mmc, 1);

.. which basically writes to hsmmc[2].name for MMC3.

So, it's nothing really to do with hsmmc[2].name being required, it's more a case of needing to have the 3rd MMC interface included. The comment in the commit is *really* misleading.

#44 lore raw

Re: [PATCH 12/12] ARM: OMAP3: MUSB initialization for omap hw

In reply to Russell King - ARM Linux
Quoted 1 line · Russell King - ARM Linux

clkdev removes the need for this sort of crap.

And once it, or its equivalent, works on all the platforms supportihg the musb_hdrc driver, then the driver can switch.

#36 lore raw

Re: [PATCH 10/12] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

In reply to Russell King - ARM Linux
Quoted 19 lines · Russell King - ARM Linux
Quoted 18 lines · Tony Lindgren

From: Adrian Hunter <[email protected]>

---
 arch/arm/mach-omap2/mmc-twl4030.c |    5 ++++-
 arch/arm/mach-omap2/mmc-twl4030.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +0 -0
index 9f53d22..9831b2b 100644
@@ -402,7 +402,10 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			return;
 		}
 
Quoted 7 lines

arch/arm/mach-omap2/mmc-twl4030.c void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers) · line 406

Quoted 3 lines
arch/arm/mach-omap2/mmc-twl4030.c +2 -1
-		sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+		if (c->name)
+			strncpy(twl->name, c->name, HSMMC_NAME_LEN);

Bug. strncpy can result in a non-null terminated string, and it just so happens that twl->name has been declared as being HSMMC_NAME_LEN+1 in size.

Well to be pedantic, it is not actually a "bug". twl->name is zero-filled so HSMMC_NAME_LEN+1 guarantees that it is null terminated.

Quoted 3 lines

That's rather unsafe. Using strlcpy() and sizeof(twl->name) instead will ensure that no matter what happens to the size of the array declaration, the code remains correct.

Unless the programmer decides to make twl->name a pointer to allocated memory
- then sizeof(twl->name) is no good. You could use ARRAY_SIZE(twl->name) which (for gcc) includes a check that twl->name is an array.

Quoted 13 lines

arch/arm/mach-omap2/mmc-twl4030.h struct twl4030_hsmmc_info { · line 17

Quoted 10 lines
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
index 0aa1686..ea59e86 100644
@@ -14,6 +14,7 @@ struct twl4030_hsmmc_info {
 	bool	cover_only;	/* No card detect - just cover switch */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
+	char	*name;		/* or NULL for default */

const?

OK

#18 lore raw

Re: [PATCH 04/12] ARM: OMAP3: mmc-twl4030 fix name buffer length

In reply to Russell King - ARM Linux
Quoted 11 lines · Russell King - ARM Linux
Quoted 3 lines · Tony Lindgren

From: Adrian Hunter <[email protected]>

Add 1 to buffer length for null terminator.

Yes, and:

                sprintf(twl->name, "mmc%islot%i", c->mmc, 1);

should be snprintf to ensure that it can't overflow the buffer.

There are only 3 controllers and everyone numbers them 1, 2 and 3.

The change is the other patch.

#37 lore raw

Re: [PATCH 10/12] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

In reply to Russell King - ARM Linux
Quoted 1 line

From 9b04f19a7e88f8877176c25845c38676ee3127c1 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Tue, 10 Mar 2009 22:13:52 +0100
Subject: [PATCH] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

---

arch/arm/mach-omap2/mmc-twl4030.c |    6 +++++-
arch/arm/mach-omap2/mmc-twl4030.h |    1 +
2 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +0 -0
index a612a02..88b4bed 100644
@@ -328,7 +328,11 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
			return;
		}

- sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+ if (c->name)
+ strlcpy(twl->name, c->name, ARRAY_SIZE(twl->name));
+ else
+ snprintf(twl->name, ARRAY_SIZE(twl->name),

+				 "mmc%islot%i", c->mmc, 1);
		mmc->slots[0].name = twl->name;
		mmc->nr_slots = 1;
		mmc->slots[0].wires = c->wires;
arch/arm/mach-omap2/mmc-twl4030.h +0 -0
index 36e95a6..aa2d99b 100644
@@ -14,6 +14,7 @@ struct twl4030_hsmmc_info {
	bool	cover_only;	/* No card detect - just cover switch */
	int	gpio_cd;	/* or -EINVAL */
	int	gpio_wp;	/* or -EINVAL */

+ const char *name; /* or NULL for default */
struct device *dev; /* returned: pointer to mmc adapter */
int ocr_mask; /* temporary HACK */
};

Signature · 1 line
1.5.6.3
#19 lore raw

Re: [PATCH 04/12] ARM: OMAP3: mmc-twl4030 fix name buffer length

In reply to Adrian Hunter
Quoted 6 lines · Adrian Hunter
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Tony Lindgren

From: Adrian Hunter <[email protected]>

Add 1 to buffer length for null terminator.

Quoted 8 lines
Quoted 6 lines

Yes, and:

                sprintf(twl->name, "mmc%islot%i", c->mmc, 1);

should be snprintf to ensure that it can't overflow the buffer.

There are only 3 controllers and everyone numbers them 1, 2 and 3.

So? You've already had a buffer overflow, so it's clearly time that this code got fixed properly.

#38 lore raw

Re: [PATCH 10/12] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

In reply to Adrian Hunter
Quoted 16 lines · Adrian Hunter
Quoted 1 line

From 9b04f19a7e88f8877176c25845c38676ee3127c1 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Tue, 10 Mar 2009 22:13:52 +0100
Subject: [PATCH] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

---

arch/arm/mach-omap2/mmc-twl4030.c |    6 +++++-
arch/arm/mach-omap2/mmc-twl4030.h |    1 +
2 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +0 -0
index a612a02..88b4bed 100644

arch/arm/mach-omap2/mmc-twl4030.c void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers) · line 335

Quoted 9 lines
arch/arm/mach-omap2/mmc-twl4030.c +5 -1
@@ -328,7 +328,11 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			return;
 		}
 
-		sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+		if (c->name)
+			strlcpy(twl->name, c->name, ARRAY_SIZE(twl->name));
+		else
+			snprintf(twl->name, ARRAY_SIZE(twl->name),
+				 "mmc%islot%i", c->mmc, 1);

Good, except now we have a confusion over which patch does what...

#4 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

In reply to Russell King - ARM Linux
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines

The reboot mode can be communicated to a bootloader (or the kernel itself) with a scratchpad register. This functionality is especially useful, if userspace is allowed to change the reboot mode.

The reason for this being...

If my other patch [1] is applied, we are able to let user space tell the bootloader which mode to boot to.

On the Nokia Linux mobile devices, flashing is done mostly by the bootloader. If a USB host is connected at bootup, we enter a USB loop with a certain timeout. The timeout is disabled when the first flashing command arrives. This is no problem for Linux, but some unluckier operating systems are not able to even load their drivers quickly enough.

Hence, we need a way to let the bootloader know when to safely disable the timeout (when the user explicitly wants to perform flashing, that is).

Cheers,
Juha

[1] http://article.gmane.org/gmane.linux.ports.arm.kernel/53837

#5 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Quoted 17 lines · Juha Yrjola
Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines

The reboot mode can be communicated to a bootloader (or the kernel itself) with a scratchpad register. This functionality is especially useful, if userspace is allowed to change the reboot mode.

The reason for this being...

If my other patch [1] is applied, we are able to let user space tell the bootloader which mode to boot to.

On the Nokia Linux mobile devices, flashing is done mostly by the bootloader. If a USB host is connected at bootup, we enter a USB loop with a certain timeout. The timeout is disabled when the first flashing command arrives. This is no problem for Linux, but some unluckier operating systems are not able to even load their drivers quickly enough.

Quoted 3 lines

Hence, we need a way to let the bootloader know when to safely disable the timeout (when the user explicitly wants to perform flashing, that is).

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

That said, I don't see a version of reboot() which will pass a string to the reboot() sysctl... there must be one around for the feature to be present.

#6 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

Cheers,
Juha

author maintainer Acked-by David Brownell
#20 lore raw

Re: [PATCH 04/12] ARM: OMAP3: mmc-twl4030 fix name buffer length

In reply to Russell King - ARM Linux
Quoted 11 lines · Russell King - ARM Linux
Quoted 10 lines · Adrian Hunter
Quoted 9 lines · Russell King - ARM Linux
Quoted 3 lines · Tony Lindgren

From: Adrian Hunter <[email protected]>

Add 1 to buffer length for null terminator.

Yes, and:

                sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

should be snprintf to ensure that it can't overflow the buffer.

There are only 3 controllers and everyone numbers them 1, 2 and 3.

So? You've already had a buffer overflow, so it's clearly time that this code got fixed properly.

Here's this one updated to also include the snprintf.

Tony

Quoted 1 line

From 42a81558d840eb69204edb39169227547831dd1b Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Mon, 16 Mar 2009 10:32:33 -0700
Subject: [PATCH] ARM: OMAP3: mmc-twl4030 fix name buffer length, v2

Add 1 to buffer length for null terminator and use snprintf.

arch/arm/mach-omap2/mmc-twl4030.c +3 -2
index 437f520..84cac87 100644
@@ -59,7 +59,7 @@ static struct twl_mmc_controller {
 	struct omap_mmc_platform_data	*mmc;
 	u8		twl_vmmc_dev_grp;
 	u8		twl_mmc_dedicated;
-	char		name[HSMMC_NAME_LEN];
+	char		name[HSMMC_NAME_LEN + 1];
 } hsmmc[] = {
 	{
 		.twl_vmmc_dev_grp		= VMMC1_DEV_GRP,
@@ -349,7 +349,8 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			return;
 		}
 
-		sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+		snprintf(twl->name, ARRAY_SIZE(twl->name), "mmc%islot%i",
+				c->mmc, 1);
 		mmc->slots[0].name = twl->name;
 		mmc->nr_slots = 1;
 		mmc->slots[0].ocr_mask = MMC_VDD_165_195 |
author maintainer
#25 lore raw

Re: [PATCH 06/12] ARM: OMAP3: mmc-twl4030 init passes device nodes back

In reply to Russell King - ARM Linux
Quoted 6 lines · Russell King - ARM Linux
Quoted 3 lines · Tony Lindgren

From: David Brownell <[email protected]>

When setting up HSMMC devices, pass pass the device nodes back so

Double pass?

Here's this one updated to fix the typo.

Tony

Quoted 1 line

From 587cf51b738e653751516809c161d5e325342023 Mon Sep 17 00:00:00 2001

From: David Brownell <[email protected]>
Date: Mon, 16 Mar 2009 10:40:39 -0700
Subject: [PATCH] ARM: OMAP3: mmc-twl4030 init passes device nodes back, v2

When setting up HSMMC devices, pass the device nodes back so board code can linking them to their power supply regulators.

arch/arm/mach-omap2/mmc-twl4030.c +10 -0
index df1539e..c67078d 100644
@@ -17,6 +17,7 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/i2c/twl4030.h>
+#include <linux/regulator/machine.h>
 
 #include <mach/hardware.h>
 #include <mach/control.h>
@@ -437,6 +438,15 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 	}
 
 	omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
+
+	/* pass the device nodes back to board setup code */
+	for (c = controllers; c->mmc; c++) {
+		struct omap_mmc_platform_data *mmc = hsmmc_data[c->mmc - 1];
+
+		if (!c->mmc || c->mmc > nr_hsmmc)
+			continue;
+		c->dev = mmc->dev;
+	}
 }
 
 #endif
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
index 380dde7..21d3572 100644
@@ -13,6 +13,7 @@ struct twl4030_hsmmc_info {
 	bool	ext_clock;	/* use external pin for input clock */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
+	struct device *dev;	/* returned: pointer to mmc adapter */
 };
 
 #if	defined(CONFIG_TWL4030_CORE) && \
arch/arm/plat-omap/devices.c +3 -0
index 208dbb1..87fb7ff 100644
@@ -228,6 +228,9 @@ int __init omap_mmc_add(const char *name, int id, unsigned long base,
 	ret = platform_device_add(pdev);
 	if (ret)
 		goto fail;
+
+	/* return device handle to board setup code */
+	data->dev = &pdev->dev;
 	return 0;
 
 fail:
arch/arm/plat-omap/include/mach/mmc.h +2 -0
index 73a9e15..4435bd4 100644
@@ -37,6 +37,8 @@
 #define OMAP_MMC_MAX_SLOTS	2
 
 struct omap_mmc_platform_data {
+	/* back-link to device */
+	struct device *dev;
 
 	/* number of slots per controller */
 	unsigned nr_slots:2;
author maintainer
#31 lore raw

Re: [PATCH 07/12] ARM: OMAP3: mmc-twl4030 add MMC3 support, v2

In reply to Russell King - ARM Linux
Quoted 15 lines · Russell King - ARM Linux
Quoted 14 lines · Grazvydas Ignotas
Quoted 5 lines · Russell King - ARM Linux
Quoted 2 lines · Tony Lindgren

... Array size for hsmmc[] is specified
because hsmmc[2].name is needed for MMC3 name.

I see nothing in this patch which requires that.

Right, but there is already some code in twl4030_mmc_init() of mmc-twl4030.c:

struct twl_mmc_controller *twl = hsmmc + c->mmc - 1;
<snip>
sprintf(twl->name, "mmc%islot%i", c->mmc, 1);

Quoted 5 lines
Quoted 1 line

.. which basically writes to hsmmc[2].name for MMC3.

So, it's nothing really to do with hsmmc[2].name being required, it's more a case of needing to have the 3rd MMC interface included. The comment in the commit is *really* misleading.

Here's this one updated for the comments.

Tony

Quoted 1 line

From 9c51c8f60fe2e33989f2c87ff9829a7eea89240e Mon Sep 17 00:00:00 2001

From: Grazvydas Ignotas <[email protected]>
Date: Mon, 16 Mar 2009 10:43:06 -0700
Subject: [PATCH] ARM: OMAP3: mmc-twl4030 add MMC3 support, v2

Device connected to MMC3 is assumed to be self-powered, so set_power() function is empty. It can't be omited because host driver requires it.

Array size for hsmmc[] is specified to allocate to allocate an instance for the third MMC controller.

Also fix a leak which happens if invalid controller id is passed.

arch/arm/mach-omap2/board-omap3pandora.c +6 -0
index 7a46a65..6e17180 100644
@@ -55,6 +55,12 @@ static struct twl4030_hsmmc_info omap3pandora_mmc[] = {
 		.ext_clock	= 1,
 		.transceiver	= true,
 	},
+	{
+		.mmc		= 3,
+		.wires		= 4,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+	},
 	{}	/* Terminator */
 };
 
arch/arm/mach-omap2/mmc-twl4030.c +17 -2
index c67078d..d9fad8d 100644
@@ -62,7 +62,7 @@ static struct twl_mmc_controller {
 	u8		twl_vmmc_dev_grp;
 	u8		twl_mmc_dedicated;
 	char		name[HSMMC_NAME_LEN + 1];
-} hsmmc[] = {
+} hsmmc[OMAP34XX_NR_MMC] = {
 	{
 		.twl_vmmc_dev_grp		= VMMC1_DEV_GRP,
 		.twl_mmc_dedicated		= VMMC1_DEDICATED,
@@ -347,6 +347,16 @@ static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vd
 	return ret;
 }
 
+static int twl_mmc3_set_power(struct device *dev, int slot, int power_on,
+		int vdd)
+{
+	/*
+	 * Assume MMC3 has self-powered device connected, for example on-board
+	 * chip with external power source.
+	 */
+	return 0;
+}
+
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 
 void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
@@ -415,7 +425,7 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 
 		/* NOTE:  we assume OMAP's MMC1 and MMC2 use
 		 * the TWL4030's VMMC1 and VMMC2, respectively;
-		 * and that OMAP's MMC3 isn't used.
+		 * and that MMC3 device has it's own power source.
 		 */
 
 		switch (c->mmc) {
@@ -430,8 +440,13 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			else
 				mmc->slots[0].ocr_mask = MMC_VDD_165_195;
 			break;
+		case 3:
+			mmc->slots[0].set_power = twl_mmc3_set_power;
+			mmc->slots[0].ocr_mask = MMC_VDD_165_195;
+			break;
 		default:
 			pr_err("MMC%d configuration not supported!\n", c->mmc);
+			kfree(mmc);
 			continue;
 		}
 		hsmmc_data[c->mmc - 1] = mmc;
author maintainer Acked-by David Brownell
#39 lore raw

Re: [PATCH 10/12] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

In reply to Russell King - ARM Linux
Quoted 20 lines · Russell King - ARM Linux
Quoted 19 lines · Adrian Hunter
Quoted 1 line

From 9b04f19a7e88f8877176c25845c38676ee3127c1 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Tue, 10 Mar 2009 22:13:52 +0100
Subject: [PATCH] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names

---

arch/arm/mach-omap2/mmc-twl4030.c |    6 +++++-
arch/arm/mach-omap2/mmc-twl4030.h |    1 +
2 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +0 -0
index a612a02..88b4bed 100644
@@ -328,7 +328,11 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			return;
 		}
 
Quoted 8 lines

arch/arm/mach-omap2/mmc-twl4030.c void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers) · line 335

Quoted 6 lines
arch/arm/mach-omap2/mmc-twl4030.c +5 -1
-		sprintf(twl->name, "mmc%islot%i", c->mmc, 1);
+		if (c->name)
+			strlcpy(twl->name, c->name, ARRAY_SIZE(twl->name));
+		else
+			snprintf(twl->name, ARRAY_SIZE(twl->name),
+				 "mmc%islot%i", c->mmc, 1);

Good, except now we have a confusion over which patch does what...

Here's this one updated to apply with snprintf moved to the earlier patch in the series.

Tony

Quoted 1 line

From 10e3a1012fce568e4be375102bf7af33543cb072 Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Mon, 16 Mar 2009 10:57:32 -0700
Subject: [PATCH] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names, v3

arch/arm/mach-omap2/mmc-twl4030.c +5 -2
index e2b2aeb..dc40b3e 100644
@@ -402,8 +402,11 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
 			return;
 		}
 
-		snprintf(twl->name, ARRAY_SIZE(twl->name), "mmc%islot%i",
-				c->mmc, 1);
+		if (c->name)
+			strncpy(twl->name, c->name, HSMMC_NAME_LEN);
+		else
+			snprintf(twl->name, ARRAY_SIZE(twl->name),
+				"mmc%islot%i", c->mmc, 1);
 		mmc->slots[0].name = twl->name;
 		mmc->nr_slots = 1;
 		mmc->slots[0].wires = c->wires;
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
index 0aa1686..ea59e86 100644
@@ -14,6 +14,7 @@ struct twl4030_hsmmc_info {
 	bool	cover_only;	/* No card detect - just cover switch */
 	int	gpio_cd;	/* or -EINVAL */
 	int	gpio_wp;	/* or -EINVAL */
+	char	*name;		/* or NULL for default */
 	struct device *dev;	/* returned: pointer to mmc adapter */
 };
 
#7 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

In reply to Juha Yrjola
Quoted 8 lines · Juha Yrjola
Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Yes, glibc sucks with that - they hide the Linux reboot syscall. Luckily, it is accessible via the syscall() interface:

#include <linux/reboot.h>

int sys_reboot(const char *cmd)

{
	return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
			LINUX_REBOOT_CMD_RESTART2, cmd);
}
Quoted 10 lines
Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

The notifier chain is called in any case.

Quoted 3 lines

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

No, reboot mode tells _how_ to perform the reboot - whether that be by hardware reset, gpio reset or a soft call via the reset address. It's not supposed to tell the boot loader what to do.

#21 lore raw

Re: [PATCH 04/12] ARM: OMAP3: mmc-twl4030 fix name buffer length

In reply to Tony Lindgren
Quoted 15 lines · Tony Lindgren
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Adrian Hunter
Quoted 11 lines · Russell King - ARM Linux
Quoted 3 lines · Tony Lindgren

From: Adrian Hunter <[email protected]>

Add 1 to buffer length for null terminator.

Yes, and:

                sprintf(twl->name, "mmc%islot%i", c->mmc, 1);

should be snprintf to ensure that it can't overflow the buffer.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

There are only 3 controllers and everyone numbers them 1, 2 and 3.

So? You've already had a buffer overflow, so it's clearly time that this code got fixed properly.

Here's this one updated to also include the snprintf.

Ok.

#26 lore raw

Re: [PATCH 06/12] ARM: OMAP3: mmc-twl4030 init passes device nodes back

In reply to Tony Lindgren
Quoted 9 lines · Tony Lindgren
Quoted 6 lines · Russell King - ARM Linux
Quoted 3 lines · Tony Lindgren

From: David Brownell <[email protected]>

When setting up HSMMC devices, pass pass the device nodes back so

Double pass?

Here's this one updated to fix the typo.

Ok.

author maintainer
#47 lore raw

Re: [PATCH 12/12] ARM: OMAP3: MUSB initialization for omap hw, v2

In reply to Russell King - ARM Linux
Quoted 4 lines · Russell King - ARM Linux
Quoted 2 lines · Tony Lindgren

Patch modified by Tony to build the module based on CONFIG_USB_MUSB_SOC.

Quoted 8 lines

I don't see this.

Review

Quoted 2 lines
(quoted diff) +2 -0
+# Platform specific device init code
+obj-$(CONFIG_USB_MUSB_SOC)		+= usb-musb.o

So, if this can be a module, the file itself doesn't export any symbols and doesn't have any module_init or module_exit functions. So, if this gets built as a module, it isn't useful.

Good point. I've updated the Makefile, it's not intended to be compiled as a module as it's initialized from the low-level board init code only for the systems that have the musb wired up.

Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+void __init usb_musb_init(void)
+{
+	if (cpu_is_omap243x()) {
+		musb_resources[0].start = OMAP243X_HS_BASE;
+		musb_plat.clock = "usbhs_ick";

kill kill kill.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+	} else {
+		musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
+		musb_plat.clock = "hsotgusb_ick";

kill kill kill.

Heh!

Quoted 1 line

clkdev removes the need for this sort of crap.

Here's the future proof version. Will post another patch against your omap-clks3 branch to set the names for musb clocks in clock[23]4xx.c.

Tony

Quoted 1 line

From 18936e335f62f252fa584ee9a22f99ebc34cd4c5 Mon Sep 17 00:00:00 2001

From: Felipe Balbi <[email protected]>
Date: Mon, 16 Mar 2009 11:01:50 -0700
Subject: [PATCH] ARM: OMAP3: MUSB initialization for omap hw, v2

Create a generic board-file for initializing usb
on omap2430 and omap3 boards.

Patch modified by Tony to build the module based on CONFIG_USB_MUSB_SOC. Also merged in a patch adding the nop xceiv from Ajay Kumar Gupta <[email protected]>.

arch/arm/mach-omap2/Makefile +4 -0
index bbd12bc..29f6ca9 100644
@@ -39,3 +39,7 @@ obj-$(CONFIG_MACH_OVERO)		+= board-overo.o \
 obj-$(CONFIG_MACH_OMAP3_PANDORA)	+= board-omap3pandora.o \
 					   mmc-twl4030.o
 
+# Platform specific device init code
+ifeq ($(CONFIG_USB_MUSB_SOC),y)
+obj-y					+= usb-musb.o
+endif
arch/arm/mach-omap2/board-2430sdp.c +2 -0
index 83fa372..9619e25 100644
@@ -35,6 +35,7 @@
 #include <mach/board.h>
 #include <mach/common.h>
 #include <mach/gpmc.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -251,6 +252,7 @@ static void __init omap_2430sdp_init(void)
 	omap_board_config_size = ARRAY_SIZE(sdp2430_config);
 	omap_serial_init();
 	twl4030_mmc_init(mmc);
+	usb_musb_init();
 }
 
 static void __init omap_2430sdp_map_io(void)
arch/arm/mach-omap2/board-ldp.c +2 -0
index 6031e17..1b54c20 100644
@@ -38,6 +38,7 @@
 #include <asm/io.h>
 #include <asm/delay.h>
 #include <mach/control.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -162,6 +163,7 @@ static void __init omap_ldp_init(void)
 	omap_board_config_size = ARRAY_SIZE(ldp_config);
 	omap_serial_init();
 	twl4030_mmc_init(mmc);
+	usb_musb_init();
 }
 
 static void __init omap_ldp_map_io(void)
arch/arm/mach-omap2/board-omap3beagle.c +2 -0
index e3c8628..2f3d821 100644
@@ -41,6 +41,7 @@
 #include <mach/gpmc.h>
 #include <mach/nand.h>
 #include <mach/mux.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -313,6 +314,7 @@ static void __init omap3_beagle_init(void)
 	/* REVISIT leave DVI powered down until it's needed ... */
 	gpio_direction_output(170, true);
 
+	usb_musb_init();
 	omap3beagle_flash_init();
 }
 
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
index 6e17180..16e2128 100644
@@ -34,6 +34,7 @@
 #include <mach/gpio.h>
 #include <mach/hardware.h>
 #include <mach/mcspi.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -200,6 +201,7 @@ static void __init omap3pandora_init(void)
 	spi_register_board_info(omap3pandora_spi_board_info,
 			ARRAY_SIZE(omap3pandora_spi_board_info));
 	omap3pandora_ads7846_init();
+	usb_musb_init();
 }
 
 static void __init omap3pandora_map_io(void)
arch/arm/mach-omap2/board-overo.c +2 -0
index 61f8e23..d785aa8 100644
@@ -44,6 +44,7 @@
 #include <mach/gpmc.h>
 #include <mach/hardware.h>
 #include <mach/nand.h>
+#include <mach/usb.h>
 
 #include "mmc-twl4030.h"
 
@@ -223,6 +224,7 @@ static void __init overo_init(void)
 	omap_serial_init();
 	twl4030_mmc_init(mmc);
 	overo_flash_init();
+	usb_musb_init();
 
 	if ((gpio_request(OVERO_GPIO_W2W_NRESET,
 			  "OVERO_GPIO_W2W_NRESET") == 0) &&
arch/arm/mach-omap2/usb-musb.c new file +187 -0

187 lines not on this page · raw message

arch/arm/plat-omap/include/mach/usb.h +8 -0
index e033e51..69f0cee 100644
@@ -27,6 +27,14 @@
 #define UDC_BASE			OMAP2_UDC_BASE
 #define OMAP_OHCI_BASE			OMAP2_OHCI_BASE
 
+#ifdef CONFIG_USB_MUSB_SOC
+extern void usb_musb_init(void);
+#else
+static inline void usb_musb_init(void)
+{
+}
+#endif
+
 #endif
 
 void omap_usb_init(struct omap_usb_config *pdata);
author maintainer
#45 lore raw

PATCH 1/1 ARM: OMAP: Add name for musb clocks

In reply to David Brownell
Quoted 5 lines · David Brownell
Quoted 1 line · Russell King - ARM Linux

clkdev removes the need for this sort of crap.

And once it, or its equivalent, works on all the platforms supportihg the musb_hdrc driver, then the driver can switch.

Yeah, I added a REVISIT comment to remove the "ick" name in the low-level init code once all the musb platforms use clkdev.

Russell, here's a patch you might want to merge into your omap-clks3 branch for musb.

Also tested musb on omap-clks3 + omap-upstream + omap3-upstream + omap3-boards patches.

Regards,

Tony

Quoted 1 line

From 8fb4be02dd5fdbcf71708d7cb5d42751aee42190 Mon Sep 17 00:00:00 2001

From: Tony Lindgren <[email protected]>
Date: Mon, 16 Mar 2009 15:28:41 -0700
Subject: [PATCH] ARM: OMAP: Add name for musb clocks

This allows musb_core.c to register clock with name "ick".

Once all the platforms using the musb driver have been converted to use clockdev, the clock name does not need to be passed from the low-level init code.

arch/arm/mach-omap2/clock24xx.c +1 -1
index 1e839c5..f58ad06 100644
@@ -205,7 +205,7 @@ static struct omap_clk omap24xx_clks[] = {
 	CLK(NULL,	"aes_ick",	&aes_ick,	CK_243X | CK_242X),
 	CLK(NULL,	"pka_ick",	&pka_ick,	CK_243X | CK_242X),
 	CLK(NULL,	"usb_fck",	&usb_fck,	CK_243X | CK_242X),
-	CLK(NULL,	"usbhs_ick",	&usbhs_ick,	CK_243X),
+	CLK("musb_hdrc",	"ick",	&usbhs_ick,	CK_243X),
 	CLK("mmci-omap-hs.0", "ick",	&mmchs1_ick,	CK_243X),
 	CLK("mmci-omap-hs.0", "fck",	&mmchs1_fck,	CK_243X),
 	CLK("mmci-omap-hs.1", "ick",	&mmchs2_ick,	CK_243X),
arch/arm/mach-omap2/clock34xx.c +1 -1
index 0a14dca..a057539 100644
@@ -157,7 +157,7 @@ static struct omap_clk omap34xx_clks[] = {
 	CLK(NULL,	"ssi_ssr_fck",	&ssi_ssr_fck,	CK_343X),
 	CLK(NULL,	"ssi_sst_fck",	&ssi_sst_fck,	CK_343X),
 	CLK(NULL,	"core_l3_ick",	&core_l3_ick,	CK_343X),
-	CLK(NULL,	"hsotgusb_ick",	&hsotgusb_ick,	CK_343X),
+	CLK("musb_hdrc",	"ick",	&hsotgusb_ick,	CK_343X),
 	CLK(NULL,	"sdrc_ick",	&sdrc_ick,	CK_343X),
 	CLK(NULL,	"gpmc_fck",	&gpmc_fck,	CK_343X),
 	CLK(NULL,	"security_l3_ick", &security_l3_ick, CK_343X),
author maintainer
#8 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

In reply to Russell King - ARM Linux
Quoted 34 lines · Russell King - ARM Linux
Quoted 8 lines · Juha Yrjola
Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Yes, glibc sucks with that - they hide the Linux reboot syscall. Luckily, it is accessible via the syscall() interface:

#include <linux/reboot.h>

int sys_reboot(const char *cmd)

{
	return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
			LINUX_REBOOT_CMD_RESTART2, cmd);
}
Quoted 10 lines
Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

The notifier chain is called in any case.

Quoted 7 lines
Quoted 3 lines

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

No, reboot mode tells _how_ to perform the reboot - whether that be by hardware reset, gpio reset or a soft call via the reset address. It's not supposed to tell the boot loader what to do.

So if the reboot mode can't be used for this.. Should we change Juha's sysfs interface patch to store something else like bootloader_mode?

I guess we cannot use kexec for this either?

Tony

#9 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Quoted 39 lines · Tony Lindgren
Quoted 38 lines · Russell King - ARM Linux
Quoted 8 lines · Juha Yrjola
Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Yes, glibc sucks with that - they hide the Linux reboot syscall. Luckily, it is accessible via the syscall() interface:

#include <linux/reboot.h>

int sys_reboot(const char *cmd)

{
	return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
			LINUX_REBOOT_CMD_RESTART2, cmd);
}
Quoted 10 lines
Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

The notifier chain is called in any case.

Quoted 3 lines

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

Quoted 8 lines
Quoted 3 lines

No, reboot mode tells _how_ to perform the reboot - whether that be by hardware reset, gpio reset or a soft call via the reset address. It's not supposed to tell the boot loader what to do.

So if the reboot mode can't be used for this.. Should we change Juha's sysfs interface patch to store something else like bootloader_mode?

I guess we cannot use kexec for this either?

Why not use the mechanism that's already there as I've already pointed out?

Yes, glibc might be fscked in the head over the reboot() prototype but that's easy to work-around as I've demonstrated.

author maintainer
#10 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Quoted 44 lines · Russell King - ARM Linux
Quoted 43 lines · Tony Lindgren
Quoted 41 lines · Russell King - ARM Linux
Quoted 8 lines · Juha Yrjola
Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Yes, glibc sucks with that - they hide the Linux reboot syscall. Luckily, it is accessible via the syscall() interface:

#include <linux/reboot.h>

int sys_reboot(const char *cmd)

{
	return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
			LINUX_REBOOT_CMD_RESTART2, cmd);
}
Quoted 10 lines
Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

The notifier chain is called in any case.

Quoted 3 lines

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

No, reboot mode tells _how_ to perform the reboot - whether that be by hardware reset, gpio reset or a soft call via the reset address. It's not supposed to tell the boot loader what to do.

Quoted 7 lines
Quoted 4 lines

So if the reboot mode can't be used for this.. Should we change Juha's sysfs interface patch to store something else like bootloader_mode?

I guess we cannot use kexec for this either?

Why not use the mechanism that's already there as I've already pointed out?

Sorry I misunderstood, I thought you did not want to use reboot_mode for this at all..

To recap, so we change machine_restart() like you described above, and then this patch is still valid, except to update the description.

Juha, does that sound OK to you?

Quoted 2 lines

Yes, glibc might be fscked in the head over the reboot() prototype but that's easy to work-around as I've demonstrated.

Yeah sounds good to me.

Tony

author maintainer
#11 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Quoted 50 lines · Tony Lindgren
Quoted 49 lines · Russell King - ARM Linux
Quoted 47 lines · Tony Lindgren
Quoted 34 lines · Russell King - ARM Linux
Quoted 8 lines · Juha Yrjola
Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Yes, glibc sucks with that - they hide the Linux reboot syscall. Luckily, it is accessible via the syscall() interface:

#include <linux/reboot.h>

int sys_reboot(const char *cmd)

{
	return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
			LINUX_REBOOT_CMD_RESTART2, cmd);
}
Quoted 10 lines
Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

The notifier chain is called in any case.

Quoted 7 lines
Quoted 3 lines

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

No, reboot mode tells _how_ to perform the reboot - whether that be by hardware reset, gpio reset or a soft call via the reset address. It's not supposed to tell the boot loader what to do.

So if the reboot mode can't be used for this.. Should we change Juha's sysfs interface patch to store something else like bootloader_mode?

I guess we cannot use kexec for this either?

Quoted 8 lines
Quoted 2 lines

Why not use the mechanism that's already there as I've already pointed out?

Sorry I misunderstood, I thought you did not want to use reboot_mode for this at all..

To recap, so we change machine_restart() like you described above, and then this patch is still valid, except to update the description.

Hmm, after reading it one more time..

Russell you want to pass char *cmd in addition to reboot_mode, right? And Juha's patch needs to be updated to use the cmd instead of reboot_mode?

Quoted 8 lines

Juha, does that sound OK to you?

Quoted 2 lines

Yes, glibc might be fscked in the head over the reboot() prototype but that's easy to work-around as I've demonstrated.

Yeah sounds good to me.

Tony

#12 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

In reply to Tony Lindgren
Quoted 48 lines · Tony Lindgren
Quoted 47 lines · Russell King - ARM Linux
Quoted 46 lines · Tony Lindgren
Quoted 34 lines · Russell King - ARM Linux
Quoted 8 lines · Juha Yrjola
Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Yes, glibc sucks with that - they hide the Linux reboot syscall. Luckily, it is accessible via the syscall() interface:

#include <linux/reboot.h>

int sys_reboot(const char *cmd)

{
	return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
			LINUX_REBOOT_CMD_RESTART2, cmd);
}
Quoted 10 lines
Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

The notifier chain is called in any case.

Quoted 7 lines
Quoted 3 lines

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

No, reboot mode tells _how_ to perform the reboot - whether that be by hardware reset, gpio reset or a soft call via the reset address. It's not supposed to tell the boot loader what to do.

So if the reboot mode can't be used for this.. Should we change Juha's sysfs interface patch to store something else like bootloader_mode?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I guess we cannot use kexec for this either?

Why not use the mechanism that's already there as I've already pointed out?

Sorry I misunderstood, I thought you did not want to use reboot_mode for this at all..

I don't want to use reboot_mode for this. machine_restart() and the reboot syscall has a way of passing a string to the platform specific code, and I'm suggesting that if you want the boot loader to do some magic, that's the way to do it. Use the 'cmd' argument provided to arch_reset() by the patch below - this will either be NULL if the standard reboot call is used, or a string if the alternative version is used.

Quoted 2 lines

To recap, so we change machine_restart() like you described above, and then this patch is still valid, except to update the description.

No, you've still got the wrong end of the stick.

 arch/arm/include/asm/system.h                     |    4 ++--
 arch/arm/kernel/process.c                         |   10 +++++-----
 arch/arm/mach-aaec2000/include/mach/system.h      |    2 +-
 arch/arm/mach-at91/include/mach/system.h          |    2 +-
 arch/arm/mach-clps711x/include/mach/system.h      |    2 +-
 arch/arm/mach-davinci/include/mach/system.h       |    2 +-
 arch/arm/mach-ebsa110/include/mach/system.h       |    2 +-
 arch/arm/mach-ep93xx/include/mach/system.h        |    2 +-
 arch/arm/mach-footbridge/include/mach/system.h    |    2 +-
 arch/arm/mach-h720x/include/mach/system.h         |    2 +-
 arch/arm/mach-imx/include/mach/system.h           |    2 +-
 arch/arm/mach-integrator/include/mach/system.h    |    2 +-
 arch/arm/mach-iop13xx/include/mach/system.h       |    2 +-
 arch/arm/mach-iop32x/include/mach/system.h        |    2 +-
 arch/arm/mach-iop33x/include/mach/system.h        |    2 +-
 arch/arm/mach-ixp2000/include/mach/system.h       |    2 +-
 arch/arm/mach-ixp23xx/include/mach/system.h       |    2 +-
 arch/arm/mach-ixp4xx/include/mach/system.h        |    2 +-
 arch/arm/mach-kirkwood/include/mach/system.h      |    2 +-
 arch/arm/mach-ks8695/include/mach/system.h        |    2 +-
 arch/arm/mach-l7200/include/mach/system.h         |    2 +-
 arch/arm/mach-lh7a40x/include/mach/system.h       |    2 +-
 arch/arm/mach-loki/include/mach/system.h          |    2 +-
 arch/arm/mach-msm/include/mach/system.h           |    2 +-
 arch/arm/mach-mv78xx0/include/mach/system.h       |    2 +-
 arch/arm/mach-mx2/system.c                        |    2 +-
 arch/arm/mach-netx/include/mach/system.h          |    2 +-
 arch/arm/mach-ns9xxx/include/mach/system.h        |    2 +-
 arch/arm/mach-orion5x/include/mach/system.h       |    2 +-
 arch/arm/mach-orion5x/lsmini-setup.c              |    2 +-
 arch/arm/mach-pnx4008/include/mach/system.h       |    2 +-
 arch/arm/mach-pxa/corgi.c                         |    6 +++---
 arch/arm/mach-pxa/include/mach/system.h           |    2 +-
 arch/arm/mach-pxa/mioa701.c                       |    6 +++---
 arch/arm/mach-pxa/poodle.c                        |    6 +++---
 arch/arm/mach-pxa/reset.c                         |    2 +-
 arch/arm/mach-pxa/spitz.c                         |    4 ++--
 arch/arm/mach-pxa/tosa.c                          |    4 ++--
 arch/arm/mach-realview/include/mach/system.h      |    2 +-
 arch/arm/mach-rpc/include/mach/system.h           |    2 +-
 arch/arm/mach-s3c2410/include/mach/system-reset.h |    2 +-
 arch/arm/mach-s3c6400/include/mach/system.h       |    2 +-
 arch/arm/mach-sa1100/include/mach/system.h        |    2 +-
 arch/arm/mach-shark/core.c                        |    2 +-
 arch/arm/mach-shark/include/mach/system.h         |    2 +-
 arch/arm/mach-versatile/include/mach/system.h     |    2 +-
 arch/arm/mach-w90x900/include/mach/system.h       |    2 +-
 arch/arm/plat-mxc/include/mach/system.h           |    2 +-
 arch/arm/plat-omap/include/mach/system.h          |    2 +-
 arch/arm/plat-s3c24xx/cpu.c                       |    6 +++---
 50 files changed, 65 insertions(+), 65 deletions(-)
arch/arm/include/asm/system.h +2 -2
index 811be55..0a0d49a 100644
@@ -97,8 +97,8 @@ extern void __show_regs(struct pt_regs *);
 extern int cpu_architecture(void);
 extern void cpu_init(void);
 
-void arm_machine_restart(char mode);
-extern void (*arm_pm_restart)(char str);
+void arm_machine_restart(char mode, const char *cmd);
+extern void (*arm_pm_restart)(char str, const char *cmd);
 
 #define UDBG_UNDEFINED	(1 << 0)
 #define UDBG_SYSCALL	(1 << 1)
arch/arm/kernel/process.c +5 -5
index af377c7..2de14e2 100644
@@ -83,7 +83,7 @@ static int __init hlt_setup(char *__unused)
 __setup("nohlt", nohlt_setup);
 __setup("hlt", hlt_setup);
 
-void arm_machine_restart(char mode)
+void arm_machine_restart(char mode, const char *cmd)
 {
 	/*
 	 * Clean and disable cache, and turn off interrupts
@@ -100,7 +100,7 @@ void arm_machine_restart(char mode)
 	/*
 	 * Now call the architecture specific reboot code.
 	 */
-	arch_reset(mode);
+	arch_reset(mode, cmd);
 
 	/*
 	 * Whoops - the architecture was unable to reboot.
@@ -120,7 +120,7 @@ EXPORT_SYMBOL(pm_idle);
 void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);
 
-void (*arm_pm_restart)(char str) = arm_machine_restart;
+void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
 EXPORT_SYMBOL_GPL(arm_pm_restart);
 
 
@@ -195,9 +195,9 @@ void machine_power_off(void)
 		pm_power_off();
 }
 
-void machine_restart(char * __unused)
+void machine_restart(char *cmd)
 {
-	arm_pm_restart(reboot_mode);
+	arm_pm_restart(reboot_mode, cmd);
 }
 
 void __show_regs(struct pt_regs *regs)
arch/arm/mach-aaec2000/include/mach/system.h +1 -1
index 8f4115d..fe08ca1 100644
@@ -16,7 +16,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	cpu_reset(0);
 }
arch/arm/mach-at91/include/mach/system.h +1 -1
index e712658..5268af3 100644
@@ -43,7 +43,7 @@ static inline void arch_idle(void)
 
 void (*at91_arch_reset)(void);
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/* call the CPU-specific reset function */
 	if (at91_arch_reset)
arch/arm/mach-clps711x/include/mach/system.h +1 -1
index 24e9615..f916cd7 100644
@@ -32,7 +32,7 @@ static inline void arch_idle(void)
 	mov	r0, r0");
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	cpu_reset(0);
 }
arch/arm/mach-davinci/include/mach/system.h +1 -1
index 17ca41d..b7e7036 100644
@@ -21,7 +21,7 @@ static void arch_idle(void)
 	cpu_do_idle();
 }
 
-static void arch_reset(char mode)
+static void arch_reset(char mode, const char *cmd)
 {
 	davinci_watchdog_reset();
 }
arch/arm/mach-ebsa110/include/mach/system.h +1 -1
index 350a028..9a26245 100644
@@ -34,6 +34,6 @@ static inline void arch_idle(void)
 	asm volatile ("mcr p15, 0, ip, c15, c1, 2" : : : "cc");
 }
 
-#define arch_reset(mode)	cpu_reset(0x80000000)
+#define arch_reset(mode, cmd)	cpu_reset(0x80000000)
 
 #endif
arch/arm/mach-ep93xx/include/mach/system.h +1 -1
index 67789d0..ed8f35e 100644
@@ -9,7 +9,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	u32 devicecfg;
 
arch/arm/mach-footbridge/include/mach/system.h +1 -1
index 2db7f36..0b29315 100644
@@ -18,7 +18,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	if (mode == 's') {
 		/*
arch/arm/mach-h720x/include/mach/system.h +1 -1
index e4a7c76..a708d24 100644
@@ -25,7 +25,7 @@ static void arch_idle(void)
 }
 
 
-static __inline__ void arch_reset(char mode)
+static __inline__ void arch_reset(char mode, const char *cmd)
 {
 	CPU_REG (PMU_BASE, PMU_STAT) |= PMU_WARMRESET;
 }
arch/arm/mach-imx/include/mach/system.h +1 -1
index adee7e5..46d4ca9 100644
@@ -32,7 +32,7 @@ arch_idle(void)
 }
 
 static inline void
-arch_reset(char mode)
+arch_reset(char mode, const char *cmd)
 {
 	cpu_reset(0);
 }
arch/arm/mach-integrator/include/mach/system.h +1 -1
index c485345..e1551b8 100644
@@ -32,7 +32,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/*
 	 * To reset, we hit the on-board reset register
arch/arm/mach-iop13xx/include/mach/system.h +1 -1
index c7127f4..d0c66ef 100644
@@ -13,7 +13,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/*
 	 * Reset the internal bus (warning both cores are reset)
arch/arm/mach-iop32x/include/mach/system.h +1 -1
index 32d9e5b..a4b808f 100644
@@ -16,7 +16,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	local_irq_disable();
 
arch/arm/mach-iop33x/include/mach/system.h +1 -1
index 0cb3ad8..f192a34 100644
@@ -14,7 +14,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	*IOP3XX_PCSR = 0x30;
 
arch/arm/mach-ixp2000/include/mach/system.h +1 -1
index 2e9c68f..de37099 100644
@@ -17,7 +17,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	local_irq_disable();
 
arch/arm/mach-ixp23xx/include/mach/system.h +1 -1
index d57c3fc..8920ff2 100644
@@ -19,7 +19,7 @@ static inline void arch_idle(void)
 #endif
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/* First try machine specific support */
 	if (machine_is_ixdp2351()) {
arch/arm/mach-ixp4xx/include/mach/system.h +1 -1
index 92a7e8d..d2aa26f 100644
@@ -20,7 +20,7 @@ static inline void arch_idle(void)
 }
 
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	if ( 1 && mode == 's') {
 		/* Jump into ROM at address 0 */
arch/arm/mach-kirkwood/include/mach/system.h +1 -1
index 8510f6c..23a1914 100644
@@ -17,7 +17,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/*
 	 * Enable soft reset to assert RSTOUTn.
arch/arm/mach-ks8695/include/mach/system.h +1 -1
index 5a9b032..fb1dda9 100644
@@ -27,7 +27,7 @@ static void arch_idle(void)
 
 }
 
-static void arch_reset(char mode)
+static void arch_reset(char mode, const char *cmd)
 {
 	unsigned int reg;
 
arch/arm/mach-l7200/include/mach/system.h +1 -1
index 5272abe..e0dd3b6 100644
@@ -19,7 +19,7 @@ static inline void arch_idle(void)
 	*(unsigned long *)(IO_BASE + 0x50004) = 1;	/* idle mode */
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	if (mode == 's') {
 		cpu_reset(0);
arch/arm/mach-lh7a40x/include/mach/system.h +1 -1
index fa46bb1..45a56d3 100644
@@ -13,7 +13,7 @@ static inline void arch_idle(void)
 	cpu_do_idle ();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	cpu_reset (0);
 }
arch/arm/mach-loki/include/mach/system.h +1 -1
index 8db1147..c1de36f 100644
@@ -17,7 +17,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/*
 	 * Enable soft reset to assert RSTOUTn.
arch/arm/mach-msm/include/mach/system.h +1 -1
index f05ad2e..574ccc4 100644
@@ -17,7 +17,7 @@
 
 void arch_idle(void);
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	for (;;) ;  /* depends on IPC w/ other core */
 }
arch/arm/mach-mv78xx0/include/mach/system.h +1 -1
index 7d51794..1d6350b 100644
@@ -17,7 +17,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/*
 	 * Enable soft reset to assert RSTOUTn.
arch/arm/mach-mx2/system.c +1 -1
index 7b82697..92c79d4 100644
@@ -46,7 +46,7 @@ void arch_idle(void)
 /*
  * Reset the system. It is called by machine_restart().
  */
-void arch_reset(char mode)
+void arch_reset(char mode, const char *cmd)
 {
 	struct clk *clk;
 
arch/arm/mach-netx/include/mach/system.h +1 -1
index 6c1023b..dc7b4bc 100644
@@ -28,7 +28,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES,
 	       NETX_SYSTEM_RES_CR);
arch/arm/mach-ns9xxx/include/mach/system.h +1 -1
index e2068c5..1561588 100644
@@ -20,7 +20,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 #ifdef CONFIG_PROCESSOR_NS9360
 	if (processor_is_ns9360())
arch/arm/mach-orion5x/include/mach/system.h +1 -1
index 08e4307..9b8db1d 100644
@@ -19,7 +19,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	/*
 	 * Enable and issue soft reset
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
index e0c43b8..c9bf6b8 100644
@@ -186,7 +186,7 @@ static struct mv_sata_platform_data lsmini_sata_data = {
 
 static void lsmini_power_off(void)
 {
-	arch_reset(0);
+	arch_reset(0, NULL);
 }
 
 
arch/arm/mach-pnx4008/include/mach/system.h +1 -1
index e12e7ab..5dda2bb 100644
@@ -30,7 +30,7 @@ static void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	cpu_reset(0);
 }
arch/arm/mach-pxa/corgi.c +3 -3
index 3b89e50..cdf21dd 100644
@@ -635,16 +635,16 @@ static void corgi_poweroff(void)
 		/* Green LED off tells the bootloader to halt */
 		gpio_set_value(CORGI_GPIO_LED_GREEN, 0);
 
-	arm_machine_restart('h');
+	arm_machine_restart('h', NULL);
 }
 
-static void corgi_restart(char mode)
+static void corgi_restart(char mode, const char *cmd)
 {
 	if (!machine_is_corgi())
 		/* Green LED on tells the bootloader to reboot */
 		gpio_set_value(CORGI_GPIO_LED_GREEN, 1);
 
-	arm_machine_restart('h');
+	arm_machine_restart('h', cmd);
 }
 
 static void __init corgi_init(void)
arch/arm/mach-pxa/include/mach/system.h +1 -1
index 0a587c4..d1fce8b 100644
@@ -20,4 +20,4 @@ static inline void arch_idle(void)
 }
 
 
-void arch_reset(char mode);
+void arch_reset(char mode, const char *cmd);
arch/arm/mach-pxa/mioa701.c +3 -3
index 0257727..97c93a7 100644
@@ -788,13 +788,13 @@ static void mioa701_machine_exit(void);
 static void mioa701_poweroff(void)
 {
 	mioa701_machine_exit();
-	arm_machine_restart('s');
+	arm_machine_restart('s', NULL);
 }
 
-static void mioa701_restart(char c)
+static void mioa701_restart(char c, const char *cmd)
 {
 	mioa701_machine_exit();
-	arm_machine_restart('s');
+	arm_machine_restart('s', cmd);
 }
 
 struct gpio_ress global_gpios[] = {
arch/arm/mach-pxa/poodle.c +3 -3
index 572ddec..036bbde 100644
@@ -501,12 +501,12 @@ static struct platform_device *devices[] __initdata = {
 
 static void poodle_poweroff(void)
 {
-	arm_machine_restart('h');
+	arm_machine_restart('h', NULL);
 }
 
-static void poodle_restart(char mode)
+static void poodle_restart(char mode, const char *cmd)
 {
-	arm_machine_restart('h');
+	arm_machine_restart('h', cmd);
 }
 
 static void __init poodle_init(void)
arch/arm/mach-pxa/reset.c +1 -1
index 867c95c..df29d45 100644
@@ -81,7 +81,7 @@ static void do_hw_reset(void)
 	OSMR3 = OSCR + 368640;	/* ... in 100 ms */
 }
 
-void arch_reset(char mode)
+void arch_reset(char mode, const char *cmd)
 {
 	clear_reset_status(RESET_STATUS_ALL);
 
arch/arm/mach-pxa/spitz.c +2 -2
index f697c49..7a0a430 100644
@@ -701,10 +701,10 @@ static struct platform_device *devices[] __initdata = {
 
 static void spitz_poweroff(void)
 {
-	arm_machine_restart('g');
+	arm_machine_restart('g', NULL);
 }
 
-static void spitz_restart(char mode)
+static void spitz_restart(char mode, const char *cmd)
 {
 	/* Bootloader magic for a reboot */
 	if((MSC0 & 0xffff0000) == 0x7ff00000)
arch/arm/mach-pxa/tosa.c +2 -2
index 66b1380..4f6f502 100644
@@ -876,10 +876,10 @@ static struct platform_device *devices[] __initdata = {
 
 static void tosa_poweroff(void)
 {
-	arm_machine_restart('g');
+	arm_machine_restart('g', NULL);
 }
 
-static void tosa_restart(char mode)
+static void tosa_restart(char mode, const char *cmd)
 {
 	/* Bootloader magic for a reboot */
 	if((MSC0 & 0xffff0000) == 0x7ff00000)
arch/arm/mach-realview/include/mach/system.h +1 -1
index a2f61c7..1a15a44 100644
@@ -34,7 +34,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	void __iomem *hdr_ctrl = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_RESETCTL_OFFSET;
 	unsigned int val;
arch/arm/mach-rpc/include/mach/system.h +1 -1
index bd7268b..45c7b93 100644
@@ -16,7 +16,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	iomd_writeb(0, IOMD_ROMCR0);
 
arch/arm/mach-s3c2410/include/mach/system-reset.h +1 -1
index 7613d0a..b8687f7 100644
@@ -22,7 +22,7 @@
 extern void (*s3c24xx_reset_hook)(void);
 
 static void
-arch_reset(char mode)
+arch_reset(char mode, const char *cmd)
 {
 	struct clk *wdtclk;
 
arch/arm/mach-s3c6400/include/mach/system.h +1 -1
index 652bbc4..090cfd9 100644
@@ -16,7 +16,7 @@ static void arch_idle(void)
 	/* nothing here yet */
 }
 
-static void arch_reset(char mode)
+static void arch_reset(char mode, const char *cmd)
 {
 	/* nothing here yet */
 }
arch/arm/mach-sa1100/include/mach/system.h +1 -1
index 63755ca..942b153 100644
@@ -10,7 +10,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	if (mode == 's') {
 		/* Jump into ROM at address 0 */
arch/arm/mach-shark/core.c +1 -1
index 4f3a265..358d875 100644
@@ -26,7 +26,7 @@
 #define ROMCARD_SIZE            0x08000000
 #define ROMCARD_START           0x10000000
 
-void arch_reset(char mode)
+void arch_reset(char mode, const char *cmd)
 {
         short temp;
         local_irq_disable();
arch/arm/mach-shark/include/mach/system.h +1 -1
index 0752ca2..21c373b 100644
@@ -7,7 +7,7 @@
 #define __ASM_ARCH_SYSTEM_H
 
 /* Found in arch/mach-shark/core.c */
-extern void arch_reset(char mode);
+extern void arch_reset(char mode, const char *cmd);
 
 static inline void arch_idle(void)
 {
arch/arm/mach-versatile/include/mach/system.h +1 -1
index c59e610..8ffc12a 100644
@@ -34,7 +34,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	u32 val;
 
arch/arm/mach-w90x900/include/mach/system.h +1 -1
index 93753f9..9406400 100644
@@ -21,7 +21,7 @@ static void arch_idle(void)
 {
 }
 
-static void arch_reset(char mode)
+static void arch_reset(char mode, const char *cmd)
 {
 	cpu_reset(0);
 }
arch/arm/plat-mxc/include/mach/system.h +1 -1
index bbfc374..cd03eba 100644
@@ -26,7 +26,7 @@ static inline void arch_idle(void)
 	cpu_do_idle();
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	cpu_reset(0);
 }
arch/arm/plat-omap/include/mach/system.h +1 -1
index 06923f2..145e402 100644
@@ -38,7 +38,7 @@ static inline void omap1_arch_reset(char mode)
 		omap_writew(1, ARM_RSTCT1);
 }
 
-static inline void arch_reset(char mode)
+static inline void arch_reset(char mode, const char *cmd)
 {
 	if (!cpu_class_is_omap2())
 		omap1_arch_reset(mode);
arch/arm/plat-s3c24xx/cpu.c +3 -3
index 542062f..1932b7e 100644
@@ -182,7 +182,7 @@ static unsigned long s3c24xx_read_idcode_v4(void)
  * with the caches enabled. It seems at least the S3C2440 has a problem
  * resetting if there is bus activity interrupted by the reset.
  */
-static void s3c24xx_pm_restart(char mode)
+static void s3c24xx_pm_restart(char mode, const char *cmd)
 {
 	if (mode != 's') {
 		unsigned long flags;
@@ -191,12 +191,12 @@ static void s3c24xx_pm_restart(char mode)
 		__cpuc_flush_kern_all();
 		__cpuc_flush_user_all();
 
-		arch_reset(mode);
+		arch_reset(mode, cmd);
 		local_irq_restore(flags);
 	}
 
 	/* fallback, or unhandled */
-	arm_machine_restart(mode);
+	arm_machine_restart(mode, cmd);
 }
 
 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
author maintainer Acked-by
#13 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Quoted 69 lines · Russell King - ARM Linux
Quoted 48 lines · Tony Lindgren
Quoted 47 lines · Russell King - ARM Linux
Quoted 46 lines · Tony Lindgren
Quoted 34 lines · Russell King - ARM Linux
Quoted 8 lines · Juha Yrjola
Quoted 2 lines · Russell King - ARM Linux

Right. You are aware that there is already a mechanism for doing this in the generic kernel (obviously not)?

I am. Unfortunately, glibc fails to support this mechanism, as you say. I didn't want to start making such intrusive changes for our trivial need.

Yes, glibc sucks with that - they hide the Linux reboot syscall. Luckily, it is accessible via the syscall() interface:

#include <linux/reboot.h>

int sys_reboot(const char *cmd)

{
	return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
			LINUX_REBOOT_CMD_RESTART2, cmd);
}
Quoted 10 lines
Quoted 7 lines

sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition to the standard parameters. This string is passed into machine_restart() which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this string is NULL.

We could change machine_restart() to pass this parameter through to arm_pm_restart() and ultimately down to arch_reset().

Sure. With RESTART2, I could've even used the reboot notifier chain with an OMAP3-specific driver to store the string.

The notifier chain is called in any case.

Quoted 7 lines
Quoted 3 lines

Are you suggesting to get rid of reboot_mode altogether? If not, could we still have the sysfs mechanism? A one-character reboot_mode would be plenty enough for us.

No, reboot mode tells _how_ to perform the reboot - whether that be by hardware reset, gpio reset or a soft call via the reset address. It's not supposed to tell the boot loader what to do.

So if the reboot mode can't be used for this.. Should we change Juha's sysfs interface patch to store something else like bootloader_mode?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I guess we cannot use kexec for this either?

Why not use the mechanism that's already there as I've already pointed out?

Sorry I misunderstood, I thought you did not want to use reboot_mode for this at all..

I don't want to use reboot_mode for this. machine_restart() and the reboot syscall has a way of passing a string to the platform specific code, and I'm suggesting that if you want the boot loader to do some magic, that's the way to do it. Use the 'cmd' argument provided to arch_reset() by the patch below - this will either be NULL if the standard reboot call is used, or a string if the alternative version is used.

Quoted 2 lines

To recap, so we change machine_restart() like you described above, and then this patch is still valid, except to update the description.

No, you've still got the wrong end of the stick.

<snip>

Quoted 48 lines
arch/arm/include/asm/system.h +2 -2
index 811be55..0a0d49a 100644
@@ -97,8 +97,8 @@ extern void __show_regs(struct pt_regs *);
 extern int cpu_architecture(void);
 extern void cpu_init(void);
 
-void arm_machine_restart(char mode);
-extern void (*arm_pm_restart)(char str);
+void arm_machine_restart(char mode, const char *cmd);
+extern void (*arm_pm_restart)(char str, const char *cmd);
 
 #define UDBG_UNDEFINED	(1 << 0)
 #define UDBG_SYSCALL	(1 << 1)
arch/arm/kernel/process.c +3 -3
index af377c7..2de14e2 100644
@@ -83,7 +83,7 @@ static int __init hlt_setup(char *__unused)
 __setup("nohlt", nohlt_setup);
 __setup("hlt", hlt_setup);
 
-void arm_machine_restart(char mode)
+void arm_machine_restart(char mode, const char *cmd)
 {
 	/*
 	 * Clean and disable cache, and turn off interrupts
@@ -100,7 +100,7 @@ void arm_machine_restart(char mode)
 	/*
 	 * Now call the architecture specific reboot code.
 	 */
-	arch_reset(mode);
+	arch_reset(mode, cmd);
 
 	/*
 	 * Whoops - the architecture was unable to reboot.
@@ -120,7 +120,7 @@ EXPORT_SYMBOL(pm_idle);
 void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);
 
-void (*arm_pm_restart)(char str) = arm_machine_restart;
+void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
 EXPORT_SYMBOL_GPL(arm_pm_restart);
 
 
@@ -195,9 +195,9 @@ void machine_power_off(void)
 		pm_power_off();

arch/arm/kernel/process.c void machine_power_off(void) · line 203

Quoted 10 lines
arch/arm/kernel/process.c +2 -2
 }
 
-void machine_restart(char * __unused)
+void machine_restart(char *cmd)
 {
-	arm_pm_restart(reboot_mode);
+	arm_pm_restart(reboot_mode, cmd);
 }
 
 void __show_regs(struct pt_regs *regs)

<snip>

Got it now, looks good to me.

author maintainer
#14 lore raw

Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

In reply to Tony Lindgren
Quoted 8 lines · Tony Lindgren

From: Juha Yrjola <[email protected]>

The reboot mode can be communicated to a bootloader (or the kernel itself) with a scratchpad register. This functionality is especially useful, if userspace is allowed to change the reboot mode.

Patch updated by Tony to also define the BOODMOD registers.

Dropping this from my upstream queue for now, it sounds like we can apply it as a fix after it's been updated to use cmd instead of mode.

Tony

Quoted 66 lines
---
 arch/arm/mach-omap2/prcm.c                |   14 ++++++++++++--
 arch/arm/plat-omap/include/mach/control.h |    9 +++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/prcm.c +12 -2
index f945156..12c0e03 100644
@@ -19,6 +19,7 @@
 #include <linux/io.h>
 
 #include <mach/common.h>
+#include <mach/control.h>
 #include <mach/prcm.h>
 
 #include "clock.h"
@@ -43,9 +44,18 @@ void omap_prcm_arch_reset(char mode)
 
 	if (cpu_is_omap24xx())
 		prcm_offs = WKUP_MOD;
-	else if (cpu_is_omap34xx())
+	else if (cpu_is_omap34xx()) {
+		u32 l;
+
 		prcm_offs = OMAP3430_GR_MOD;
-	else
+		l = ('B' << 24) | ('M' << 16) | mode;
+		/* Reserve the first word in scratchpad for communicating
+		 * with the boot ROM. A pointer to a data structure
+		 * describing the boot process can be stored there,
+		 * cf. OMAP34xx TRM, Initialization / Software Booting
+		 * Configuration. */
+		omap_writel(l, OMAP343X_SCRATCHPAD + 4);
+	} else
 		WARN_ON(1);
 
 	prm_set_mod_reg_bits(OMAP_RST_DPLL3, prcm_offs, RM_RSTCTRL);
arch/arm/plat-omap/include/mach/control.h +9 -1
index 269147f..1e1bcff 100644
@@ -189,6 +189,15 @@
 #define OMAP2_PBIASLITEPWRDNZ0		(1 << 1)
 #define OMAP2_PBIASLITEVMODE0		(1 << 0)
 
+/* CONTROL_IVA2_BOOTMOD bits */
+#define OMAP3_IVA2_BOOTMOD_SHIFT	0
+#define OMAP3_IVA2_BOOTMOD_MASK		(0xf << 0)
+#define OMAP3_IVA2_BOOTMOD_IDLE		(0x1 << 0)
+
+#define OMAP343X_SCRATCHPAD_ROM		(OMAP343X_CTRL_BASE + 0x860)
+#define OMAP343X_SCRATCHPAD		(OMAP343X_CTRL_BASE + 0x910)
+#define OMAP343X_SCRATCHPAD_ROM_OFFSET	0x19C
+
 #ifndef __ASSEMBLY__
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 extern void __iomem *omap_ctrl_base_get(void);
 
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#41 lore raw

Re: [PATCH 11/12] ARM: OMAP3: Add base address definitions and resources for OMAP 3 IS, v2

In reply to Tony Lindgren
Quoted 2 lines · Tony Lindgren

This replaces earlier patch from Sergio Aguirre titled "[REVIEW PATCH 03/14]
OMAP34XX: CAM: Resources fixes".

Here's this one updated to apply on top of Hiroshi's mbox updates series.

Tony

Quoted 1 line

From 85262ef9917eea14d5aaa37996e3f9205eee9e3d Mon Sep 17 00:00:00 2001

From: Tony Lindgren <[email protected]>
Date: Mon, 23 Mar 2009 18:23:49 -0700
Subject: [PATCH] ARM: OMAP3: Add base address definitions and resources for OMAP 3 IS, v2

This replaces earlier patch from Sergio Aguirre titled "[REVIEW PATCH 03/14]
OMAP34XX: CAM: Resources fixes".

arch/arm/mach-omap2/devices.c +108 -0
index 14537ff..7b2af1b 100644
@@ -28,6 +28,113 @@
 #include <mach/eac.h>
 #include <mach/mmc.h>
 
+#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
+
+static struct resource cam_resources[] = {
+	{
+		.start		= OMAP24XX_CAMERA_BASE,
+		.end		= OMAP24XX_CAMERA_BASE + 0xfff,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= INT_24XX_CAM_IRQ,
+		.flags		= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device omap_cam_device = {
+	.name		= "omap24xxcam",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(cam_resources),
+	.resource	= cam_resources,
+};
+
+static inline void omap_init_camera(void)
+{
+	platform_device_register(&omap_cam_device);
+}
+
+#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
+
+static struct resource omap3isp_resources[] = {
+	{
+		.start		= OMAP3430_ISP_BASE,
+		.end		= OMAP3430_ISP_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CBUFF_BASE,
+		.end		= OMAP3430_ISP_CBUFF_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CCP2_BASE,
+		.end		= OMAP3430_ISP_CCP2_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CCDC_BASE,
+		.end		= OMAP3430_ISP_CCDC_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_HIST_BASE,
+		.end		= OMAP3430_ISP_HIST_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_H3A_BASE,
+		.end		= OMAP3430_ISP_H3A_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_PREV_BASE,
+		.end		= OMAP3430_ISP_PREV_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_RESZ_BASE,
+		.end		= OMAP3430_ISP_RESZ_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_SBL_BASE,
+		.end		= OMAP3430_ISP_SBL_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CSI2A_BASE,
+		.end		= OMAP3430_ISP_CSI2A_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= OMAP3430_ISP_CSI2PHY_BASE,
+		.end		= OMAP3430_ISP_CSI2PHY_END,
+		.flags		= IORESOURCE_MEM,
+	},
+	{
+		.start		= INT_34XX_CAM_IRQ,
+		.flags		= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device omap3isp_device = {
+	.name		= "omap3isp",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(omap3isp_resources),
+	.resource	= omap3isp_resources,
+};
+
+static inline void omap_init_camera(void)
+{
+	platform_device_register(&omap3isp_device);
+}
+#else
+static inline void omap_init_camera(void)
+{
+}
+#endif
+
 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
 
 #define MBOX_REG_SIZE	0x120
@@ -527,6 +634,7 @@ static int __init omap2_init_devices(void)
 	 * in alphabetical order so they're easier to sort through.
 	 */
 	omap_hsmmc_reset();
+	omap_init_camera();
 	omap_init_mbox();
 	omap_init_mcspi();
 	omap_hdq_init();
arch/arm/plat-omap/include/mach/omap34xx.h +27 -0
index 89173f1..1b1c35d 100644
@@ -49,6 +49,33 @@
 #define OMAP343X_CTRL_BASE	OMAP343X_SCM_BASE
 
 #define OMAP34XX_IC_BASE	0x48200000
+
+#define OMAP3430_ISP_BASE		(L4_34XX_BASE + 0xBC000)
+#define OMAP3430_ISP_CBUFF_BASE		(OMAP3430_ISP_BASE + 0x0100)
+#define OMAP3430_ISP_CCP2_BASE		(OMAP3430_ISP_BASE + 0x0400)
+#define OMAP3430_ISP_CCDC_BASE		(OMAP3430_ISP_BASE + 0x0600)
+#define OMAP3430_ISP_HIST_BASE		(OMAP3430_ISP_BASE + 0x0A00)
+#define OMAP3430_ISP_H3A_BASE		(OMAP3430_ISP_BASE + 0x0C00)
+#define OMAP3430_ISP_PREV_BASE		(OMAP3430_ISP_BASE + 0x0E00)
+#define OMAP3430_ISP_RESZ_BASE		(OMAP3430_ISP_BASE + 0x1000)
+#define OMAP3430_ISP_SBL_BASE		(OMAP3430_ISP_BASE + 0x1200)
+#define OMAP3430_ISP_MMU_BASE		(OMAP3430_ISP_BASE + 0x1400)
+#define OMAP3430_ISP_CSI2A_BASE		(OMAP3430_ISP_BASE + 0x1800)
+#define OMAP3430_ISP_CSI2PHY_BASE	(OMAP3430_ISP_BASE + 0x1970)
+
+#define OMAP3430_ISP_END		(OMAP3430_ISP_BASE         + 0x06F)
+#define OMAP3430_ISP_CBUFF_END		(OMAP3430_ISP_CBUFF_BASE   + 0x077)
+#define OMAP3430_ISP_CCP2_END		(OMAP3430_ISP_CCP2_BASE    + 0x1EF)
+#define OMAP3430_ISP_CCDC_END		(OMAP3430_ISP_CCDC_BASE    + 0x0A7)
+#define OMAP3430_ISP_HIST_END		(OMAP3430_ISP_HIST_BASE    + 0x047)
+#define OMAP3430_ISP_H3A_END		(OMAP3430_ISP_H3A_BASE     + 0x05F)
+#define OMAP3430_ISP_PREV_END		(OMAP3430_ISP_PREV_BASE    + 0x09F)
+#define OMAP3430_ISP_RESZ_END		(OMAP3430_ISP_RESZ_BASE    + 0x0AB)
+#define OMAP3430_ISP_SBL_END		(OMAP3430_ISP_SBL_BASE     + 0x0FB)
+#define OMAP3430_ISP_MMU_END		(OMAP3430_ISP_MMU_BASE     + 0x06F)
+#define OMAP3430_ISP_CSI2A_END		(OMAP3430_ISP_CSI2A_BASE   + 0x16F)
+#define OMAP3430_ISP_CSI2PHY_END	(OMAP3430_ISP_CSI2PHY_BASE + 0x007)
+
 #define OMAP34XX_IVA_INTC_BASE	0x40000000
 #define OMAP34XX_HSUSB_OTG_BASE	(L4_34XX_BASE + 0xAB000)
 #define OMAP34XX_HSUSB_HOST_BASE	(L4_34XX_BASE + 0x64000)
author maintainer
#48 lore raw
In reply to Tony Lindgren
Quoted 8 lines · Tony Lindgren

Hi all,

Here are the patches I promised last week, sorry for the delay in posting them. I ended up leaving out the mach-omap3/board-*.c files as they still need a bit of work.

I may post one more series after this to add few more omap3 boards if we have enough time.

I've added this series to my for-next branch. That is except for the "ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx" patch that needs to be updated.

Quoted 60 lines

Cheers,

Tony

---

Adrian Hunter (3):
ARM: OMAP3: mmc-twl4030 allow arbitrary slot names
ARM: OMAP3: mmc-twl4030 add cover switch
ARM: OMAP3: mmc-twl4030 fix name buffer length

David Brownell (3):
ARM: OMAP3: mmc-twl4030 fix for vmmc = 0
ARM: OMAP3: mmc-twl4030 init passes device nodes back
ARM: OMAP3: mmc-twl4030 voltage cleanup

Felipe Balbi (1):
ARM: OMAP3: MUSB initialization for omap hw

Grazvydas Ignotas (1):
ARM: OMAP3: mmc-twl4030 add MMC3 support

Jarkko Nikula (1):
ARM: OMAP3: Remove unused CONFIG_I2C2_OMAP_BEAGLE

Juha Yrjola (1):
ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx

Tony Lindgren (2):
ARM: OMAP3: Add base address definitions and resources for OMAP 3 IS
ARM: OMAP3: Add more GPIO mux options

 arch/arm/mach-omap2/Makefile               |    2 
 arch/arm/mach-omap2/board-2430sdp.c        |    2 
 arch/arm/mach-omap2/board-ldp.c            |    2 
 arch/arm/mach-omap2/board-omap3beagle.c    |    5 -
 arch/arm/mach-omap2/board-omap3pandora.c   |    9 +
 arch/arm/mach-omap2/board-overo.c          |    3 
 arch/arm/mach-omap2/devices.c              |  108 ++++++++++++++++
 arch/arm/mach-omap2/mmc-twl4030.c          |  186 ++++++++++++++++++++--------
 arch/arm/mach-omap2/mmc-twl4030.h          |    6 +
 arch/arm/mach-omap2/mux.c                  |   27 ++++
 arch/arm/mach-omap2/prcm.c                 |   14 ++
 arch/arm/mach-omap2/usb-musb.c             |  185 ++++++++++++++++++++++++++++
 arch/arm/plat-omap/devices.c               |    3 
 arch/arm/plat-omap/include/mach/control.h  |    9 +
 arch/arm/plat-omap/include/mach/mmc.h      |    2 
 arch/arm/plat-omap/include/mach/mux.h      |   13 ++
 arch/arm/plat-omap/include/mach/omap34xx.h |   27 ++++
 arch/arm/plat-omap/include/mach/usb.h      |    8 +
 18 files changed, 549 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm/mach-omap2/usb-musb.c
Signature · 5 lines
Signature
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#46 lore raw

PATCH 1/1 ARM: OMAP: Add name for musb clocks

In reply to Tony Lindgren

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Initial commit ID (Likely to change): 7c8bb23f02911def7e5196fbd39f5c16d09dc635

PatchWorks
http://patchwork.kernel.org/patch/12500/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=7c8bb23f02911def7e5196fbd39f5c16d09dc635