All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Hellstrom <daniel@gaisler.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 5/8] SPARC: Added AMBA PnP Information listing command for LEON3
Date: Thu, 13 Mar 2008 10:39:25 +0100	[thread overview]
Message-ID: <47D8F64D.6030903@gaisler.com> (raw)

This patch adds an U-Boot command, ambapp, which prints a summary
of AMBA Bus Plug & Play information.

AMBA is a bus specified by ARM. AMBA with Plug and Play information
is a Gaisler extension to that bus. See www.gaisler.com.

######################
U-Boot 1.3.2-g6bc2ec61-dirty (Mar 12 2008 - 21:24:14)Gaisler GRSIM

CPU: LEON3
Board: GRSIM/TSIM
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   PHY info not available
GRETH 10/100

Type "run flash_nfs" to mount root filesystem over NFS

Hit any key to stop autoboot:  0
=> ambapp
--------- AHB Masters ---------
0x00:0x01:0x03: VENDOR_GAISLER  GAISLER_LEON3
   irq: 0  (ver: 0)
--------- AHB Slaves  ---------
0x00:0x04:0x0f: VENDOR_ESA  ESA_MCTRL
   mem: 0x00000000 - 0x10000000
   mem: 0x20000000 - 0x30000000
   mem: 0x40000000 - 0x70000000
   irq: 1  (ver: 0)
0x01:0x01:0x06: VENDOR_GAISLER  GAISLER_APBMST
   mem: 0xc0000000 - 0xc0100000
   irq: 3  (ver: 0)
--------- APB Slaves  ---------
0x00:0x04:0x0f: VENDOR_ESA  ESA_MCTRL
   apb: 0xc0000000 - 0xc0000100
   irq: 1  (ver: 0 )
0x01:0x01:0x0c: VENDOR_GAISLER  GAISLER_APBUART
   apb: 0xc0000100 - 0xc0000200
   irq: 3  (ver: 0 )
0x02:0x01:0x0d: VENDOR_GAISLER  GAISLER_IRQMP
   apb: 0xc0000200 - 0xc0000300
   irq: 7  (ver: 0 )
0x03:0x01:0x11: VENDOR_GAISLER  GAISLER_GPTIMER
   apb: 0xc0000300 - 0xc0000400
   irq: 8  (ver: 0 )
0x04:0x01:0x1d: VENDOR_GAISLER  GAISLER_ETHMAC
   apb: 0xc0000800 - 0xc0001000
   irq: 12 (ver: 0 )

=>
######################

Best Regards,
Daniel Hellstrom


commit 8e2783598c9270a17140930c99b3eb76f892de51
Author: Daniel Hellstrom <daniel@gaisler.com>
Date:   Wed Mar 12 21:26:31 2008 +0100

    SPARC/LEON3: Added AMBA Bus Plug&Play information print
    command (ambapp). It can print available cores (type:
    AHB Master, AHB Slave, APB Slave), their address ranges,
    IRQ number and version.

    
    Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>

 common/Makefile          |    1 +
 common/cmd_ambapp.c      |  292 ++++++++++++++++++++++++++++++
 include/ambapp.h         |  443 
++++++++++++++++++++++++++++++++++++++++++++++
 include/config_cmd_all.h |    1 +
 4 files changed, 737 insertions(+), 0 deletions(-)


diff --git a/common/Makefile b/common/Makefile
index a88d1ef..3d369ff 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -91,6 +91,7 @@ COBJS-$(CONFIG_CMD_STRINGS) += cmd_strings.o
 COBJS-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o
 COBJS-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o
 COBJS-$(CONFIG_CMD_USB) += cmd_usb.o
+COBJS-y += cmd_ambapp.o
 COBJS-y += cmd_vfd.o
 COBJS-y += command.o
 COBJS-y += console.o
diff --git a/common/cmd_ambapp.c b/common/cmd_ambapp.c
new file mode 100644
index 0000000..5329a3a
--- /dev/null
+++ b/common/cmd_ambapp.c
@@ -0,0 +1,292 @@
+/*
+ * (C) Copyright 2007
+ * Daniel Hellstrom, Gaisler Research, daniel at gaisler.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * AMBA Plug&Play information list command
+ */
+#include <common.h>
+#include <command.h>
+
+#if defined(CONFIG_CMD_AMBAPP)
+
+#ifndef CONFIG_LEON3
+#error Only LEON3 processors support the AMBA Plug&Play bus
+#endif
+
+#include <ambapp.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* We put these variables into .data section so that they are
+ * zero when entering the AMBA Plug & Play Section the first time.
+ * BSS is not garantueed to be zero since BSS hasn't been cleared
+ * the first times entering the AMBA functions.
+ */
+int ambapp_apb_print __attribute__ ((section (".data"))) = 0;
+int ambapp_ahb_print __attribute__ ((section (".data"))) = 0;
+
+typedef struct {
+    int device_id;
+    char *name;
+} ambapp_device_name;
+
+static ambapp_device_name gaisler_devices[] =
+{
+    {GAISLER_LEON3, "GAISLER_LEON3"},
+    {GAISLER_LEON3DSU, "GAISLER_LEON3DSU"},
+    {GAISLER_ETHAHB, "GAISLER_ETHAHB"},
+    {GAISLER_ETHMAC, "GAISLER_ETHMAC"},
+    {GAISLER_APBMST, "GAISLER_APBMST"},
+    {GAISLER_AHBUART, "GAISLER_AHBUART"},
+    {GAISLER_SRCTRL, "GAISLER_SRCTRL"},
+    {GAISLER_SDCTRL, "GAISLER_SDCTRL"},
+    {GAISLER_APBUART, "GAISLER_APBUART"},
+    {GAISLER_IRQMP, "GAISLER_IRQMP"},
+    {GAISLER_AHBRAM, "GAISLER_AHBRAM"},
+    {GAISLER_GPTIMER, "GAISLER_GPTIMER"},
+    {GAISLER_PCITRG, "GAISLER_PCITRG"},
+    {GAISLER_PCISBRG, "GAISLER_PCISBRG"},
+    {GAISLER_PCIFBRG, "GAISLER_PCIFBRG"},
+    {GAISLER_PCITRACE, "GAISLER_PCITRACE"},
+    {GAISLER_AHBTRACE, "GAISLER_AHBTRACE"},
+    {GAISLER_ETHDSU, "GAISLER_ETHDSU"},
+    {GAISLER_PIOPORT, "GAISLER_PIOPORT"},
+    {GAISLER_AHBJTAG, "GAISLER_AHBJTAG"},
+    {GAISLER_ATACTRL, "GAISLER_ATACTRL"},
+    {GAISLER_VGA, "GAISLER_VGA"},
+    {GAISLER_KBD, "GAISLER_KBD"},
+    {GAISLER_L2TIME, "GAISLER_L2TIME"},
+    {GAISLER_L2C, "GAISLER_L2C"},
+    {GAISLER_PLUGPLAY, "GAISLER_PLUGPLAY"},
+    {GAISLER_SPW, "GAISLER_SPW"},
+    {GAISLER_SPW2, "GAISLER_SPW2"},
+    {GAISLER_EHCI, "GAISLER_EHCI"},
+    {GAISLER_UHCI, "GAISLER_UHCI"},
+    {GAISLER_AHBSTAT, "GAISLER_AHBSTAT"},
+    {GAISLER_DDR2SPA, "GAISLER_DDR2SPA"},
+    {GAISLER_DDRSPA, "GAISLER_DDRSPA"},
+    {0, NULL}
+};
+
+static ambapp_device_name esa_devices[] =
+{
+    {ESA_LEON2, "ESA_LEON2"},
+    {ESA_MCTRL, "ESA_MCTRL"},
+    {0, NULL}
+};
+
+static ambapp_device_name opencores_devices[] =
+{
+    {OPENCORES_PCIBR, "OPENCORES_PCIBR"},
+    {OPENCORES_ETHMAC, "OPENCORES_ETHMAC"},
+    {0, NULL}
+};
+
+typedef struct {
+    unsigned int vendor_id;
+    char *name;
+    ambapp_device_name *devices;
+} ambapp_vendor_devnames;
+
+static ambapp_vendor_devnames vendors[] =
+{
+    {VENDOR_GAISLER, "VENDOR_GAISLER", gaisler_devices},
+    {VENDOR_ESA, "VENDOR_ESA", esa_devices},
+    {VENDOR_OPENCORES, "VENDOR_OPENCORES", opencores_devices},
+    {0, NULL, 0}
+};
+
+static char *ambapp_get_devname(ambapp_device_name *devs, int id)
+{
+    if ( !devs )
+        return NULL;
+
+    while( devs->device_id > 0 ){
+        if ( devs->device_id == id )
+            return devs->name;
+        devs++;
+    }
+    return NULL;
+}
+
+char *ambapp_device_id2str(int vendor, int id)
+{
+    ambapp_vendor_devnames *ven = &vendors[0];
+
+    while( ven->vendor_id > 0 ){
+        if ( ven->vendor_id == vendor ){
+            return ambapp_get_devname(ven->devices,id);
+        }
+        ven++;
+    }
+    return NULL;
+}
+
+char *ambapp_vendor_id2str(int vendor)
+{
+    ambapp_vendor_devnames *ven = &vendors[0];
+
+    while( ven->vendor_id > 0 ){
+        if ( ven->vendor_id == vendor ){
+            return ven->name;
+/*            return ambapp_get_devname(ven->devices,ven->vendor_id);*/
+        }
+        ven++;
+    }
+    return NULL;
+}
+
+static char *unknown = "unknown";
+
+/* Print one APB device */
+void ambapp_print_apb(
+    apbctrl_pp_dev *apb,
+    ambapp_ahbdev *apbmst,
+    int index)
+{
+    char *dev_str, *ven_str;
+    int irq, ver, vendor, deviceid;
+    unsigned int address, apbmst_base, mask;
+
+    vendor = amba_vendor(apb->conf);
+    deviceid = amba_device(apb->conf);
+    irq = amba_irq(apb->conf);
+    ver = amba_ver(apb->conf);
+    apbmst_base = apbmst->address[0] & LEON3_IO_AREA;
+    address = (apbmst_base | (((apb->bar & 0xfff00000)>> 12))) &
+              (((apb->bar & 0x0000fff0) <<4) | 0xfff00000);
+
+    mask = amba_membar_mask(apb->bar) << 8;
+    mask = ((~mask)&0x000fffff)+1;
+
+    ven_str = ambapp_vendor_id2str(vendor);
+    if ( !ven_str ){
+        ven_str = unknown;
+        dev_str = unknown;
+    }else{
+        dev_str = ambapp_device_id2str(vendor,deviceid);
+        if ( !dev_str )
+            dev_str = unknown;
+    }
+
+    printf("0x%02x:0x%02x:0x%02x: %s  %s\n"
+           "   apb: 0x%08x - 0x%08x\n"
+           "   irq: %-2d (ver: %-2d)\n",
+           index,vendor,deviceid,ven_str,dev_str,address,
+           address+mask,irq,ver);
+}
+
+void ambapp_print_ahb(ahbctrl_pp_dev *ahb, int index)
+{
+    char *dev_str, *ven_str;
+    int irq, ver, vendor, deviceid;
+    unsigned int addr, mask;
+    int j;
+
+    vendor = amba_vendor(ahb->conf);
+    deviceid = amba_device(ahb->conf);
+    irq = amba_irq(ahb->conf);
+    ver = amba_ver(ahb->conf);
+
+    ven_str = ambapp_vendor_id2str(vendor);
+    if ( !ven_str ){
+        ven_str = unknown;
+        dev_str = unknown;
+    }else{
+        dev_str = ambapp_device_id2str(vendor,deviceid);
+        if ( !dev_str )
+            dev_str = unknown;
+    }
+
+    printf("0x%02x:0x%02x:0x%02x: %s  %s\n",
+           index,vendor,deviceid,ven_str,dev_str);
+
+    for(j=0; j<4; j++)
+    {
+        addr = amba_membar_start(ahb->bars[j]);
+        if ( amba_membar_type(ahb->bars[j]) == 0 )
+            continue;
+        if (amba_membar_type(ahb->bars[j]) == AMBA_TYPE_AHBIO)
+            addr = AMBA_TYPE_AHBIO_ADDR(addr);
+        mask = amba_membar_mask(ahb->bars[j]) << 20;
+        printf("   mem: 0x%08x - 0x%08x\n",addr,addr+((~mask)+1));
+    }
+
+    printf("   irq: %-2d (ver: %d)\n",irq,ver);
+}
+
+int
+do_ambapp_print (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+
+    /* Print AHB Masters */
+    puts("--------- AHB Masters ---------\n");
+    ambapp_apb_print = 0;
+    ambapp_ahb_print = 1;
+    ambapp_ahbmst_count(99,99); /* Get vendor&device 99 = nonexistent... */
+
+    /* Print AHB Slaves */
+    puts("--------- AHB Slaves  ---------\n");
+    ambapp_ahbslv_count(99,99); /* Get vendor&device 99 = nonexistent... */
+
+    /* Print APB Slaves */
+    puts("--------- APB Slaves  ---------\n");
+    ambapp_apb_print = 1;
+    ambapp_ahb_print = 0;
+    ambapp_apb_count(99,99); /* Get vendor&device 99 = nonexistent... */
+
+    /* Reset, no futher printing */
+    ambapp_apb_print = 0;
+    ambapp_ahb_print = 0;
+    puts("\n");
+    return 0;
+}
+
+int ambapp_init_reloc(void)
+{
+    ambapp_vendor_devnames *vend = vendors;
+    ambapp_device_name *dev;
+
+    while( vend->vendor_id && vend->name ){
+        vend->name = (char *)((unsigned int)vend->name + gd->reloc_off);
+        vend->devices = (ambapp_device_name *)((unsigned 
int)vend->devices + gd->reloc_off);;
+        dev = vend->devices;
+        vend++;
+        if ( !dev )
+            continue;
+        while( dev->device_id && dev->name ){
+            dev->name = (char *)((unsigned int)dev->name + gd->reloc_off);;
+            dev++;
+        }
+    }
+    return 0;
+}
+
+U_BOOT_CMD(
+    ambapp, 1, 1, do_ambapp_print,
+    "ambapp  - list AMBA Plug&Play information\n",
+    "ambapp\n"
+    "    - lists AMBA (AHB & APB) Plug&Play devices present on the 
system\n"
+);
+
+#endif    /* CFG_CMD_AMBAPP */
diff --git a/include/ambapp.h b/include/ambapp.h
new file mode 100644
index 0000000..7bdbc9a
--- /dev/null
+++ b/include/ambapp.h
@@ -0,0 +1,443 @@
+/* Interface for accessing Gaisler AMBA Plug&Play Bus.
+ * The AHB bus can be interfaced with a simpler bus -
+ * the APB bus, also freely available in GRLIB at
+ * www.gaisler.com.
+ *
+ * (C) Copyright 2007
+ * Daniel Hellstrom, Gaisler Research, daniel at gaisler.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __AMBAPP_H__
+#define __AMBAPP_H__
+
+/* Default location of Plug&Play info
+ * normally 0xfffff000 for AHB masters
+ * and 0xfffff800 for AHB slaves.
+ * Normally no need to change this.
+ */
+#define LEON3_IO_AREA 0xfff00000
+#define LEON3_CONF_AREA  0xff000
+#define LEON3_AHB_SLAVE_CONF_AREA (1 << 11)
+
+/* Max devices this software will support */
+#define LEON3_AHB_MASTERS 16
+#define LEON3_AHB_SLAVES 16
+/*#define LEON3_APB_MASTERS 1*/ /* Number of APB buses that has 
Plug&Play */
+#define LEON3_APB_SLAVES 16 /* Total number of APB slaves per APB bus */
+
+/* Vendor codes */
+#define VENDOR_GAISLER       1
+#define VENDOR_PENDER        2
+#define VENDOR_ESA           4
+#define VENDOR_ASTRIUM       6
+#define VENDOR_OPENCHIP      7
+#define VENDOR_OPENCORES     8
+#define VENDOR_CONTRIB       9
+#define VENDOR_EONIC         11
+#define VENDOR_RADIONOR      15
+#define VENDOR_GLEICHMANN    16
+#define VENDOR_MENTA         17
+#define VENDOR_SUN           19
+#define VENDOR_EMBEDDIT      234
+#define VENDOR_CAL           202
+
+/* Gaisler Research device id's */
+#define GAISLER_LEON3    0x003
+#define GAISLER_LEON3DSU 0x004
+#define GAISLER_ETHAHB   0x005
+#define GAISLER_APBMST   0x006
+#define GAISLER_AHBUART  0x007
+#define GAISLER_SRCTRL   0x008
+#define GAISLER_SDCTRL   0x009
+#define GAISLER_APBUART  0x00C
+#define GAISLER_IRQMP    0x00D
+#define GAISLER_AHBRAM   0x00E
+#define GAISLER_GPTIMER  0x011
+#define GAISLER_PCITRG   0x012
+#define GAISLER_PCISBRG  0x013
+#define GAISLER_PCIFBRG  0x014
+#define GAISLER_PCITRACE 0x015
+#define GAISLER_PCIDMA   0x016
+#define GAISLER_AHBTRACE 0x017
+#define GAISLER_ETHDSU   0x018
+#define GAISLER_PIOPORT  0x01A
+#define GAISLER_AHBJTAG  0x01c
+#define GAISLER_SPW      0x01f
+#define GAISLER_ATACTRL  0x024
+#define GAISLER_VGA      0x061
+#define GAISLER_KBD      0X060
+#define GAISLER_ETHMAC   0x01D
+#define GAISLER_DDRSPA   0x025
+#define GAISLER_EHCI     0x026
+#define GAISLER_UHCI     0x027
+#define GAISLER_SPW2     0x029
+#define GAISLER_DDR2SPA  0x02E
+#define GAISLER_AHBSTAT  0x052
+#define GAISLER_FTMCTRL  0x054
+
+#define GAISLER_L2TIME   0xffd    /* internal device: leon2 timer */
+#define GAISLER_L2C      0xffe    /* internal device: leon2compat */
+#define GAISLER_PLUGPLAY 0xfff    /* internal device: plug & play 
configarea */
+
+
+/* European Space Agency device id's */
+#define ESA_LEON2        0x2
+#define ESA_MCTRL        0xF
+
+/* Opencores device id's */
+#define OPENCORES_PCIBR  0x4
+#define OPENCORES_ETHMAC 0x5
+
+/* Vendor codes */
+
+/*
+ *
+ * Macros for manipulating Configuration registers
+ *
+ */
+
+#define amba_vendor(x) (((x) >> 24) & 0xff)
+
+#define amba_device(x) (((x) >> 12) & 0xfff)
+
+#define amba_membar_start(mbar) \
+ (((mbar) & 0xfff00000) & (((mbar) & 0xfff0) << 16))
+
+#define amba_iobar_start(base, iobar) \
+ ((base) | ((((iobar) & 0xfff00000)>>12) & (((iobar) & 0xfff0)<<4)) )
+
+#define amba_irq(conf) ((conf) & 0xf)
+
+#define amba_ver(conf) (((conf)>>5) & 0x1f)
+
+#define amba_membar_type(mbar) ((mbar) & 0xf)
+
+#define amba_membar_mask(mbar) (((mbar)>>4) & 0xfff)
+
+#define AMBA_TYPE_APBIO 0x1
+#define AMBA_TYPE_MEM   0x2
+#define AMBA_TYPE_AHBIO 0x3
+
+#define AMBA_TYPE_AHBIO_ADDR(addr) (LEON3_IO_AREA | ((addr) >> 12))
+
+#ifndef __ASSEMBLER__
+
+#ifdef CONFIG_CMD_AMBAPP
+
+/* AMBA Plug&Play relocation & initialization */
+int ambapp_init_reloc(void);
+
+/* AMBA Plug&Play Name of Vendors and devices */
+
+/* Return name of device */
+char *ambapp_device_id2str(int vendor, int id);
+
+/* Return name of vendor */
+char *ambapp_vendor_id2str(int vendor);
+#endif
+
+/*
+ *  Types and structure used for AMBA Plug & Play bus scanning
+ */
+
+/* AMBA Plug&Play AHB information layout */
+typedef struct {
+    unsigned int conf;
+    unsigned int userdef[3];
+    unsigned int bars[4];
+} ahbctrl_pp_dev;
+
+/* Prototypes for scanning AMBA Plug&Play bus for AMBA
+ *  i)   AHB Masters
+ *  ii)  AHB Slaves
+ *  iii) APB Slaves (APB MST is a AHB Slave)
+ */
+
+typedef struct {
+    unsigned char irq;
+    unsigned char ver;
+    unsigned int  address;
+} ambapp_apbdev;
+
+typedef struct {
+    unsigned char irq;
+    unsigned char ver;
+    unsigned int  userdef[3];
+    unsigned int  address[4];
+} ambapp_ahbdev;
+
+/* AMBA Plug&Play AHB Masters & Slaves information locations
+ * Max devices is 64 supported by HW, however often only 8
+ * are used.
+ */
+typedef struct {
+    ahbctrl_pp_dev masters[64];
+    ahbctrl_pp_dev slaves[64];
+} ahbctrl_info;
+
+/* AMBA Plug&Play AHB information layout */
+typedef struct {
+    unsigned int conf;
+    unsigned int bar;
+} apbctrl_pp_dev;
+
+/* All functions return the number of found devices
+ * 0 = no devices found
+ */
+
+/****************************** APB SLAVES ******************************/
+int ambapp_apb_count(
+    unsigned int vendor,
+    unsigned int driver
+    );
+
+int ambapp_apb_first(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_apbdev *dev
+    );
+
+int ambapp_apb_next(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_apbdev *dev,
+    int index
+    );
+
+int ambapp_apbs_first(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_apbdev *dev,
+    int max_cnt
+    );
+
+/****************************** AHB MASTERS ******************************/
+int ambapp_ahbmst_count(
+    unsigned int vendor,
+    unsigned int driver
+    );
+
+int ambapp_ahbmst_first(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_ahbdev *dev
+    );
+
+int ambapp_ahbmst_next(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_ahbdev *dev,
+    int index
+    );
+
+int ambapp_ahbmsts_first(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_ahbdev *dev,
+    int max_cnt
+    );
+
+/****************************** AHB SLAVES ******************************/
+int ambapp_ahbslv_count(
+    unsigned int vendor,
+    unsigned int driver
+    );
+
+int ambapp_ahbslv_first(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_ahbdev *dev
+    );
+
+int ambapp_ahbslv_next(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_ahbdev *dev,
+    int index
+    );
+
+int ambapp_ahbslvs_first(
+    unsigned int vendor,
+    unsigned int driver,
+    ambapp_ahbdev *dev,
+    int max_cnt
+    );
+
+/*************************** AHB/APB only regs functions 
*************************
+ * During start up, no memory is available we can use the simplified 
functions
+ * to get to the memory controller.
+ *
+ * Functions uses no stack/memory, only registers.
+ */
+unsigned int ambapp_apb_next_nomem(
+    register unsigned int vendor,  /* Plug&Play Vendor ID */
+    register unsigned int driver,  /* Plug&Play Device ID */
+    register int index);
+
+ahbctrl_pp_dev *ambapp_ahb_next_nomem(
+    register unsigned int vendor,  /* Plug&Play Vendor ID */
+    register unsigned int driver,  /* Plug&Play Device ID */
+    register unsigned int opts,    /* scan for AHB 1=slave, 0=masters */
+    register int index);
+
+
+unsigned int ambapp_ahb_get_info(ahbctrl_pp_dev *ahb, int info);
+
+/*************************** AMBA Plug&Play device register MAPS 
*****************/
+
+/*
+ *  The following defines the bits in the LEON UART Status Registers.
+ */
+
+#define LEON_REG_UART_STATUS_DR   0x00000001    /* Data Ready */
+#define LEON_REG_UART_STATUS_TSE  0x00000002    /* TX Send Register 
Empty */
+#define LEON_REG_UART_STATUS_THE  0x00000004    /* TX Hold Register 
Empty */
+#define LEON_REG_UART_STATUS_BR   0x00000008    /* Break Error */
+#define LEON_REG_UART_STATUS_OE   0x00000010    /* RX Overrun Error */
+#define LEON_REG_UART_STATUS_PE   0x00000020    /* RX Parity Error */
+#define LEON_REG_UART_STATUS_FE   0x00000040    /* RX Framing Error */
+#define LEON_REG_UART_STATUS_ERR  0x00000078    /* Error Mask */
+
+/*
+ *  The following defines the bits in the LEON UART Ctrl Registers.
+ */
+
+#define LEON_REG_UART_CTRL_RE     0x00000001    /* Receiver enable */
+#define LEON_REG_UART_CTRL_TE     0x00000002    /* Transmitter enable */
+#define LEON_REG_UART_CTRL_RI     0x00000004    /* Receiver interrupt 
enable */
+#define LEON_REG_UART_CTRL_TI     0x00000008    /* Transmitter 
interrupt enable */
+#define LEON_REG_UART_CTRL_PS     0x00000010    /* Parity select */
+#define LEON_REG_UART_CTRL_PE     0x00000020    /* Parity enable */
+#define LEON_REG_UART_CTRL_FL     0x00000040    /* Flow control enable */
+#define LEON_REG_UART_CTRL_LB     0x00000080    /* Loop Back enable */
+#define LEON_REG_UART_CTRL_DBG    (1<<11)     /* Debug Bit used by GRMON */
+
+#define LEON3_GPTIMER_EN 1
+#define LEON3_GPTIMER_RL 2
+#define LEON3_GPTIMER_LD 4
+#define LEON3_GPTIMER_IRQEN 8
+
+/*
+ *  The following defines the bits in the LEON PS/2 Status Registers.
+ */
+
+#define LEON_REG_PS2_STATUS_DR   0x00000001 /* Data Ready */
+#define LEON_REG_PS2_STATUS_PE   0x00000002 /* Parity error */
+#define LEON_REG_PS2_STATUS_FE   0x00000004 /* Framing error */
+#define LEON_REG_PS2_STATUS_KI   0x00000008 /* Keyboard inhibit */
+
+
+/*
+ *  The following defines the bits in the LEON PS/2 Ctrl Registers.
+ */
+
+#define LEON_REG_PS2_CTRL_RE     0x00000001 /* Receiver enable */
+#define LEON_REG_PS2_CTRL_TE     0x00000002 /* Transmitter enable */
+#define LEON_REG_PS2_CTRL_RI     0x00000004 /* Keyboard receive 
interrupt  */
+#define LEON_REG_PS2_CTRL_TI     0x00000008 /* Keyboard transmit 
interrupt */
+
+typedef struct {
+    volatile unsigned int ilevel;
+    volatile unsigned int ipend;
+    volatile unsigned int iforce;
+    volatile unsigned int iclear;
+    volatile unsigned int mstatus;
+    volatile unsigned int notused[11];
+    volatile unsigned int cpu_mask[16];
+    volatile unsigned int cpu_force[16];
+} ambapp_dev_irqmp;
+
+typedef struct {
+    volatile unsigned int data;
+    volatile unsigned int status;
+    volatile unsigned int ctrl;
+    volatile unsigned int scaler;
+} ambapp_dev_apbuart;
+
+typedef struct {
+    volatile unsigned int val;
+    volatile unsigned int rld;
+    volatile unsigned int ctrl;
+    volatile unsigned int unused;
+} ambapp_dev_gptimer_element;
+
+#define LEON3_GPTIMER_CTRL_EN    0x1    /* Timer enable */
+#define LEON3_GPTIMER_CTRL_RS    0x2    /* Timer reStart  */
+#define LEON3_GPTIMER_CTRL_LD    0x4    /* Timer reLoad */
+#define LEON3_GPTIMER_CTRL_IE    0x8    /* interrupt enable */
+#define LEON3_GPTIMER_CTRL_IP    0x10    /* interrupt flag/pending */
+#define LEON3_GPTIMER_CTRL_CH    0x20    /* Chain with previous timer */
+
+
+typedef struct {
+    volatile unsigned int scalar;
+    volatile unsigned int scalar_reload;
+    volatile unsigned int config;
+    volatile unsigned int unused;
+    volatile ambapp_dev_gptimer_element e[8];
+} ambapp_dev_gptimer;
+
+typedef struct {
+    volatile unsigned int iodata;
+    volatile unsigned int ioout;
+    volatile unsigned int iodir;
+    volatile unsigned int irqmask;
+    volatile unsigned int irqpol;
+    volatile unsigned int irqedge;
+} ambapp_dev_ioport;
+
+typedef struct {
+    volatile unsigned int write;
+    volatile unsigned int dummy;
+    volatile unsigned int txcolor;
+    volatile unsigned int bgcolor;
+} ambapp_dev_textvga;
+
+typedef struct {
+    volatile unsigned int data;
+    volatile unsigned int status;
+    volatile unsigned int ctrl;
+} ambapp_dev_apbps2;
+
+typedef struct {
+    unsigned int mcfg1,mcfg2,mcfg3;
+} ambapp_dev_mctrl;
+
+typedef struct {
+    unsigned int sdcfg;
+} ambapp_dev_sdctrl;
+
+typedef struct {
+    unsigned int cfg1;
+    unsigned int cfg2;
+    unsigned int cfg3;
+} ambapp_dev_ddr2spa;
+
+typedef struct {
+    unsigned int ctrl;
+    unsigned int cfg;
+} ambapp_dev_ddrspa;
+
+#endif
+
+#endif
diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h
index f3965ef..3387612 100644
--- a/include/config_cmd_all.h
+++ b/include/config_cmd_all.h
@@ -13,6 +13,7 @@
  * Alphabetical list of all possible commands.
  */
 
+#define CONFIG_CMD_AMBAPP    /* AMBA Plug & Play Bus print utility */
 #define CONFIG_CMD_ASKENV    /* ask for env variable        */
 #define CONFIG_CMD_AUTOSCRIPT    /* Autoscript Support        */
 #define CONFIG_CMD_BDI               /* bdinfo            */

             reply	other threads:[~2008-03-13  9:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13  9:39 Daniel Hellstrom [this message]
2008-03-13 12:17 ` [U-Boot-Users] [PATCH 5/8] SPARC: Added AMBA PnP Information listing command for LEON3 Wolfgang Denk
2008-03-13 12:53   ` Daniel Hellstrom
2008-03-13 12:29 ` Jean-Christophe PLAGNIOL-VILLARD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47D8F64D.6030903@gaisler.com \
    --to=daniel@gaisler.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.