GR-RASTA-TMTC: fix build warnings

This commit is contained in:
Daniel Hellstrom
2015-02-11 12:40:17 +01:00
parent 90fd587d21
commit dd8abfc108
2 changed files with 20 additions and 17 deletions

View File

@@ -78,7 +78,8 @@ extern "C" {
* used by the device drivers controlling the cores on the GR-RASTA-IO target * used by the device drivers controlling the cores on the GR-RASTA-IO target
* AMBA bus. * AMBA bus.
* *
* The array is defined weak, and defualts to no resources. * The array is defined weak, and defaults to no resources. The array must be
* terminated with a NULL resource.
*/ */
extern struct drvmgr_bus_res *gr_rasta_tmtc_resources[]; extern struct drvmgr_bus_res *gr_rasta_tmtc_resources[];
@@ -86,9 +87,12 @@ extern struct drvmgr_bus_res *gr_rasta_tmtc_resources[];
#define RASTA_TMTC_OPTIONS_AMBA 0x01 /* Print AMBA bus devices */ #define RASTA_TMTC_OPTIONS_AMBA 0x01 /* Print AMBA bus devices */
#define RASTA_TMTC_OPTIONS_IRQ 0x02 /* Print current IRQ setup */ #define RASTA_TMTC_OPTIONS_IRQ 0x02 /* Print current IRQ setup */
/* Print information about GR-RASTA-TMTC PCI board */ /* Print information about GR-RASTA-TMTC PCI boards */
void gr_rasta_tmtc_print(int options); void gr_rasta_tmtc_print(int options);
/* Print information about a GR-RASTA-TMTC PCI boards */
void gr_rasta_tmtc_print_dev(struct drvmgr_dev *dev, int options);
/* Register GR-RASTA-TMTC driver */ /* Register GR-RASTA-TMTC driver */
void gr_rasta_tmtc_register_drv(void); void gr_rasta_tmtc_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_tmtc.h> #include <gr_rasta_tmtc.h>
@@ -61,6 +62,7 @@ extern unsigned int _RAM_START;
int gr_rasta_tmtc_init1(struct drvmgr_dev *dev); int gr_rasta_tmtc_init1(struct drvmgr_dev *dev);
int gr_rasta_tmtc_init2(struct drvmgr_dev *dev); int gr_rasta_tmtc_init2(struct drvmgr_dev *dev);
void gr_rasta_tmtc_isr (void *arg);
struct grpci_regs { struct grpci_regs {
volatile unsigned int cfg_stat; volatile unsigned int cfg_stat;
@@ -210,7 +212,6 @@ struct drvmgr_bus_res *gr_rasta_tmtc_resources[] __attribute__((weak)) =
{ {
NULL, NULL,
}; };
int gr_rasta_tmtc_resources_cnt = 0;
void gr_rasta_tmtc_register_drv(void) void gr_rasta_tmtc_register_drv(void)
{ {
@@ -247,7 +248,7 @@ void gr_rasta_tmtc_isr (void *arg)
/* Init AMBA bus frequency, IRQ controller, GPIO register, bus maps and other /* Init AMBA bus frequency, IRQ controller, GPIO register, bus maps and other
* common stuff between rev0 and rev1. * common stuff between rev0 and rev1.
*/ */
int gr_rasta_tmtc_hw_init_common(struct gr_rasta_tmtc_priv *priv) static int gr_rasta_tmtc_hw_init_common(struct gr_rasta_tmtc_priv *priv)
{ {
struct ambapp_dev *tmp; struct ambapp_dev *tmp;
unsigned int pci_freq_hz; unsigned int pci_freq_hz;
@@ -259,7 +260,7 @@ int gr_rasta_tmtc_hw_init_common(struct gr_rasta_tmtc_priv *priv)
ambapp_freq_init(&priv->abus, NULL, pci_freq_hz); ambapp_freq_init(&priv->abus, NULL, pci_freq_hz);
/* 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);
@@ -273,7 +274,7 @@ int gr_rasta_tmtc_hw_init_common(struct gr_rasta_tmtc_priv *priv)
priv->irq->ilevel = 0; priv->irq->ilevel = 0;
/* Find First GPIO controller */ /* Find First GPIO 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_GPIO, VENDOR_GAISLER, GAISLER_GPIO,
ambapp_find_by_idx, NULL); ambapp_find_by_idx, NULL);
@@ -309,7 +310,7 @@ int gr_rasta_tmtc_hw_init_common(struct gr_rasta_tmtc_priv *priv)
} }
/* PCI Hardware (Revision 0) initialization */ /* PCI Hardware (Revision 0) initialization */
int gr_rasta_tmtc0_hw_init(struct gr_rasta_tmtc_priv *priv) static int gr_rasta_tmtc0_hw_init(struct gr_rasta_tmtc_priv *priv)
{ {
unsigned int *page0 = NULL; unsigned int *page0 = NULL;
struct ambapp_dev *tmp; struct ambapp_dev *tmp;
@@ -381,7 +382,7 @@ int gr_rasta_tmtc0_hw_init(struct gr_rasta_tmtc_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);
@@ -427,7 +428,7 @@ int gr_rasta_tmtc0_hw_init(struct gr_rasta_tmtc_priv *priv)
} }
/* PCI Hardware (Revision 1) initialization */ /* PCI Hardware (Revision 1) initialization */
int gr_rasta_tmtc1_hw_init(struct gr_rasta_tmtc_priv *priv) static int gr_rasta_tmtc1_hw_init(struct gr_rasta_tmtc_priv *priv)
{ {
int i; int i;
uint32_t data; uint32_t data;
@@ -507,7 +508,7 @@ int gr_rasta_tmtc1_hw_init(struct gr_rasta_tmtc_priv *priv)
return status; return status;
/* Find GRPCI2 controller AHB Slave interface */ /* Find GRPCI2 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_GRPCI2, VENDOR_GAISLER, GAISLER_GRPCI2,
ambapp_find_by_idx, NULL); ambapp_find_by_idx, NULL);
@@ -523,7 +524,7 @@ int gr_rasta_tmtc1_hw_init(struct gr_rasta_tmtc_priv *priv)
priv->bus_maps_up[1].size = 0; priv->bus_maps_up[1].size = 0;
/* Find GRPCI2 controller APB Slave interface */ /* Find GRPCI2 controller APB Slave interface */
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_GRPCI2, VENDOR_GAISLER, GAISLER_GRPCI2,
ambapp_find_by_idx, NULL); ambapp_find_by_idx, NULL);
@@ -548,7 +549,7 @@ int gr_rasta_tmtc1_hw_init(struct gr_rasta_tmtc_priv *priv)
return 0; return 0;
} }
void gr_rasta_tmtc_hw_init2(struct gr_rasta_tmtc_priv *priv) static void gr_rasta_tmtc_hw_init2(struct gr_rasta_tmtc_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);
@@ -564,6 +565,7 @@ int gr_rasta_tmtc_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 = dev->priv; priv = dev->priv;
if (!priv) if (!priv)
@@ -571,10 +573,7 @@ int gr_rasta_tmtc_init1(struct drvmgr_dev *dev)
priv->dev = dev; priv->dev = dev;
/* Determine number of configurations */ /* Determine number of configurations */
if ( gr_rasta_tmtc_resources_cnt == 0 ) { resources_cnt = get_resarray_count(gr_rasta_tmtc_resources);
while ( gr_rasta_tmtc_resources[gr_rasta_tmtc_resources_cnt] )
gr_rasta_tmtc_resources_cnt++;
}
/* Generate Device prefix */ /* Generate Device prefix */
@@ -645,7 +644,7 @@ int gr_rasta_tmtc_init1(struct drvmgr_dev *dev)
priv->config.ops = &ambapp_rasta_tmtc_ops; priv->config.ops = &ambapp_rasta_tmtc_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_tmtc_resources_cnt ) { if ( priv->dev->minor_drv < resources_cnt ) {
priv->config.resources = gr_rasta_tmtc_resources[priv->dev->minor_drv]; priv->config.resources = gr_rasta_tmtc_resources[priv->dev->minor_drv];
} else { } else {
priv->config.resources = NULL; priv->config.resources = NULL;