diff --git a/include/grub/cs5536.h b/include/grub/cs5536.h index c2323fe9b..218e17d1a 100644 --- a/include/grub/cs5536.h +++ b/include/grub/cs5536.h @@ -39,6 +39,11 @@ #define GRUB_CS5536_PM_REGS_SIZE 128 #define GRUB_CS5536_ACPI_REGS_SIZE 32 +#define GRUB_CS5536_USB_OPTION_REGS_SIZE 0x1c +#define GRUB_CS5536_USB_OPTION_REG_UOCMUX 1 +#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK 0x03 +#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC 0x02 + #define GRUB_CS5536_DESTINATION_GLIU 0 #define GRUB_CS5536_DESTINATION_GLPCI_SB 1 #define GRUB_CS5536_DESTINATION_USB 2 @@ -78,9 +83,11 @@ #define GRUB_CS5536_MSR_USB_EHCI_BASE 0x40000009 #define GRUB_CS5536_MSR_USB_CONTROLLER_BASE 0x4000000a #define GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE 0x4000000b -#define GRUB_CS5536_MSR_USB_BASE_ADDR_MASK 0xffffff00 -#define GRUB_CS5536_MSR_USB_BASE_BUS_MASTER 0x400000000ULL -#define GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE 0x200000000ULL +#define GRUB_CS5536_MSR_USB_BASE_ADDR_MASK 0x00ffffff00ULL +#define GRUB_CS5536_MSR_USB_BASE_BUS_MASTER 0x0400000000ULL +#define GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE 0x0200000000ULL +#define GRUB_CS5536_MSR_USB_BASE_PME_ENABLED 0x0800000000ULL +#define GRUB_CS5536_MSR_USB_BASE_PME_STATUS 0x1000000000ULL #define GRUB_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT 40 #define GRUB_CS5536_MSR_IDE_IO_BAR 0x60000008 diff --git a/kern/mips/yeeloong/init.c b/kern/mips/yeeloong/init.c index cf241ea96..5c3340f39 100644 --- a/kern/mips/yeeloong/init.c +++ b/kern/mips/yeeloong/init.c @@ -239,6 +239,19 @@ grub_machine_init (void) set_p2d (dev, 5, GRUB_CS5536_DESTINATION_USB, 0x05024000); set_p2d (dev, 6, GRUB_CS5536_DESTINATION_USB, 0x05023000); + { + volatile grub_uint32_t *oc; + oc = grub_pci_device_map_range (dev, 0x05022000, + GRUB_CS5536_USB_OPTION_REGS_SIZE); + + oc[GRUB_CS5536_USB_OPTION_REG_UOCMUX] = + (oc[GRUB_CS5536_USB_OPTION_REG_UOCMUX] + & ~GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK) + | GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC; + grub_pci_device_unmap_range (dev, oc, GRUB_CS5536_USB_OPTION_REGS_SIZE); + } + + /* Setup IDE controller. */ grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_IO_BAR, GRUB_CS5536_LBAR_IDE