mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Add Reset Support for omap3.
@ 2011-09-09 12:10 Juergen Kilb
  2011-09-09 12:10 ` [PATCH] Add omap_hsmmc platform data Juergen Kilb
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Juergen Kilb @ 2011-09-09 12:10 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Kilb

Inspired from reset_cpu in omap4_generic.c.

Signed-off-by: Juergen Kilb <j.kilb@phytec.de>
---
 arch/arm/mach-omap/include/mach/omap3-silicon.h |    3 +++
 arch/arm/mach-omap/omap3_generic.c              |    5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/omap3-silicon.h b/arch/arm/mach-omap/include/mach/omap3-silicon.h
index 0e6a45f..67f7747 100644
--- a/arch/arm/mach-omap/include/mach/omap3-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap3-silicon.h
@@ -132,5 +132,8 @@
 #define OMAP_SDRC_CS0		0x80000000
 #define OMAP_SDRC_CS1		0xA0000000
 
+/* PRM */
+#define PRM_RSTCTRL_RESET       0x04
+
 #endif /* __ASM_ARCH_OMAP3_H */
 
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 661a971..9627a6b 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -59,8 +59,9 @@
  */
 void __noreturn reset_cpu(unsigned long addr)
 {
-	/* FIXME: Enable WDT and cause reset */
-	hang();
+	writel(PRM_RSTCTRL_RESET, PRM_REG(RSTCTRL));
+
+	while (1);
 }
 EXPORT_SYMBOL(reset_cpu);
 
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Add omap_hsmmc platform data.
  2011-09-09 12:10 [PATCH] Add Reset Support for omap3 Juergen Kilb
@ 2011-09-09 12:10 ` Juergen Kilb
  2011-09-09 12:10 ` [PATCH] Added helper function to get CS1 base address Juergen Kilb
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Juergen Kilb @ 2011-09-09 12:10 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Kilb

Add platform data to specify maximum frequency of hsmmc interface
which can be restricted due to external level shifters.

Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
 arch/arm/mach-omap/include/mach/omap_hsmmc.h |   28 ++++++++++++++++++++++++++
 drivers/mci/omap_hsmmc.c                     |   10 ++++++++-
 2 files changed, 37 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap/include/mach/omap_hsmmc.h

diff --git a/arch/arm/mach-omap/include/mach/omap_hsmmc.h b/arch/arm/mach-omap/include/mach/omap_hsmmc.h
new file mode 100644
index 0000000..a15f8e6
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/omap_hsmmc.h
@@ -0,0 +1,28 @@
+/**
+ * @file
+ * @brief This file contains exported structure for OMAP hsmmc
+ *
+ * FileName: include/asm-arm/arch-omap/omap_hsmmc.h
+ *
+ * OMAP3 and OMAP4 has a MMC/SD controller embedded.
+ * This file provides the platform data structure required to
+ * addapt to platform specialities.
+ */
+/*
+ * (C) Copyright 2011
+ * Phytec Messtechnik GmbH, <www.phytec.de>
+ * Juergen Kilb <j.kilb@phytec.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_OMAP_HSMMC_H
+#define  __ASM_OMAP_HSMMC_H
+
+/** omapmmc platform data structure */
+struct omap_hsmmc_platform_data {
+	unsigned f_max;         /* host interface upper limit */
+};
+#endif /* __ASM_OMAP_HSMMC_H */
diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index 5fdf445..bf8d4a9 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -31,6 +31,8 @@
 #include <errno.h>
 #include <asm/io.h>
 
+#include <mach/omap_hsmmc.h>
+
 struct hsmmc {
 	unsigned char res1[0x10];
 	unsigned int sysconfig;		/* 0x10 */
@@ -549,6 +551,7 @@ static void mmc_set_ios(struct mci_host *mci, struct device_d *dev,
 static int omap_mmc_probe(struct device_d *dev)
 {
 	struct omap_hsmmc *hsmmc;
+	struct omap_hsmmc_platform_data *pdata;
 
 	hsmmc = xzalloc(sizeof(*hsmmc));
 
@@ -564,7 +567,12 @@ static int omap_mmc_probe(struct device_d *dev)
 	hsmmc->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
 	hsmmc->mci.f_min = 400000;
-	hsmmc->mci.f_max = 52000000;
+
+	pdata = (struct omap_hsmmc_platform_data *)dev->platform_data;
+	if (pdata->f_max)
+		hsmmc->mci.f_max = pdata->f_max;
+	else
+		hsmmc->mci.f_max = 52000000;
 
 	mci_register(&hsmmc->mci);
 
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Added helper function to get CS1 base address.
  2011-09-09 12:10 [PATCH] Add Reset Support for omap3 Juergen Kilb
  2011-09-09 12:10 ` [PATCH] Add omap_hsmmc platform data Juergen Kilb
@ 2011-09-09 12:10 ` Juergen Kilb
  2011-09-09 12:10 ` [PATCH] Corrected ns16550 access at all omap based boards Juergen Kilb
  2011-09-12 10:32 ` [PATCH] Add Reset Support for omap3 Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Juergen Kilb @ 2011-09-09 12:10 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Kilb

This helper function can be used for automatic
SDDR configuration based on register settings
made by a previously first stage bootloader
i.e. x-loader.

Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
 arch/arm/mach-omap/include/mach/sys_info.h |    1 +
 arch/arm/mach-omap/omap3_generic.c         |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/sys_info.h b/arch/arm/mach-omap/include/mach/sys_info.h
index f557068..f0594bf 100644
--- a/arch/arm/mach-omap/include/mach/sys_info.h
+++ b/arch/arm/mach-omap/include/mach/sys_info.h
@@ -91,6 +91,7 @@
 u32 get_cpu_type(void);
 u32 get_cpu_rev(void);
 u32 get_sdr_cs_size(u32 offset);
+u32 get_sdr_cs1_base(void);
 inline u32 get_sysboot_value(void);
 u32 get_gpmc0_base(void);
 u32 get_base(void);
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 9627a6b..7468441 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -178,7 +178,26 @@ u32 get_sdr_cs_size(u32 offset)
 	size *= 2 * (1024 * 1024);	/* find size in MB */
 	return size;
 }
+EXPORT_SYMBOL(get_sdr_cs_size);
+/**
+ * @brief base address of chip select 1 (cs0 is defined at 0x80000000)
+ *
+ * @return return the CS1 base address.
+ */
+u32 get_sdr_cs1_base(void)
+{
+	u32 base;
+	u32 cs_cfg;
 
+	cs_cfg = readl(SDRC_REG(CS_CFG));
+	/* get ram size field */
+	base = (cs_cfg & 0x0000000F) << 2; /* get CS1STARTHIGH */
+	base = base | ((cs_cfg & 0x00000300) >> 8); /* get CS1STARTLOW */
+	base = base << 25;
+	base += 0x80000000;
+	return base;
+}
+EXPORT_SYMBOL(get_sdr_cs1_base);
 /**
  * @brief Get the initial SYSBOOT value
  *
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Corrected ns16550 access at all omap based boards.
  2011-09-09 12:10 [PATCH] Add Reset Support for omap3 Juergen Kilb
  2011-09-09 12:10 ` [PATCH] Add omap_hsmmc platform data Juergen Kilb
  2011-09-09 12:10 ` [PATCH] Added helper function to get CS1 base address Juergen Kilb
@ 2011-09-09 12:10 ` Juergen Kilb
  2011-09-12 10:32 ` [PATCH] Add Reset Support for omap3 Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Juergen Kilb @ 2011-09-09 12:10 UTC (permalink / raw)
  To: barebox; +Cc: Juergen Kilb

Commit c71a77ab8 (ns16550: switch to resource) has introduced generic
read/write access to 16550 register and a 'shift' parameter to allign
register index to physicall registers.
The correct 'shift' value was missing in all omap based boards.
Corrected this to 2 which has fixed the problem.

Tested on a PCM-049 phyCORE-OMAP4 board.

Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
Tested-by: Jan Weitzel <J.Weitzel@phytec.de>
---
 arch/arm/boards/omap/board-beagle.c   |    1 +
 arch/arm/boards/omap/board-omap3evm.c |    1 +
 arch/arm/boards/omap/board-sdp343x.c  |    1 +
 arch/arm/boards/panda/board.c         |    1 +
 arch/arm/boards/pcm049/board.c        |    1 +
 5 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/omap/board-beagle.c b/arch/arm/boards/omap/board-beagle.c
index 49af40c..4e7f179 100644
--- a/arch/arm/boards/omap/board-beagle.c
+++ b/arch/arm/boards/omap/board-beagle.c
@@ -237,6 +237,7 @@ void board_init(void)
 
 static struct NS16550_plat serial_plat = {
 	.clock = 48000000,      /* 48MHz (APLL96/2) */
+	.shift = 2,
 };
 
 /**
diff --git a/arch/arm/boards/omap/board-omap3evm.c b/arch/arm/boards/omap/board-omap3evm.c
index a2532d5..71d6ca9 100644
--- a/arch/arm/boards/omap/board-omap3evm.c
+++ b/arch/arm/boards/omap/board-omap3evm.c
@@ -213,6 +213,7 @@ void board_init(void)
 
 static struct NS16550_plat serial_plat = {
 	.clock		= 48000000,      /* 48MHz (APLL96/2) */
+	.shift		= 2,
 };
 
 /**
diff --git a/arch/arm/boards/omap/board-sdp343x.c b/arch/arm/boards/omap/board-sdp343x.c
index 82fc16d..83efe62 100644
--- a/arch/arm/boards/omap/board-sdp343x.c
+++ b/arch/arm/boards/omap/board-sdp343x.c
@@ -605,6 +605,7 @@ static void mux_config(void)
 
 static struct NS16550_plat serial_plat = {
 	.clock = 48000000,	/* 48MHz (APLL96/2) */
+	.shift = 2,
 };
 
 /**
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 1303c47..33ec144 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -32,6 +32,7 @@ static int board_revision;
 
 static struct NS16550_plat serial_plat = {
 	.clock = 48000000,      /* 48MHz (APLL96/2) */
+	.shift = 2,
 };
 
 static int panda_console_init(void)
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index 502e121..3d02779 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -43,6 +43,7 @@
 
 static struct NS16550_plat serial_plat = {
 	.clock = 48000000,      /* 48MHz (APLL96/2) */
+	.shift = 2,
 };
 
 static int pcm049_console_init(void)
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add Reset Support for omap3.
  2011-09-09 12:10 [PATCH] Add Reset Support for omap3 Juergen Kilb
                   ` (2 preceding siblings ...)
  2011-09-09 12:10 ` [PATCH] Corrected ns16550 access at all omap based boards Juergen Kilb
@ 2011-09-12 10:32 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2011-09-12 10:32 UTC (permalink / raw)
  To: Juergen Kilb; +Cc: barebox

Hi Jürgen,

Applied the first three patches to -next, the fourth to master.

Sascha

On Fri, Sep 09, 2011 at 02:10:53PM +0200, Juergen Kilb wrote:
> Inspired from reset_cpu in omap4_generic.c.
> 
> Signed-off-by: Juergen Kilb <j.kilb@phytec.de>
> ---
>  arch/arm/mach-omap/include/mach/omap3-silicon.h |    3 +++
>  arch/arm/mach-omap/omap3_generic.c              |    5 +++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-omap/include/mach/omap3-silicon.h b/arch/arm/mach-omap/include/mach/omap3-silicon.h
> index 0e6a45f..67f7747 100644
> --- a/arch/arm/mach-omap/include/mach/omap3-silicon.h
> +++ b/arch/arm/mach-omap/include/mach/omap3-silicon.h
> @@ -132,5 +132,8 @@
>  #define OMAP_SDRC_CS0		0x80000000
>  #define OMAP_SDRC_CS1		0xA0000000
>  
> +/* PRM */
> +#define PRM_RSTCTRL_RESET       0x04
> +
>  #endif /* __ASM_ARCH_OMAP3_H */
>  
> diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
> index 661a971..9627a6b 100644
> --- a/arch/arm/mach-omap/omap3_generic.c
> +++ b/arch/arm/mach-omap/omap3_generic.c
> @@ -59,8 +59,9 @@
>   */
>  void __noreturn reset_cpu(unsigned long addr)
>  {
> -	/* FIXME: Enable WDT and cause reset */
> -	hang();
> +	writel(PRM_RSTCTRL_RESET, PRM_REG(RSTCTRL));
> +
> +	while (1);
>  }
>  EXPORT_SYMBOL(reset_cpu);
>  
> -- 
> 1.7.0.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-12 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-09 12:10 [PATCH] Add Reset Support for omap3 Juergen Kilb
2011-09-09 12:10 ` [PATCH] Add omap_hsmmc platform data Juergen Kilb
2011-09-09 12:10 ` [PATCH] Added helper function to get CS1 base address Juergen Kilb
2011-09-09 12:10 ` [PATCH] Corrected ns16550 access at all omap based boards Juergen Kilb
2011-09-12 10:32 ` [PATCH] Add Reset Support for omap3 Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox