/*
* FIXME
*/
static void __init mmsp2_ohci_configure(void)
{
unsigned long fclk = mmsp2_get_fclk();
unsigned long aclk = mmsp2_get_aclk();
unsigned long uclk = mmsp2_get_uclk();
unsigned long f_fact = fclk / DESIRED_CLOCK;
unsigned long a_fact = aclk / DESIRED_CLOCK;
unsigned long u_fact = uclk / DESIRED_CLOCK;
unsigned long f_clk = (fclk / f_fact);
unsigned long a_clk = (aclk / a_fact);
unsigned long u_clk = (uclk / u_fact);
unsigned long f_err = abs(DESIRED_CLOCK - f_clk);
unsigned long a_err = abs(DESIRED_CLOCK - a_clk);
unsigned long u_err = abs(DESIRED_CLOCK - u_clk);
printk("f_fact = %ld, f_clk = %ld, f_err = %c%ld\n",
f_fact, f_clk, f_clk > DESIRED_CLOCK ? '+':'-', f_err);
printk("a_fact = %ld, a_clk = %ld, a_err = %c%ld\n",
a_fact, a_clk, a_clk > DESIRED_CLOCK ? '+':'-', a_err);
printk("u_fact = %ld, u_clk = %ld, u_err = %c%ld\n",
u_fact, u_clk, u_clk > DESIRED_CLOCK ? '+':'-', u_err);
/* from EBOOT */
UIRMCSET &= 0xff00;
UIRMCSET |= ((0x02) << 6) | 1;
gpio_pad_select(USB_PAD_3T, 0); // PAD3 --> USB device^M
gpio_pad_select(USB_PAD_1T, 0); // PAD1 --> USB host
#ifdef CONFIG_MMSP2_UPAD3_TO_DEVICE
gpio_pad_select(USB_PAD_3T, 1); // PAD3 --> USB device
gpio_pad_select(USB_PAD_1T, 0); // PAD1 --> USB host
#endif
udelay(11);
}
static int __init mmsp2_ohci_init(void)
{
int ret;
mmsp2_ohci_configure();
ret = hc_add_ohci((void*)(1), IRQ_USBH,
(void *)(io_p2v(0xc0004300)), 0, "usb-ohci", "mmsp2_ohci");
if((ret & 0xF0000000)==0xC0000000) {
mmsp2_ohci = (ohci_t *)ret;
ret = 0;
}
return ret;
}