summaryrefslogtreecommitdiff
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/Makefile1
-rw-r--r--arch/powerpc/lib/ide.c184
-rw-r--r--arch/powerpc/lib/ide.h15
-rw-r--r--arch/powerpc/lib/immap.c106
-rw-r--r--arch/powerpc/lib/time.c4
5 files changed, 18 insertions, 292 deletions
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index e09bd9a88a..5e55385e01 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -36,7 +36,6 @@ obj-y += extable.o
obj-$(CONFIG_CMD_IMMAP) += immap.o
obj-y += interrupts.o
obj-$(CONFIG_CMD_KGDB) += kgdb.o
-obj-$(CONFIG_IDE) += ide.o
obj-y += stack.o
obj-y += time.o
diff --git a/arch/powerpc/lib/ide.c b/arch/powerpc/lib/ide.c
deleted file mode 100644
index b4ead726a6..0000000000
--- a/arch/powerpc/lib/ide.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * (C) Copyright 2000-2011
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-/* Code taken from cmd_ide.c */
-#include <common.h>
-#include <ata.h>
-#include "ide.h"
-
-#ifdef CONFIG_IDE_8xx_DIRECT
-#include <mpc8xx.h>
-#include <pcmcia.h>
-DECLARE_GLOBAL_DATA_PTR;
-
-/* Timings for IDE Interface
- *
- * SETUP / LENGTH / HOLD - cycles valid for 50 MHz clk
- * 70 165 30 PIO-Mode 0, [ns]
- * 4 9 2 [Cycles]
- * 50 125 20 PIO-Mode 1, [ns]
- * 3 7 2 [Cycles]
- * 30 100 15 PIO-Mode 2, [ns]
- * 2 6 1 [Cycles]
- * 30 80 10 PIO-Mode 3, [ns]
- * 2 5 1 [Cycles]
- * 25 70 10 PIO-Mode 4, [ns]
- * 2 4 1 [Cycles]
- */
-
-static const pio_config_t pio_config_ns[IDE_MAX_PIO_MODE+1] = {
- /* Setup Length Hold */
- { 70, 165, 30 }, /* PIO-Mode 0, [ns] */
- { 50, 125, 20 }, /* PIO-Mode 1, [ns] */
- { 30, 101, 15 }, /* PIO-Mode 2, [ns] */
- { 30, 80, 10 }, /* PIO-Mode 3, [ns] */
- { 25, 70, 10 }, /* PIO-Mode 4, [ns] */
-};
-
-static pio_config_t pio_config_clk[IDE_MAX_PIO_MODE+1];
-
-#ifndef CONFIG_SYS_PIO_MODE
-#define CONFIG_SYS_PIO_MODE 0 /* use a relaxed default */
-#endif
-static int pio_mode = CONFIG_SYS_PIO_MODE;
-
-/* Make clock cycles and always round up */
-
-#define PCMCIA_MK_CLKS(t, T) (((t) * (T) + 999U) / 1000U)
-
-static void set_pcmcia_timing(int pmode)
-{
- volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
- volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia);
- ulong timings;
-
- debug("Set timing for PIO Mode %d\n", pmode);
-
- timings = PCMCIA_SHT(pio_config_clk[pmode].t_hold)
- | PCMCIA_SST(pio_config_clk[pmode].t_setup)
- | PCMCIA_SL(pio_config_clk[pmode].t_length);
-
- /*
- * IDE 0
- */
- pcmp->pcmc_pbr0 = CONFIG_SYS_PCMCIA_PBR0;
-#if (CONFIG_SYS_PCMCIA_POR0 != 0)
- pcmp->pcmc_por0 = CONFIG_SYS_PCMCIA_POR0 | timings;
-#else
- pcmp->pcmc_por0 = CONFIG_SYS_PCMCIA_POR0;
-#endif
- debug("PBR0: %08x POR0: %08x\n", pcmp->pcmc_pbr0, pcmp->pcmc_por0);
-
- pcmp->pcmc_pbr1 = CONFIG_SYS_PCMCIA_PBR1;
-#if (CONFIG_SYS_PCMCIA_POR1 != 0)
- pcmp->pcmc_por1 = CONFIG_SYS_PCMCIA_POR1 | timings;
-#else
- pcmp->pcmc_por1 = CONFIG_SYS_PCMCIA_POR1;
-#endif
- debug("PBR1: %08x POR1: %08x\n", pcmp->pcmc_pbr1, pcmp->pcmc_por1);
-
- pcmp->pcmc_pbr2 = CONFIG_SYS_PCMCIA_PBR2;
-#if (CONFIG_SYS_PCMCIA_POR2 != 0)
- pcmp->pcmc_por2 = CONFIG_SYS_PCMCIA_POR2 | timings;
-#else
- pcmp->pcmc_por2 = CONFIG_SYS_PCMCIA_POR2;
-#endif
- debug("PBR2: %08x POR2: %08x\n", pcmp->pcmc_pbr2, pcmp->pcmc_por2);
-
- pcmp->pcmc_pbr3 = CONFIG_SYS_PCMCIA_PBR3;
-#if (CONFIG_SYS_PCMCIA_POR3 != 0)
- pcmp->pcmc_por3 = CONFIG_SYS_PCMCIA_POR3 | timings;
-#else
- pcmp->pcmc_por3 = CONFIG_SYS_PCMCIA_POR3;
-#endif
- debug("PBR3: %08x POR3: %08x\n", pcmp->pcmc_pbr3, pcmp->pcmc_por3);
-
- /*
- * IDE 1
- */
- pcmp->pcmc_pbr4 = CONFIG_SYS_PCMCIA_PBR4;
-#if (CONFIG_SYS_PCMCIA_POR4 != 0)
- pcmp->pcmc_por4 = CONFIG_SYS_PCMCIA_POR4 | timings;
-#else
- pcmp->pcmc_por4 = CONFIG_SYS_PCMCIA_POR4;
-#endif
- debug("PBR4: %08x POR4: %08x\n", pcmp->pcmc_pbr4, pcmp->pcmc_por4);
-
- pcmp->pcmc_pbr5 = CONFIG_SYS_PCMCIA_PBR5;
-#if (CONFIG_SYS_PCMCIA_POR5 != 0)
- pcmp->pcmc_por5 = CONFIG_SYS_PCMCIA_POR5 | timings;
-#else
- pcmp->pcmc_por5 = CONFIG_SYS_PCMCIA_POR5;
-#endif
- debug("PBR5: %08x POR5: %08x\n", pcmp->pcmc_pbr5, pcmp->pcmc_por5);
-
- pcmp->pcmc_pbr6 = CONFIG_SYS_PCMCIA_PBR6;
-#if (CONFIG_SYS_PCMCIA_POR6 != 0)
- pcmp->pcmc_por6 = CONFIG_SYS_PCMCIA_POR6 | timings;
-#else
- pcmp->pcmc_por6 = CONFIG_SYS_PCMCIA_POR6;
-#endif
- debug("PBR6: %08x POR6: %08x\n", pcmp->pcmc_pbr6, pcmp->pcmc_por6);
-
- pcmp->pcmc_pbr7 = CONFIG_SYS_PCMCIA_PBR7;
-#if (CONFIG_SYS_PCMCIA_POR7 != 0)
- pcmp->pcmc_por7 = CONFIG_SYS_PCMCIA_POR7 | timings;
-#else
- pcmp->pcmc_por7 = CONFIG_SYS_PCMCIA_POR7;
-#endif
- debug("PBR7: %08x POR7: %08x\n", pcmp->pcmc_pbr7, pcmp->pcmc_por7);
-
-}
-
-int ide_preinit(void)
-{
- int i;
- /* Initialize PIO timing tables */
- for (i = 0; i <= IDE_MAX_PIO_MODE; ++i) {
- pio_config_clk[i].t_setup =
- PCMCIA_MK_CLKS(pio_config_ns[i].t_setup, gd->bus_clk);
- pio_config_clk[i].t_length =
- PCMCIA_MK_CLKS(pio_config_ns[i].t_length, gd->bus_clk);
- pio_config_clk[i].t_hold =
- PCMCIA_MK_CLKS(pio_config_ns[i].t_hold, gd->bus_clk);
- debug("PIO Mode %d: setup=%2d ns/%d clk" " len=%3d ns/%d clk"
- " hold=%2d ns/%d clk\n", i, pio_config_ns[i].t_setup,
- pio_config_clk[i].t_setup, pio_config_ns[i].t_length,
- pio_config_clk[i].t_length, pio_config_ns[i].t_hold,
- pio_config_clk[i].t_hold);
- }
-
- return 0;
-}
-
-int ide_init_postreset(void)
-{
- volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
- volatile pcmconf8xx_t *pcmp = &(immr->im_pcmcia);
-
- /* PCMCIA / IDE initialization for common mem space */
- pcmp->pcmc_pgcrb = 0;
-
- /* start in PIO mode 0 - most relaxed timings */
- pio_mode = 0;
- set_pcmcia_timing(pio_mode);
- return 0;
-}
-#endif /* CONFIG_IDE_8xx_DIRECT */
-
-#ifdef CONFIG_IDE_8xx_PCCARD
-int ide_preinit(void)
-{
- ide_devices_found = 0;
- /* initialize the PCMCIA IDE adapter card */
- pcmcia_on();
- if (!ide_devices_found)
- return 1;
- udelay(1000000);/* 1 s */
- return 0;
-}
-#endif
diff --git a/arch/powerpc/lib/ide.h b/arch/powerpc/lib/ide.h
deleted file mode 100644
index e0b2e6197b..0000000000
--- a/arch/powerpc/lib/ide.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * (C) Copyright 2012
- * Pavel Herrmann <morpheus.ibis@gmail.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef _MPC8XX_IDE_H_
-#define _MPC8XX_IDE_H_ 1
-
-#ifdef CONFIG_IDE_8xx_PCCARD
-int pcmcia_on(void);
-extern int ide_devices_found;
-#endif
-#endif
diff --git a/arch/powerpc/lib/immap.c b/arch/powerpc/lib/immap.c
index 1414f9ad55..85527a1b8f 100644
--- a/arch/powerpc/lib/immap.c
+++ b/arch/powerpc/lib/immap.c
@@ -12,17 +12,11 @@
#include <common.h>
#include <command.h>
-#if defined(CONFIG_8xx) || defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
-#if defined(CONFIG_8xx)
-#include <asm/8xx_immap.h>
-#include <commproc.h>
-#include <asm/iopin_8xx.h>
-#elif defined(CONFIG_MPC8260)
#include <asm/immap_8260.h>
#include <asm/cpm_8260.h>
#include <asm/iopin_8260.h>
-#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -38,19 +32,12 @@ do_siuinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#if defined(CONFIG_8xx)
- volatile sysconf8xx_t *sc = &immap->im_siu_conf;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
volatile sysconf8260_t *sc = &immap->im_siu_conf;
#endif
printf ("SIUMCR= %08x SYPCR = %08x\n", sc->sc_siumcr, sc->sc_sypcr);
-#if defined(CONFIG_8xx)
- printf ("SWT = %08x\n", sc->sc_swt);
- printf ("SIPEND= %08x SIMASK= %08x\n", sc->sc_sipend, sc->sc_simask);
- printf ("SIEL = %08x SIVEC = %08x\n", sc->sc_siel, sc->sc_sivec);
- printf ("TESR = %08x SDCR = %08x\n", sc->sc_tesr, sc->sc_sdcr);
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
printf ("BCR = %08x\n", sc->sc_bcr);
printf ("P_ACR = %02x P_ALRH= %08x P_ALRL= %08x\n",
sc->sc_ppc_acr, sc->sc_ppc_alrh, sc->sc_ppc_alrl);
@@ -69,10 +56,7 @@ do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#if defined(CONFIG_8xx)
- volatile memctl8xx_t *memctl = &immap->im_memctl;
- int nbanks = 8;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
volatile memctl8260_t *memctl = &immap->im_memctl;
int nbanks = 12;
#endif
@@ -90,16 +74,12 @@ do_memcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
printf ("MAR = %08x", memctl->memc_mar);
-#if defined(CONFIG_8xx)
- printf (" MCR = %08x\n", memctl->memc_mcr);
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
putc ('\n');
#endif
printf ("MAMR = %08x MBMR = %08x",
memctl->memc_mamr, memctl->memc_mbmr);
-#if defined(CONFIG_8xx)
- printf ("\nMSTAT = %04x\n", memctl->memc_mstat);
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
printf (" MCMR = %08x\n", memctl->memc_mcmr);
#endif
printf ("MPTPR = %04x MDR = %08x\n",
@@ -137,17 +117,11 @@ do_carinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#if defined(CONFIG_8xx)
- volatile car8xx_t *car = &immap->im_clkrst;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
volatile car8260_t *car = &immap->im_clkrst;
#endif
-#if defined(CONFIG_8xx)
- printf ("SCCR = %08x\n", car->car_sccr);
- printf ("PLPRCR= %08x\n", car->car_plprcr);
- printf ("RSR = %08x\n", car->car_rsr);
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
printf ("SCCR = %08x\n", car->car_sccr);
printf ("SCMR = %08x\n", car->car_scmr);
printf ("RSR = %08x\n", car->car_rsr);
@@ -200,14 +174,7 @@ static void binary (char *label, uint value, int nbits)
putc ('\n');
}
-#if defined(CONFIG_8xx)
-#define PA_NBITS 16
-#define PA_NB_ODR 8
-#define PB_NBITS 18
-#define PB_NB_ODR 16
-#define PC_NBITS 12
-#define PD_NBITS 13
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
#define PA_NBITS 32
#define PA_NB_ODR 32
#define PB_NBITS 28
@@ -221,10 +188,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#if defined(CONFIG_8xx)
- volatile iop8xx_t *iop = &immap->im_ioport;
- volatile ushort *l, *r;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
volatile iop8260_t *iop = &immap->im_ioport;
volatile uint *l, *r;
#endif
@@ -237,10 +201,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* Ports A & B
*/
-#if defined(CONFIG_8xx)
- l = &iop->iop_padir;
- R = &immap->im_cpm.cp_pbdir;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
l = &iop->iop_pdira;
R = &iop->iop_pdirb;
#endif
@@ -263,10 +224,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* Ports C & D
*/
-#if defined(CONFIG_8xx)
- l = &iop->iop_pcdir;
- r = &iop->iop_pddir;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
l = &iop->iop_pdirc;
r = &iop->iop_pdird;
#endif
@@ -274,11 +232,7 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
binary ("PD_DIR", *r++, PD_NBITS);
binary ("PC_PAR", *l++, PC_NBITS);
binary ("PD_PAR", *r++, PD_NBITS);
-#if defined(CONFIG_8xx)
- binary ("PC_SO ", *l++, PC_NBITS);
- binary (" ", 0, 0);
- r++;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
binary ("PC_SOR", *l++, PC_NBITS);
binary ("PD_SOR", *r++, PD_NBITS);
binary ("PC_ODR", *l++, PC_NBITS);
@@ -286,9 +240,6 @@ do_iopinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
binary ("PC_DAT", *l++, PC_NBITS);
binary ("PD_DAT", *r++, PD_NBITS);
-#if defined(CONFIG_8xx)
- binary ("PC_INT", *l++, PC_NBITS);
-#endif
header ();
return 0;
@@ -313,9 +264,6 @@ do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
SOR,
ODR,
DAT,
-#if defined(CONFIG_8xx)
- INT
-#endif
} cmd = DAT;
if (argc != 5) {
@@ -350,11 +298,6 @@ do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
case 's':
cmd = SOR;
break;
-#if defined(CONFIG_8xx)
- case 'i':
- cmd = INT;
- break;
-#endif
default:
printf ("iopset: unknown command %s\n", argv[3]);
rcode = 1;
@@ -400,14 +343,6 @@ do_iopset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
else
iopin_set_low (&iopin);
break;
-#if defined(CONFIG_8xx)
- case INT:
- if (value)
- iopin_set_falledge (&iopin);
- else
- iopin_set_anyedge (&iopin);
- break;
-#endif
}
}
@@ -434,9 +369,7 @@ static void prbrg (int n, uint val)
uint cd = (val & CPM_BRG_CD_MASK) >> 1;
uint div16 = (val & CPM_BRG_DIV16) != 0;
-#if defined(CONFIG_8xx)
- ulong clock = gd->cpu_clk;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
ulong clock = gd->arch.brg_clk;
#endif
@@ -486,10 +419,7 @@ do_brginfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#if defined(CONFIG_8xx)
- volatile cpm8xx_t *cp = &immap->im_cpm;
- volatile uint *p = &cp->cp_brgc1;
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
volatile uint *p = &immap->im_brgc1;
#endif
int i = 1;
@@ -510,11 +440,7 @@ do_i2cinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-#if defined(CONFIG_8xx)
- volatile i2c8xx_t *i2c = &immap->im_i2c;
- volatile cpm8xx_t *cp = &immap->im_cpm;
- volatile iic_t *iip = (iic_t *) & cp->cp_dparam[PROFF_IIC];
-#elif defined(CONFIG_MPC8260)
+#if defined(CONFIG_MPC8260)
volatile i2c8260_t *i2c = &immap->im_i2c;
volatile iic_t *iip;
uint dpaddr;
diff --git a/arch/powerpc/lib/time.c b/arch/powerpc/lib/time.c
index de5f0be66d..c1a0a69a51 100644
--- a/arch/powerpc/lib/time.c
+++ b/arch/powerpc/lib/time.c
@@ -64,7 +64,7 @@ int timer_init(void)
{
unsigned long temp;
-#if defined(CONFIG_5xx) || defined(CONFIG_8xx)
+#if defined(CONFIG_5xx)
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
/* unlock */
@@ -75,7 +75,7 @@ int timer_init(void)
asm volatile("li %0,0 ; mttbu %0 ; mttbl %0;"
: "=&r"(temp) );
-#if defined(CONFIG_5xx) || defined(CONFIG_8xx)
+#if defined(CONFIG_5xx)
/* enable */
immap->im_sit.sit_tbscr |= TBSCR_TBE;
#endif