summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Tyser <ptyser@xes-inc.com>2009-08-07 13:16:34 -0500
committerKumar Gala <galak@kernel.crashing.org>2009-08-28 17:12:39 -0500
commit1bb61b69f7aba4931ede35fdcabd8e5ecad121d7 (patch)
treebf8ce9d036e7f68ce571ef735a874fa17f5c4fb6
parentec79d33b2c41ee8b6d1354cc0910217b769c5036 (diff)
downloadu-boot-imx-1bb61b69f7aba4931ede35fdcabd8e5ecad121d7.zip
u-boot-imx-1bb61b69f7aba4931ede35fdcabd8e5ecad121d7.tar.gz
u-boot-imx-1bb61b69f7aba4931ede35fdcabd8e5ecad121d7.tar.bz2
xes: Use proper IO access functions
Also fix some minor whitespace oddities while we're cleaning up Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r--board/xes/common/fsl_8xxx_clk.c6
-rw-r--r--board/xes/common/fsl_8xxx_pci.c44
-rw-r--r--board/xes/xpedite5200/xpedite5200.c17
-rw-r--r--board/xes/xpedite5370/xpedite5370.c8
4 files changed, 37 insertions, 38 deletions
diff --git a/board/xes/common/fsl_8xxx_clk.c b/board/xes/common/fsl_8xxx_clk.c
index 0155670..f4a17b7 100644
--- a/board/xes/common/fsl_8xxx_clk.c
+++ b/board/xes/common/fsl_8xxx_clk.c
@@ -21,6 +21,7 @@
*/
#include <common.h>
+#include <asm/io.h>
/*
* Return SYSCLK input frequency - 50 MHz or 66 MHz depending on POR config
@@ -33,9 +34,8 @@ unsigned long get_board_sys_clk(ulong dummy)
immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
volatile ccsr_gur_t *gur = &immap->im_gur;
#endif
- u32 gpporcr = gur->gpporcr;
- if (gpporcr & 0x10000)
+ if (in_be32(&gur->gpporcr) & 0x10000)
return 66666666;
else
return 50000000;
@@ -49,7 +49,7 @@ unsigned long get_board_sys_clk(ulong dummy)
unsigned long get_board_ddr_clk(ulong dummy)
{
volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
- u32 ddr_ratio = ((gur->porpllsr) & 0x00003e00) >> 9;
+ u32 ddr_ratio = (in_be32(&gur->porpllsr) & 0x00003e00) >> 9;
if (ddr_ratio == 0x7)
return get_board_sys_clk(dummy);
diff --git a/board/xes/common/fsl_8xxx_pci.c b/board/xes/common/fsl_8xxx_pci.c
index 463588f..a615820 100644
--- a/board/xes/common/fsl_8xxx_pci.c
+++ b/board/xes/common/fsl_8xxx_pci.c
@@ -24,6 +24,7 @@
#include <common.h>
#include <pci.h>
#include <asm/fsl_pci.h>
+#include <asm/io.h>
#include <libfdt.h>
#include <fdt_support.h>
@@ -182,18 +183,18 @@ void pci_init_board(void)
immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
volatile ccsr_gur_t *gur = &immap->im_gur;
#endif
- uint devdisr = gur->devdisr;
- uint io_sel = (gur->pordevsr & MPC8xxx_PORDEVSR_IO_SEL) >>
+ uint devdisr = in_be32(&gur->devdisr);
+ uint io_sel = (in_be32(&gur->pordevsr) & MPC8xxx_PORDEVSR_IO_SEL) >>
MPC8xxx_PORDEVSR_IO_SEL_SHIFT;
- uint host_agent = (gur->porbmsr & MPC8xxx_PORBMSR_HA) >>
+ uint host_agent = (in_be32(&gur->porbmsr) & MPC8xxx_PORBMSR_HA) >>
MPC8xxx_PORBMSR_HA_SHIFT;
struct pci_region *r;
#ifdef CONFIG_PCI1
- uint pci_spd_norm = (gur->pordevsr & MPC85xx_PORDEVSR_PCI1_SPD);
- uint pci_32 = gur->pordevsr & MPC85xx_PORDEVSR_PCI1_PCI32;
- uint pci_arb = gur->pordevsr & MPC85xx_PORDEVSR_PCI1_ARB;
- uint pcix = gur->pordevsr & MPC85xx_PORDEVSR_PCI1;
+ uint pci_spd_norm = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1_SPD;
+ uint pci_32 = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1_PCI32;
+ uint pci_arb = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1_ARB;
+ uint pcix = in_be32(&gur->pordevsr) & MPC85xx_PORDEVSR_PCI1;
uint freq = CONFIG_SYS_CLK_FREQ / 1000 / 1000;
width = 0; /* Silence compiler warning... */
@@ -203,12 +204,11 @@ void pci_init_board(void)
host = host_agent_cfg[host_agent].pci_host[0];
r = hose->regions;
-
if (!(devdisr & MPC85xx_DEVDISR_PCI1)) {
printf("\n PCI1: %d bit %s, %s %d MHz, %s, %s\n",
pci_32 ? 32 : 64,
pcix ? "PCIX" : "PCI",
- pci_spd_norm ? ">=" : "<=",
+ pci_spd_norm ? ">=" : "<=",
pcix ? freq * 2 : freq,
host ? "host" : "agent",
pci_arb ? "arbiter" : "external-arbiter");
@@ -245,7 +245,7 @@ void pci_init_board(void)
}
#elif defined CONFIG_MPC8548
/* PCI1 not present on MPC8572 */
- gur->devdisr |= MPC85xx_DEVDISR_PCI1; /* disable */
+ setbits_be32(&gur->devdisr, MPC85xx_DEVDISR_PCI1);
#endif
#ifdef CONFIG_PCIE1
pci = (ccsr_fsl_pci_t *) CONFIG_SYS_PCIE1_ADDR;
@@ -257,10 +257,10 @@ void pci_init_board(void)
if (width && !(devdisr & MPC8xxx_DEVDISR_PCIE1)) {
printf("\n PCIE1 connected as %s (x%d)",
host ? "Root Complex" : "End Point", width);
- if (pci->pme_msg_det) {
- pci->pme_msg_det = 0xffffffff;
+ if (in_be32(&pci->pme_msg_det)) {
+ out_be32(&pci->pme_msg_det, 0xffffffff);
debug(" with errors. Clearing. Now 0x%08x",
- pci->pme_msg_det);
+ in_be32(&pci->pme_msg_det));
}
printf("\n");
@@ -293,7 +293,7 @@ void pci_init_board(void)
hose->first_busno, hose->last_busno);
}
#else
- gur->devdisr |= MPC8xxx_DEVDISR_PCIE1; /* disable */
+ setbits_be32(&gur->devdisr, MPC8xxx_DEVDISR_PCIE1);
#endif /* CONFIG_PCIE1 */
#ifdef CONFIG_PCIE2
@@ -306,10 +306,10 @@ void pci_init_board(void)
if (width && !(devdisr & MPC8xxx_DEVDISR_PCIE2)) {
printf("\n PCIE2 connected as %s (x%d)",
host ? "Root Complex" : "End Point", width);
- if (pci->pme_msg_det) {
- pci->pme_msg_det = 0xffffffff;
+ if (in_be32(&pci->pme_msg_det)) {
+ out_be32(&pci->pme_msg_det, 0xffffffff);
debug(" with errors. Clearing. Now 0x%08x",
- pci->pme_msg_det);
+ in_be32(&pci->pme_msg_det));
}
printf("\n");
@@ -342,7 +342,7 @@ void pci_init_board(void)
hose->first_busno, hose->last_busno);
}
#else
- gur->devdisr |= MPC8xxx_DEVDISR_PCIE2; /* disable */
+ setbits_be32(&gur->devdisr, MPC8xxx_DEVDISR_PCIE2);
#endif /* CONFIG_PCIE2 */
#ifdef CONFIG_PCIE3
@@ -355,10 +355,10 @@ void pci_init_board(void)
if (width && !(devdisr & MPC8xxx_DEVDISR_PCIE3)) {
printf("\n PCIE3 connected as %s (x%d)",
host ? "Root Complex" : "End Point", width);
- if (pci->pme_msg_det) {
- pci->pme_msg_det = 0xffffffff;
+ if (in_be32(&pci->pme_msg_det)) {
+ out_be32(&pci->pme_msg_det, 0xffffffff);
debug(" with errors. Clearing. Now 0x%08x",
- pci->pme_msg_det);
+ in_be32(&pci->pme_msg_det));
}
printf("\n");
@@ -391,7 +391,7 @@ void pci_init_board(void)
hose->first_busno, hose->last_busno);
}
#else
- gur->devdisr |= MPC8xxx_DEVDISR_PCIE3; /* disable */
+ setbits_be32(&gur->devdisr, MPC8xxx_DEVDISR_PCIE3);
#endif /* CONFIG_PCIE3 */
}
diff --git a/board/xes/xpedite5200/xpedite5200.c b/board/xes/xpedite5200/xpedite5200.c
index 77afdbc..7109771 100644
--- a/board/xes/xpedite5200/xpedite5200.c
+++ b/board/xes/xpedite5200/xpedite5200.c
@@ -40,7 +40,6 @@ int checkboard(void)
{
volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
volatile ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
-
char *s;
printf("Board: X-ES %s PMC\n", CONFIG_SYS_BOARD_NAME);
@@ -56,10 +55,10 @@ int checkboard(void)
printf("Cfg %s", s);
printf("\n");
- lbc->ltesr = 0xffffffff; /* Clear LBC error interrupts */
- lbc->lteir = 0xffffffff; /* Enable LBC error interrupts */
- ecm->eedr = 0xffffffff; /* Clear ecm errors */
- ecm->eeer = 0xffffffff; /* Enable ecm errors */
+ out_be32(&lbc->ltesr, 0xffffffff); /* Clear LBC error IRQs */
+ out_be32(&lbc->lteir, 0xffffffff); /* Enable LBC error IRQs */
+ out_be32(&ecm->eedr, 0xffffffff); /* Clear ecm errors */
+ out_be32(&ecm->eeer, 0xffffffff); /* Enable ecm errors */
return 0;
}
@@ -79,11 +78,11 @@ static void flash_cs_fixup(void)
printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);
if (flash_sel) {
- lbc->br0 = CONFIG_SYS_BR1_PRELIM;
- lbc->or0 = CONFIG_SYS_OR1_PRELIM;
+ out_be32(&lbc->br0, CONFIG_SYS_BR1_PRELIM);
+ out_be32(&lbc->or0, CONFIG_SYS_OR1_PRELIM);
- lbc->br1 = CONFIG_SYS_BR0_PRELIM;
- lbc->or1 = CONFIG_SYS_OR0_PRELIM;
+ out_be32(&lbc->br1, CONFIG_SYS_BR0_PRELIM);
+ out_be32(&lbc->or1, CONFIG_SYS_OR0_PRELIM);
}
}
diff --git a/board/xes/xpedite5370/xpedite5370.c b/board/xes/xpedite5370/xpedite5370.c
index d54c699..48d9fc8 100644
--- a/board/xes/xpedite5370/xpedite5370.c
+++ b/board/xes/xpedite5370/xpedite5370.c
@@ -71,11 +71,11 @@ static void flash_cs_fixup(void)
printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1);
if (flash_sel) {
- lbc->br0 = CONFIG_SYS_BR1_PRELIM;
- lbc->or0 = CONFIG_SYS_OR1_PRELIM;
+ out_be32(&lbc->br0, CONFIG_SYS_BR1_PRELIM);
+ out_be32(&lbc->or0, CONFIG_SYS_OR1_PRELIM);
- lbc->br1 = CONFIG_SYS_BR0_PRELIM;
- lbc->or1 = CONFIG_SYS_OR0_PRELIM;
+ out_be32(&lbc->br1, CONFIG_SYS_BR0_PRELIM);
+ out_be32(&lbc->or1, CONFIG_SYS_OR0_PRELIM);
}
}