summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authoru-boot@bugs.denx.de <u-boot@bugs.denx.de>2008-09-11 15:40:01 +0200
committerWolfgang Denk <wd@denx.de>2008-09-13 02:07:39 +0200
commitfb661ea444ae61de60520f66ae84cdb5dd5a3246 (patch)
treecfee6b4bd048e3b425aead21869601e681bb0483 /board
parente99b607a5ec56ce66e0bcccb78480d5e16fb7bc5 (diff)
downloadu-boot-imx-fb661ea444ae61de60520f66ae84cdb5dd5a3246.zip
u-boot-imx-fb661ea444ae61de60520f66ae84cdb5dd5a3246.tar.gz
u-boot-imx-fb661ea444ae61de60520f66ae84cdb5dd5a3246.tar.bz2
85xx: socrates: autoprobe Lime chip
This patch is an attempt to implement autoprobing for the Lime presence on the bus. Configure GPCM for Lime CS2 and try to access chip ID registers. Second read atempt delivers register values if the chip is present. Signed-off-by: Anatolij Gustschin <agust@denx.de>
Diffstat (limited to 'board')
-rw-r--r--board/socrates/socrates.c58
1 files changed, 43 insertions, 15 deletions
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index cdab1a2..0991177 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -36,12 +36,15 @@
#include <libfdt.h>
#include <fdt_support.h>
#include <asm/io.h>
-
+#include <i2c.h>
+#include <mb862xx.h>
+#include <video_fb.h>
#include "upm_table.h"
DECLARE_GLOBAL_DATA_PTR;
extern flash_info_t flash_info[]; /* FLASH chips info */
+extern GraphicDevice mb862xx;
void local_bus_init (void);
ulong flash_get_size (ulong base, int banknum);
@@ -174,11 +177,9 @@ void local_bus_init (void)
out_be32 (&lbc->mamr, 0x44440); /* Use a customer-supplied value */
upmconfig (UPMA, (uint *)UPMTableA, sizeof(UPMTableA)/sizeof(int));
- if (getenv("lime")) {
- /* Init UPMB for Lime controller access */
- out_be32 (&lbc->mbmr, 0x444440); /* Use a customer-supplied value */
- upmconfig (UPMB, (uint *)UPMTableB, sizeof(UPMTableB)/sizeof(int));
- }
+ /* Init UPMB for Lime controller access */
+ out_be32 (&lbc->mbmr, 0x444440); /* Use a customer-supplied value */
+ upmconfig (UPMB, (uint *)UPMTableB, sizeof(UPMTableB)/sizeof(int));
}
#if defined(CONFIG_PCI)
@@ -245,7 +246,7 @@ ft_board_setup(void *blob, bd_t *bd)
val[i++] = gd->bd->bi_flashstart;
val[i++] = gd->bd->bi_flashsize;
- if (getenv("lime")) {
+ if (mb862xx.frameAdrs == CFG_LIME_BASE) {
/* Fixup LIME mapping */
val[i++] = 2; /* chip select number */
val[i++] = 0; /* always 0 */
@@ -267,10 +268,6 @@ ft_board_setup(void *blob, bd_t *bd)
}
#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
-#include <i2c.h>
-#include <mb862xx.h>
-#include <video_fb.h>
-
#define CFG_LIME_SRST ((CFG_LIME_BASE) + 0x01FC002C)
#define CFG_LIME_CCF ((CFG_LIME_BASE) + 0x01FC0038)
#define CFG_LIME_MMR ((CFG_LIME_BASE) + 0x01FCFFFC)
@@ -285,8 +282,6 @@ ft_board_setup(void *blob, bd_t *bd)
#define DEFAULT_BRIGHTNESS 25
#define BACKLIGHT_ENABLE (1 << 31)
-extern GraphicDevice mb862xx;
-
static const gdc_regs init_regs [] =
{
{0x0100, 0x00010f00},
@@ -313,11 +308,44 @@ const gdc_regs *board_get_regs (void)
return init_regs;
}
+#define CFG_LIME_CID ((CFG_LIME_BASE) + 0x01FC00F0)
+#define CFG_LIME_REV ((CFG_LIME_BASE) + 0x01FF8084)
+int lime_probe(void)
+{
+ volatile ccsr_lbc_t *memctl = (void *)(CFG_MPC85xx_LBC_ADDR);
+ uint cfg_br2;
+ uint cfg_or2;
+ uint reg;
+
+ cfg_br2 = memctl->br2;
+ cfg_or2 = memctl->or2;
+
+ /* Configure GPCM for CS2 */
+ memctl->br2 = 0;
+ memctl->or2 = 0xfc000410;
+ memctl->br2 = (CFG_LIME_BASE) | 0x00001901;
+
+ /* Try to access GDC ID/Revision registers */
+ reg = in_be32((void *)CFG_LIME_CID);
+ reg = in_be32((void *)CFG_LIME_CID);
+ if (reg == 0x303) {
+ reg = in_be32((void *)CFG_LIME_REV);
+ reg = in_be32((void *)CFG_LIME_REV);
+ reg = ((reg & ~0xff) == 0x20050100) ? 1 : 0;
+ } else
+ reg = 0;
+
+ /* Restore previous CS2 configuration */
+ memctl->br2 = 0;
+ memctl->or2 = cfg_or2;
+ memctl->br2 = cfg_br2;
+ return reg;
+}
+
/* Returns Lime base address */
unsigned int board_video_init (void)
{
-
- if (!getenv("lime"))
+ if (!lime_probe())
return 0;
/*