summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:37 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:37 +0200
commitbd77fd31d86e33e8804bf7be40e9c8d2e0d3e279 (patch)
tree912974d39cd603a61fca8ebf800a56dd804aa45b /drivers/usb
parent3f55f3e108653edae31fc9d01d50a55020129402 (diff)
downloadbarebox-bd77fd31d86e33e8804bf7be40e9c8d2e0d3e279.tar.gz
barebox-bd77fd31d86e33e8804bf7be40e9c8d2e0d3e279.tar.xz
svn_rev_253
make it compile
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig24
-rw-r--r--drivers/usb/Makefile5
-rw-r--r--drivers/usb/cmd_usb.c44
-rw-r--r--drivers/usb/host/Makefile1
-rw-r--r--drivers/usb/host/usb_ohci.c14
-rw-r--r--drivers/usb/usb.c9
-rw-r--r--drivers/usb/usb_storage.c13
7 files changed, 70 insertions, 40 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
new file mode 100644
index 0000000000..7626589471
--- /dev/null
+++ b/drivers/usb/Kconfig
@@ -0,0 +1,24 @@
+config HAS_OHCI
+ bool
+
+config USB_HOST
+ bool
+
+config HAS_USB_DEVICE
+ bool
+
+menu "USB host support"
+
+config DRIVER_USB_HOST_OHCI
+ bool
+ depends on HAS_OHCI
+ select USB_HOST
+ prompt "OHCI host driver"
+
+config DRIVER_USB_MASS_STORAGE
+ bool
+ depends on USB_HOST
+ prompt "USB mass storage support"
+
+endmenu
+
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
new file mode 100644
index 0000000000..8c224d67a7
--- /dev/null
+++ b/drivers/usb/Makefile
@@ -0,0 +1,5 @@
+obj-$(CONFIG_USB_HOST) += host/
+#obj-$(CONFIG_USB_DEVICE) += device/
+obj-$(CONFIG_DRIVER_USB_MASS_STORAGE) += usb_storage.o
+obj-$(CONFIG_USB_HOST) += cmd_usb.o
+obj-$(CONFIG_USB_HOST) += usb.o
diff --git a/drivers/usb/cmd_usb.c b/drivers/usb/cmd_usb.c
index c70dac64fa..ea2d0542af 100644
--- a/drivers/usb/cmd_usb.c
+++ b/drivers/usb/cmd_usb.c
@@ -29,11 +29,9 @@
#include <command.h>
#include <asm/byteorder.h>
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
-
#include <usb.h>
-#ifdef CONFIG_USB_STORAGE
+#ifdef CONFIG_DRIVER_USB_MASS_STORAGE
static int usb_stor_curr_dev=-1; /* current device */
#endif
@@ -307,7 +305,7 @@ void usb_show_tree(struct usb_device *dev)
/******************************************************************************
* usb boot command intepreter. Derived from diskboot
*/
-#ifdef CONFIG_USB_STORAGE
+#ifdef CONFIG_DRIVER_USB_MASS_STORAGE
int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
char *boot_device = NULL;
@@ -359,7 +357,10 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
part = simple_strtoul(++ep, NULL, 16);
}
-
+#warning get_partition_info missing
+#if 1
+ printf("call get_partition_info\n");
+#else
if (get_partition_info (stor_dev, part, &info)) {
/* try to boot raw .... */
strncpy((char *)&info.type[0], BOOT_PART_TYPE, sizeof(BOOT_PART_TYPE));
@@ -369,6 +370,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
info.size=2880;
printf("error reading partinfo...try to boot raw\n");
}
+#endif
if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) &&
(strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)) {
printf ("\n** Invalid partition type \"%.32s\""
@@ -423,7 +425,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
return 0;
}
-#endif /* CONFIG_USB_STORAGE */
+#endif /* CONFIG_DRIVER_USB_MASS_STORAGE */
/*********************************************************************************
@@ -435,7 +437,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
int i;
struct usb_device *dev = NULL;
extern char usb_started;
-#ifdef CONFIG_USB_STORAGE
+#ifdef CONFIG_DRIVER_USB_MASS_STORAGE
block_dev_desc_t *stor_dev;
#endif
@@ -444,7 +446,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
usb_stop();
printf("(Re)start USB...\n");
i = usb_init();
-#ifdef CONFIG_USB_STORAGE
+#ifdef CONFIG_DRIVER_USB_MASS_STORAGE
/* try to recognize storage devices immediately */
if (i >= 0)
usb_stor_curr_dev = usb_stor_scan(1);
@@ -512,7 +514,7 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
return 0;
}
-#ifdef CONFIG_USB_STORAGE
+#ifdef CONFIG_DRIVER_USB_MASS_STORAGE
if (strncmp(argv[1], "scan", 4) == 0) {
printf(" NOTE: this command is obsolete and will be phased out\n");
printf(" please use 'usb storage' for USB storage devices information\n\n");
@@ -534,7 +536,9 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
if (devno)
printf("\n");
printf("print_part of %x\n",devno);
- print_part(stor_dev);
+#warning print_part missing
+ printf("call print_part\n");
+// print_part(stor_dev);
}
}
if (!ok) {
@@ -573,7 +577,9 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
printf ("\n Device %d: ", dev);
stor_dev=usb_stor_get_dev(dev);
- dev_print(stor_dev);
+#warning dev_print missing
+ printf("call dev_print\n");
+// dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN) {
return 1;
}
@@ -584,7 +590,9 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
else {
printf ("\nUSB device %d: ", usb_stor_curr_dev);
stor_dev=usb_stor_get_dev(usb_stor_curr_dev);
- dev_print(stor_dev);
+#warning dev_print missing
+ printf("call dev_print\n");
+// dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN) {
return 1;
}
@@ -592,18 +600,12 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
}
return 0;
}
-#endif /* CONFIG_USB_STORAGE */
+#endif /* CONFIG_DRIVER_USB_MASS_STORAGE */
printf ("Usage:\n%s\n", cmdtp->usage);
return 1;
}
-
-#endif /* (CONFIG_COMMANDS & CFG_CMD_USB) */
-
-
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
-
-#ifdef CONFIG_USB_STORAGE
+#ifdef CONFIG_DRIVER_USB_MASS_STORAGE
U_BOOT_CMD(
usb, 5, 1, do_usb,
"usb - USB sub-system\n",
@@ -634,4 +636,4 @@ U_BOOT_CMD(
"usb info [dev] - show available USB devices\n"
);
#endif
-#endif
+
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
new file mode 100644
index 0000000000..830209dcfd
--- /dev/null
+++ b/drivers/usb/host/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_DRIVER_USB_HOST_OHCI) += usb_ohci.o
diff --git a/drivers/usb/host/usb_ohci.c b/drivers/usb/host/usb_ohci.c
index 70cb6a3846..eacfb0950f 100644
--- a/drivers/usb/host/usb_ohci.c
+++ b/drivers/usb/host/usb_ohci.c
@@ -43,8 +43,6 @@
#include <common.h>
/* #include <pci.h> no PCI on the S3C24X0 */
-#ifdef CONFIG_USB_OHCI_NEW
-
/* mk: are these really required? */
#if defined(CONFIG_S3C2400)
# include <s3c2400.h>
@@ -84,7 +82,7 @@
#define min_t(type,x,y) ({ type __x = (x); type __y = (y); __x < __y ? __x: __y; })
-#undef DEBUG
+#define DEBUG
#ifdef DEBUG
#define dbg(format, arg...) printf("DEBUG: " format "\n", ## arg)
#else
@@ -877,7 +875,7 @@ static int dl_done_list (ohci_t *ohci, td_t *td_list)
/* see if this done list makes for all TD's of current URB,
* and mark the URB finished if so */
if (++(lurb_priv->td_cnt) == lurb_priv->length) {
-#if 1
+#if 0
if ((ed->state & (ED_OPER | ED_UNLINK)) &&
(lurb_priv->state != URB_DEL))
#else
@@ -889,6 +887,7 @@ static int dl_done_list (ohci_t *ohci, td_t *td_list)
dbg("dl_done_list: processing TD %x, len %x\n", lurb_priv->td_cnt,
lurb_priv->length);
#endif
+
if (ed->state != ED_NEW) {
edHeadP = m32_swap (ed->hwHeadP) & 0xfffffff0;
edTailP = m32_swap (ed->hwTailP);
@@ -1635,6 +1634,11 @@ static char ohci_inited = 0;
int usb_lowlevel_init(void)
{
+ /* FIXME */
+ /* Enable USB host clock. */
+ *AT91C_PMC_SCER = AT91C_PMC_UHP; /* 48MHz clock enabled for UHP */
+ *AT91C_PMC_PCER = 1 << AT91C_ID_UHP; /* Peripheral Clock Enable Register */
+
#ifdef CFG_USB_OHCI_CPU_INIT
/* cpu dependant init */
if(usb_cpu_init())
@@ -1746,4 +1750,4 @@ int usb_lowlevel_stop(void)
return 0;
}
-#endif /* CONFIG_USB_OHCI_NEW */
+
diff --git a/drivers/usb/usb.c b/drivers/usb/usb.c
index 0857494b27..644d82c8ad 100644
--- a/drivers/usb/usb.c
+++ b/drivers/usb/usb.c
@@ -49,8 +49,6 @@
#include <asm/processor.h>
#include <linux/ctype.h>
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
-
#include <usb.h>
#ifdef CONFIG_4xx
#include <405gp_pci.h>
@@ -727,7 +725,7 @@ int usb_new_device(struct usb_device *dev)
addr = dev->devnum;
dev->devnum = 0;
-#undef NEW_INIT_SEQ
+#define NEW_INIT_SEQ
#ifdef NEW_INIT_SEQ
/* this is a Windows scheme of initialization sequence, with double
* reset of the device. Some equipment is said to work only with such
@@ -961,7 +959,7 @@ struct usb_hub_device *usb_hub_allocate(void)
#define MAX_TRIES 5
-static int hub_port_reset(struct usb_device *dev, int port,
+int hub_port_reset(struct usb_device *dev, int port,
unsigned short *portstat)
{
int tries;
@@ -1247,6 +1245,3 @@ int usb_hub_probe(struct usb_device *dev, int ifnum)
return ret;
}
-#endif /* (CONFIG_COMMANDS & CFG_CMD_USB) */
-
-/* EOF */
diff --git a/drivers/usb/usb_storage.c b/drivers/usb/usb_storage.c
index e021b13471..3f9be2ed80 100644
--- a/drivers/usb/usb_storage.c
+++ b/drivers/usb/usb_storage.c
@@ -55,11 +55,8 @@
#include <asm/processor.h>
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
#include <usb.h>
-#ifdef CONFIG_USB_STORAGE
-
#undef USB_STOR_DEBUG
#undef BBB_COMDAT_TRACE
#undef BBB_XPORT_TRACE
@@ -194,7 +191,9 @@ void usb_stor_info(void)
if (usb_max_devs > 0)
for (i = 0; i < usb_max_devs; i++) {
printf (" Device %d: ", i);
- dev_print(&usb_dev_desc[i]);
+#warning dev_print missing
+ printf("call dev_print\n");
+// dev_print(&usb_dev_desc[i]);
}
else
printf("No storage devices, perhaps not 'usb start'ed..?\n");
@@ -1228,11 +1227,11 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t
USB_STOR_PRINTF(" address %d\n",dev_desc->target);
USB_STOR_PRINTF("partype: %d\n",dev_desc->part_type);
- init_part(dev_desc);
+ printf("init_part\n");
+#warning init_part missing
+// init_part(dev_desc);
USB_STOR_PRINTF("partype: %d\n",dev_desc->part_type);
return 1;
}
-#endif /* CONFIG_USB_STORAGE */
-#endif /* CFG_CMD_USB */