GR-RASTA-IO: fix build warnings

This commit is contained in:
Daniel Hellstrom
2015-02-11 12:39:04 +01:00
parent 03037b464f
commit 960aebfe1e
2 changed files with 16 additions and 17 deletions

View File

@@ -28,7 +28,7 @@ extern "C" {
* used by the drivers controlling the cores on the GR-RASTA-IO target AMBA bus. * used by the drivers controlling the cores on the GR-RASTA-IO target AMBA bus.
* *
* The gr_rasta_io_resources is declared weak so that the user can override the * The gr_rasta_io_resources is declared weak so that the user can override the
* default configuration. * default configuration. The array must be terminated with a NULL resource.
*/ */
extern struct drvmgr_bus_res *gr_rasta_io_resources[]; extern struct drvmgr_bus_res *gr_rasta_io_resources[];
@@ -36,9 +36,12 @@ extern struct drvmgr_bus_res *gr_rasta_io_resources[];
#define RASTA_IO_OPTIONS_AMBA 0x01 /* Print AMBA bus devices */ #define RASTA_IO_OPTIONS_AMBA 0x01 /* Print AMBA bus devices */
#define RASTA_IO_OPTIONS_IRQ 0x02 /* Print current IRQ setup */ #define RASTA_IO_OPTIONS_IRQ 0x02 /* Print current IRQ setup */
/* Print information about GR-RASTA-IO PCI board */ /* Print information about GR-RASTA-IO PCI boards */
void gr_rasta_io_print(int options); void gr_rasta_io_print(int options);
/* Print information about a GR-RASTA-IO PCI board */
void gr_rasta_io_print_dev(struct drvmgr_dev *dev, int options);
/* Register GR-RASTA-IO driver */ /* Register GR-RASTA-IO driver */
void gr_rasta_io_register_drv(void); void gr_rasta_io_register_drv(void);

View File

@@ -30,6 +30,7 @@
#include <drvmgr/drvmgr.h> #include <drvmgr/drvmgr.h>
#include <drvmgr/ambapp_bus.h> #include <drvmgr/ambapp_bus.h>
#include <drvmgr/pci_bus.h> #include <drvmgr/pci_bus.h>
#include <drvmgr/bspcommon.h>
#include <genirq.h> #include <genirq.h>
#include <gr_rasta_io.h> #include <gr_rasta_io.h>
@@ -65,6 +66,7 @@ extern unsigned int _RAM_START;
int gr_rasta_io_init1(struct drvmgr_dev *dev); int gr_rasta_io_init1(struct drvmgr_dev *dev);
int gr_rasta_io_init2(struct drvmgr_dev *dev); int gr_rasta_io_init2(struct drvmgr_dev *dev);
void gr_rasta_io_isr (void *arg);
struct grpci_regs { struct grpci_regs {
volatile unsigned int cfg_stat; volatile unsigned int cfg_stat;
@@ -219,7 +221,6 @@ struct drvmgr_bus_res *gr_rasta_io_resources[] __attribute__((weak)) =
{ {
NULL NULL
}; };
int gr_rasta_io_resources_cnt = 0;
void gr_rasta_io_register_drv(void) void gr_rasta_io_register_drv(void)
{ {
@@ -254,11 +255,10 @@ void gr_rasta_io_isr (void *arg)
} }
/* PCI Hardware (Revision 0 and 1) initialization */ /* PCI Hardware (Revision 0 and 1) initialization */
int gr_rasta_io_hw_init(struct gr_rasta_io_priv *priv) static int gr_rasta_io_hw_init(struct gr_rasta_io_priv *priv)
{ {
unsigned int *page0 = NULL; unsigned int *page0 = NULL;
struct ambapp_dev *tmp; struct ambapp_dev *tmp;
int status;
struct ambapp_ahb_info *ahb; struct ambapp_ahb_info *ahb;
struct pci_dev_info *devinfo = priv->devinfo; struct pci_dev_info *devinfo = priv->devinfo;
uint32_t bar0, bar0_size; uint32_t bar0, bar0_size;
@@ -319,7 +319,7 @@ int gr_rasta_io_hw_init(struct gr_rasta_io_priv *priv)
*page0 = AHB1_BASE_ADDR; *page0 = AHB1_BASE_ADDR;
/* Find GRPCI controller */ /* Find GRPCI controller */
tmp = (void *)ambapp_for_each(&priv->abus, tmp = (struct ambapp_dev *)ambapp_for_each(&priv->abus,
(OPTIONS_ALL|OPTIONS_APB_SLVS), (OPTIONS_ALL|OPTIONS_APB_SLVS),
VENDOR_GAISLER, GAISLER_PCIFBRG, VENDOR_GAISLER, GAISLER_PCIFBRG,
ambapp_find_by_idx, NULL); ambapp_find_by_idx, NULL);
@@ -336,7 +336,7 @@ int gr_rasta_io_hw_init(struct gr_rasta_io_priv *priv)
priv->grpci->page1 = 0x40000000; priv->grpci->page1 = 0x40000000;
/* Find IRQ controller, Clear all current IRQs */ /* Find IRQ controller, Clear all current IRQs */
tmp = (void *)ambapp_for_each(&priv->abus, tmp = (struct ambapp_dev *)ambapp_for_each(&priv->abus,
(OPTIONS_ALL|OPTIONS_APB_SLVS), (OPTIONS_ALL|OPTIONS_APB_SLVS),
VENDOR_GAISLER, GAISLER_IRQMP, VENDOR_GAISLER, GAISLER_IRQMP,
ambapp_find_by_idx, NULL); ambapp_find_by_idx, NULL);
@@ -364,7 +364,7 @@ int gr_rasta_io_hw_init(struct gr_rasta_io_priv *priv)
priv->bus_maps_down[2].size = 0; priv->bus_maps_down[2].size = 0;
/* Find GRPCI controller AHB Slave interface */ /* Find GRPCI controller AHB Slave interface */
tmp = (void *)ambapp_for_each(&priv->abus, tmp = (struct ambapp_dev *)ambapp_for_each(&priv->abus,
(OPTIONS_ALL|OPTIONS_AHB_SLVS), (OPTIONS_ALL|OPTIONS_AHB_SLVS),
VENDOR_GAISLER, GAISLER_PCIFBRG, VENDOR_GAISLER, GAISLER_PCIFBRG,
ambapp_find_by_idx, NULL); ambapp_find_by_idx, NULL);
@@ -388,19 +388,17 @@ int gr_rasta_io_hw_init(struct gr_rasta_io_priv *priv)
} }
/* PCI Hardware (Revision 1) initialization */ /* PCI Hardware (Revision 1) initialization */
int gr_rasta_io2_hw_init(struct gr_rasta_io_priv *priv) static int gr_rasta_io2_hw_init(struct gr_rasta_io_priv *priv)
{ {
int i; int i;
uint32_t data; uint32_t data;
unsigned int ctrl; unsigned int ctrl;
uint8_t tmp2; uint8_t tmp2;
struct ambapp_dev *tmp; struct ambapp_dev *tmp;
int status;
struct ambapp_ahb_info *ahb; struct ambapp_ahb_info *ahb;
uint8_t cap_ptr; uint8_t cap_ptr;
pci_dev_t pcidev = priv->pcidev; pci_dev_t pcidev = priv->pcidev;
struct pci_dev_info *devinfo = priv->devinfo; struct pci_dev_info *devinfo = priv->devinfo;
unsigned int pci_freq_hz;
/* Check capabilities list bit */ /* Check capabilities list bit */
pci_cfg_r8(pcidev, PCI_STATUS, &tmp2); pci_cfg_r8(pcidev, PCI_STATUS, &tmp2);
@@ -534,7 +532,7 @@ int gr_rasta_io2_hw_init(struct gr_rasta_io_priv *priv)
return 0; return 0;
} }
int gr_rasta_io_hw_init2(struct gr_rasta_io_priv *priv) static int gr_rasta_io_hw_init2(struct gr_rasta_io_priv *priv)
{ {
/* Enable DMA by enabling PCI target as master */ /* Enable DMA by enabling PCI target as master */
pci_master_enable(priv->pcidev); pci_master_enable(priv->pcidev);
@@ -552,6 +550,7 @@ int gr_rasta_io_init1(struct drvmgr_dev *dev)
int status; int status;
uint32_t bar0, bar1, bar0_size, bar1_size; uint32_t bar0, bar1, bar0_size, bar1_size;
union drvmgr_key_value *value; union drvmgr_key_value *value;
int resources_cnt;
priv = malloc(sizeof(struct gr_rasta_io_priv)); priv = malloc(sizeof(struct gr_rasta_io_priv));
if ( !priv ) if ( !priv )
@@ -562,10 +561,7 @@ int gr_rasta_io_init1(struct drvmgr_dev *dev)
priv->dev = dev; priv->dev = dev;
/* Determine number of configurations */ /* Determine number of configurations */
if ( gr_rasta_io_resources_cnt == 0 ) { resources_cnt = get_resarray_count(gr_rasta_io_resources);
while ( gr_rasta_io_resources[gr_rasta_io_resources_cnt] )
gr_rasta_io_resources_cnt++;
}
/* Generate Device prefix */ /* Generate Device prefix */
@@ -645,7 +641,7 @@ int gr_rasta_io_init1(struct drvmgr_dev *dev)
priv->config.ops = &ambapp_rasta_io_ops; priv->config.ops = &ambapp_rasta_io_ops;
priv->config.maps_up = &priv->bus_maps_up[0]; priv->config.maps_up = &priv->bus_maps_up[0];
priv->config.maps_down = &priv->bus_maps_down[0]; priv->config.maps_down = &priv->bus_maps_down[0];
if ( priv->dev->minor_drv < gr_rasta_io_resources_cnt ) { if ( priv->dev->minor_drv < resources_cnt ) {
priv->config.resources = gr_rasta_io_resources[priv->dev->minor_drv]; priv->config.resources = gr_rasta_io_resources[priv->dev->minor_drv];
} else { } else {
priv->config.resources = NULL; priv->config.resources = NULL;