summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarkus Klotzbuecher <mk@denx.de>2008-07-10 16:03:26 +0200
committerMarkus Klotzbuecher <mk@denx.de>2008-07-10 16:03:26 +0200
commit262423955895ba4599fa11d7c49dcffb65af0afd (patch)
tree59d35abf0b661bef68018e2137c174db0309bc22 /drivers
parent794a5924972fc8073616e98a2668da4a5f9aea90 (diff)
parente0320b1ebec13755911a53b0af12cbf3e5e49a65 (diff)
Merge branch 'master' of git://www.denx.de/git/u-boot
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/nand.c2
-rw-r--r--drivers/mtd/nand/nand_util.c6
-rw-r--r--drivers/net/ns8382x.c4
-rw-r--r--drivers/net/rtl8169.c2
-rw-r--r--drivers/pci/pci.c70
-rw-r--r--drivers/rtc/m41t60.c2
-rw-r--r--drivers/usb/usbdcore.c7
-rw-r--r--drivers/usb/usbdcore_ep0.c14
8 files changed, 60 insertions, 47 deletions
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
index 27b5792bcc..e44470eb6c 100644
--- a/drivers/mtd/nand/nand.c
+++ b/drivers/mtd/nand/nand.c
@@ -70,7 +70,7 @@ void nand_init(void)
if (nand_curr_device == -1)
nand_curr_device = i;
}
- printf("%lu MiB\n", size / (1024 * 1024));
+ printf("%u MiB\n", size / (1024 * 1024));
#ifdef CFG_NAND_SELECT_DEVICE
/*
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index c82f77b555..828cc338ad 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -154,7 +154,7 @@ int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)
}
if (erase_length < meminfo->erasesize) {
- printf("Warning: Erase size 0x%08x smaller than one " \
+ printf("Warning: Erase size 0x%08lx smaller than one " \
"erase block 0x%08x\n",erase_length, meminfo->erasesize);
printf(" Erasing 0x%08x instead\n", meminfo->erasesize);
erase_length = meminfo->erasesize;
@@ -498,7 +498,7 @@ int nand_write_opts(nand_info_t *meminfo, const nand_write_options_t *opts)
* on (slow) serial consoles
*/
if (percent != percent_complete) {
- printf("\rWriting data at 0x%x "
+ printf("\rWriting data at 0x%lx "
"-- %3d%% complete.",
mtdoffset, percent);
percent_complete = percent;
@@ -678,7 +678,7 @@ int nand_read_opts(nand_info_t *meminfo, const nand_read_options_t *opts)
*/
if (percent != percent_complete) {
if (!opts->quiet)
- printf("\rReading data from 0x%x "
+ printf("\rReading data from 0x%lx "
"-- %3d%% complete.",
mtdoffset, percent);
percent_complete = percent;
diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c
index 0b9a3ae66d..bb5843815f 100644
--- a/drivers/net/ns8382x.c
+++ b/drivers/net/ns8382x.c
@@ -770,14 +770,14 @@ ns8382x_send(struct eth_device *dev, volatile void *packet, int length)
for (i = 0; (tx_stat = le32_to_cpu(txd.cmdsts)) & DescOwn; i++) {
if (i >= TOUT_LOOP) {
- printf ("%s: tx error buffer not ready: txd.cmdsts %#X\n",
+ printf ("%s: tx error buffer not ready: txd.cmdsts %#lX\n",
dev->name, tx_stat);
goto Done;
}
}
if (!(tx_stat & DescPktOK)) {
- printf("ns8382x_send: Transmit error, Tx status %X.\n", tx_stat);
+ printf("ns8382x_send: Transmit error, Tx status %lX.\n", tx_stat);
goto Done;
}
#ifdef NS8382X_DEBUG
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 7423bc0eb8..d069afbe22 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -392,7 +392,7 @@ static int rtl8169_init_board(struct eth_device *dev)
/* if unknown chip, assume array element #0, original RTL-8169 in this case */
printf("PCI device %s: unknown chip version, assuming RTL-8169\n", dev->name);
- printf("PCI device: TxConfig = 0x%hX\n", (unsigned long) RTL_R32(TxConfig));
+ printf("PCI device: TxConfig = 0x%lX\n", (unsigned long) RTL_R32(TxConfig));
tpc->chipset = 0;
match:
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b3ae3b152c..16180cbe51 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -411,6 +411,40 @@ void pci_cfgfunc_do_nothing(struct pci_controller *hose,
extern int pciauto_config_device(struct pci_controller *hose, pci_dev_t dev);
extern void pciauto_config_init(struct pci_controller *hose);
+int __pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
+{
+ /*
+ * Check if pci device should be skipped in configuration
+ */
+ if (dev == PCI_BDF(hose->first_busno, 0, 0)) {
+#if defined(CONFIG_PCI_CONFIG_HOST_BRIDGE) /* don't skip host bridge */
+ /*
+ * Only skip configuration if "pciconfighost" is not set
+ */
+ if (getenv("pciconfighost") == NULL)
+ return 1;
+#else
+ return 1;
+#endif
+ }
+
+ return 0;
+}
+int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
+ __attribute__((weak, alias("__pci_skip_dev")));
+
+#ifdef CONFIG_PCI_SCAN_SHOW
+int __pci_print_dev(struct pci_controller *hose, pci_dev_t dev)
+{
+ if (dev == PCI_BDF(hose->first_busno, 0, 0))
+ return 0;
+
+ return 1;
+}
+int pci_print_dev(struct pci_controller *hose, pci_dev_t dev)
+ __attribute__((weak, alias("__pci_print_dev")));
+#endif /* CONFIG_PCI_SCAN_SHOW */
+
int pci_hose_scan_bus(struct pci_controller *hose, int bus)
{
unsigned int sub_bus, found_multi=0;
@@ -423,21 +457,10 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
for (dev = PCI_BDF(bus,0,0);
dev < PCI_BDF(bus,PCI_MAX_PCI_DEVICES-1,PCI_MAX_PCI_FUNCTIONS-1);
- dev += PCI_BDF(0,0,1))
- {
- /* Skip our host bridge */
- if ( dev == PCI_BDF(hose->first_busno,0,0) ) {
-#if defined(CONFIG_PCI_CONFIG_HOST_BRIDGE) /* don't skip host bridge */
- /*
- * Only skip hostbridge configuration if "pciconfighost" is not set
- */
- if (getenv("pciconfighost") == NULL) {
- continue; /* Skip our host bridge */
- }
-#else
- continue; /* Skip our host bridge */
-#endif
- }
+ dev += PCI_BDF(0,0,1)) {
+
+ if (pci_skip_dev(hose, dev))
+ continue;
if (PCI_FUNC(dev) && !found_multi)
continue;
@@ -473,15 +496,14 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
hose->fixup_irq(hose, dev);
#ifdef CONFIG_PCI_SCAN_SHOW
- /* Skip our host bridge */
- if ( dev != PCI_BDF(hose->first_busno,0,0) ) {
- unsigned char int_line;
-
- pci_hose_read_config_byte(hose, dev, PCI_INTERRUPT_LINE,
- &int_line);
- printf(" %02x %02x %04x %04x %04x %02x\n",
- PCI_BUS(dev), PCI_DEV(dev), vendor, device, class,
- int_line);
+ if (pci_print_dev(hose, dev)) {
+ unsigned char int_line;
+
+ pci_hose_read_config_byte(hose, dev, PCI_INTERRUPT_LINE,
+ &int_line);
+ printf(" %02x %02x %04x %04x %04x %02x\n",
+ PCI_BUS(dev), PCI_DEV(dev), vendor, device, class,
+ int_line);
}
#endif
}
diff --git a/drivers/rtc/m41t60.c b/drivers/rtc/m41t60.c
index 8a32ea0748..ef135cab38 100644
--- a/drivers/rtc/m41t60.c
+++ b/drivers/rtc/m41t60.c
@@ -241,7 +241,7 @@ void rtc_reset(void)
if (l <= 0x3F) {
if ((data[RTC_CTRL] & 0x3F) != l) {
- printf("Setting RTC calibration to 0x%02X\n",
+ printf("Setting RTC calibration to 0x%02lX\n",
l);
data[RTC_CTRL] &= 0xC0;
data[RTC_CTRL] |= (uchar) l;
diff --git a/drivers/usb/usbdcore.c b/drivers/usb/usbdcore.c
index 308c7ceccc..a621ce7a39 100644
--- a/drivers/usb/usbdcore.c
+++ b/drivers/usb/usbdcore.c
@@ -146,12 +146,9 @@ struct usb_string_descriptor *usbd_get_string (__u8 index)
static struct usb_configuration_instance *usbd_device_configuration_instance (struct usb_device_instance *device,
unsigned int port, unsigned int configuration)
{
- /* XXX */
- configuration = configuration ? configuration - 1 : 0;
-
- if (configuration >= device->configurations) {
+ if (configuration >= device->configurations)
return NULL;
- }
+
return device->configuration_instance_array + configuration;
}
diff --git a/drivers/usb/usbdcore_ep0.c b/drivers/usb/usbdcore_ep0.c
index 1e44f322a7..cf3f3826cb 100644
--- a/drivers/usb/usbdcore_ep0.c
+++ b/drivers/usb/usbdcore_ep0.c
@@ -235,8 +235,8 @@ static int ep0_get_descriptor (struct usb_device_instance *device,
return -1;
}
/*dbg_ep0(2, "%d %d", index, device_descriptor->bNumConfigurations); */
- if (index > device_descriptor->bNumConfigurations) {
- dbg_ep0 (0, "index too large: %d > %d", index,
+ if (index >= device_descriptor->bNumConfigurations) {
+ dbg_ep0 (0, "index too large: %d >= %d", index,
device_descriptor->
bNumConfigurations);
return -1;
@@ -571,14 +571,8 @@ int ep0_recv_setup (struct urb *urb)
case USB_REQ_SET_CONFIGURATION:
/* c.f. 9.4.7 - the top half of wValue is reserved */
- /* */
- if ((device->configuration =
- le16_to_cpu (request->wValue) & 0xFF80) != 0) {
- /* c.f. 9.4.7 - zero is the default or addressed state, in our case this */
- /* is the same is configuration zero */
- serial_printf("error setting dev->config to zero!\n");
- device->configuration = 0; /* TBR - ?????? */
- }
+ device->configuration = le16_to_cpu(request->wValue) & 0xff;
+
/* reset interface and alternate settings */
device->interface = device->alternate = 0;