GR_701: fix build warnings

This commit is contained in:
Daniel Hellstrom
2015-02-11 12:36:50 +01:00
parent cb64b862f8
commit 05a45c7932
2 changed files with 14 additions and 13 deletions

View File

@@ -27,17 +27,20 @@ extern "C" {
/* An array of pointers to GR-701 resources. The resources will be /* An array of pointers to GR-701 resources. The resources will be
* used by the drivers controlling the cores on the GR-701 target AMBA bus. * used by the drivers controlling the cores on the GR-701 target AMBA bus.
* *
* The gr_rasta_io_resources is declared weak so that the user can override the * The gr701_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 *gr701_resources[]; extern struct drvmgr_bus_res *gr701_resources[];
#define GR701_OPTIONS_AMBA 0x01 #define GR701_OPTIONS_AMBA 0x01
#define GR701_OPTIONS_IRQ 0x02 #define GR701_OPTIONS_IRQ 0x02
/* Print information about GR-RASTA-IO PCI board */ /* Print information about all GR-701 PCI boards */
void gr701_print(int options); void gr701_print(int options);
/* Print information about one GR-701 PCI board */
void gr701_print_dev(struct drvmgr_dev *dev, int options);
/* Register GR-701 driver */ /* Register GR-701 driver */
void gr701_register_drv(void); void gr701_register_drv(void);

View File

@@ -32,6 +32,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_701.h> #include <gr_701.h>
@@ -50,6 +51,7 @@
int gr701_init1(struct drvmgr_dev *dev); int gr701_init1(struct drvmgr_dev *dev);
int gr701_init2(struct drvmgr_dev *dev); int gr701_init2(struct drvmgr_dev *dev);
void gr701_interrupt(void *arg);
#define READ_REG(address) (*(volatile unsigned int *)address) #define READ_REG(address) (*(volatile unsigned int *)address)
@@ -186,7 +188,6 @@ struct drvmgr_bus_res *gr701_resources[] __attribute__((weak)) =
{ {
NULL NULL
}; };
int gr701_resources_cnt = 0;
void gr701_register_drv(void) void gr701_register_drv(void)
{ {
@@ -213,7 +214,7 @@ void gr701_interrupt(void *arg)
drvmgr_interrupt_clear(priv->dev, 0); drvmgr_interrupt_clear(priv->dev, 0);
} }
int gr701_hw_init(struct gr701_priv *priv) static int gr701_hw_init(struct gr701_priv *priv)
{ {
uint32_t com1; uint32_t com1;
struct pci_bridge_regs *pcib; struct pci_bridge_regs *pcib;
@@ -277,7 +278,7 @@ int gr701_hw_init(struct gr701_priv *priv)
NULL, &priv->amba_maps[0]); NULL, &priv->amba_maps[0]);
/* Frequency is the same as the PCI bus frequency */ /* Frequency is the same as the PCI bus frequency */
drvmgr_freq_get(priv->dev, NULL, &pci_freq_hz); drvmgr_freq_get(priv->dev, 0, &pci_freq_hz);
/* Initialize Frequency of AMBA bus */ /* Initialize Frequency of AMBA bus */
ambapp_freq_init(&priv->abus, NULL, pci_freq_hz); ambapp_freq_init(&priv->abus, NULL, pci_freq_hz);
@@ -293,7 +294,7 @@ int gr701_hw_init(struct gr701_priv *priv)
return 0; return 0;
} }
void gr701_hw_init2(struct gr701_priv *priv) static void gr701_hw_init2(struct gr701_priv *priv)
{ {
/* Enable PCI Master (for DMA) */ /* Enable PCI Master (for DMA) */
pci_master_enable(priv->pcidev); pci_master_enable(priv->pcidev);
@@ -307,6 +308,7 @@ int gr701_init1(struct drvmgr_dev *dev)
struct gr701_priv *priv; struct gr701_priv *priv;
struct pci_dev_info *devinfo; struct pci_dev_info *devinfo;
uint32_t bar0, bar1, bar0_size, bar1_size; uint32_t bar0, bar1, bar0_size, bar1_size;
int resources_cnt;
priv = malloc(sizeof(struct gr701_priv)); priv = malloc(sizeof(struct gr701_priv));
if ( !priv ) if ( !priv )
@@ -317,13 +319,9 @@ int gr701_init1(struct drvmgr_dev *dev)
priv->dev = dev; priv->dev = dev;
/* Determine number of configurations */ /* Determine number of configurations */
if ( gr701_resources_cnt == 0 ) { resources_cnt = get_resarray_count(gr701_resources);
while ( gr701_resources[gr701_resources_cnt] )
gr701_resources_cnt++;
}
/* Generate Device prefix */ /* Generate Device prefix */
strcpy(priv->prefix, "/dev/gr701_0"); strcpy(priv->prefix, "/dev/gr701_0");
priv->prefix[11] += dev->minor_drv; priv->prefix[11] += dev->minor_drv;
mkdir(priv->prefix, S_IRWXU | S_IRWXG | S_IRWXO); mkdir(priv->prefix, S_IRWXU | S_IRWXG | S_IRWXO);
@@ -369,7 +367,7 @@ int gr701_init1(struct drvmgr_dev *dev)
priv->config.ops = &ambapp_gr701_ops; priv->config.ops = &ambapp_gr701_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 < gr701_resources_cnt ) { if ( priv->dev->minor_drv < resources_cnt ) {
priv->config.resources = gr701_resources[priv->dev->minor_drv]; priv->config.resources = gr701_resources[priv->dev->minor_drv];
} else { } else {
priv->config.resources = NULL; priv->config.resources = NULL;