X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cpu%2Fppc4xx%2Fusbdev.c;h=faf7f0878ff150f70184eff5ac4d18e37dcf9665;hb=e155c9e00b5f21a6de28479259c440ba71289d00;hp=f0901ac518d97229e1eefc2739071e5c26bc76f3;hpb=4b1d95d96a39a71eddd088bb5e0e9e699035c9bf;p=oweals%2Fu-boot.git diff --git a/cpu/ppc4xx/usbdev.c b/cpu/ppc4xx/usbdev.c index f0901ac518..faf7f0878f 100644 --- a/cpu/ppc4xx/usbdev.c +++ b/cpu/ppc4xx/usbdev.c @@ -3,11 +3,11 @@ #include #include -#ifdef CONFIG_440_EP +#if (defined(CONFIG_440EP) || defined(CONFIG_440EPX)) && defined(CONFIG_CMD_USB) #include +#include #include "usbdev.h" -#include "vecnum.h" #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 @@ -15,7 +15,7 @@ #define USB_DT_INTERFACE 0x04 #define USB_DT_ENDPOINT 0x05 -unsigned char set_value = -1; +int set_value = -1; void process_endpoints(unsigned short usb2d0_intrin) { @@ -25,7 +25,7 @@ void process_endpoints(unsigned short usb2d0_intrin) struct usb_string_descriptor usb_string_packet; struct devrequest setup_packet; unsigned int *setup_packet_pt; - unsigned char *packet_pt; + unsigned char *packet_pt = NULL; int temp, temp1; int i; @@ -35,7 +35,7 @@ void process_endpoints(unsigned short usb2d0_intrin) /*set usb address, seems to not work unless it is done in the next interrupt, so that is why it is done this way */ if (set_value != -1) - *(unsigned char *)USB2D0_FADDR_8 = set_value; + *(unsigned char *)USB2D0_FADDR_8 = (unsigned char)set_value; /*endpoint 1 */ if (usb2d0_intrin & 0x01) { @@ -186,6 +186,21 @@ int usbInt(void) return 0; } +#if defined(CONFIG_440EPX) +void usb_dev_init() +{ + printf("USB 2.0 Device init\n"); + + /*usb dev init */ + *(unsigned char *)USB2D0_POWER_8 = 0xa1; /* 2.0 */ + + /*enable interrupts */ + *(unsigned char *)USB2D0_INTRUSBE_8 = 0x0f; + + irq_install_handler(VECNUM_USBDEV, (interrupt_handler_t *) usbInt, + NULL); +} +#else void usb_dev_init() { #ifdef USB_2_0_DEVICE @@ -210,5 +225,6 @@ void usb_dev_init() irq_install_handler(VECNUM_USBDEV, (interrupt_handler_t *) usbInt, NULL); } +#endif -#endif /*CONFIG_440_EP */ +#endif /* CONFIG_440EP || CONFIG_440EPX */