2 * SCC (Super Companion Chip) UHC setup
4 * (C) Copyright 2006-2007 TOSHIBA CORPORATION
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <linux/kernel.h>
22 #include <linux/pci.h>
24 #include <asm/delay.h>
26 #include <asm/machdep.h>
30 #define UHC_RESET_WAIT_MAX 10000
32 static inline int uhc_clkctrl_ready(u32 val)
34 const u32 mask = SCC_UHC_USBCEN | SCC_UHC_USBCEN;
35 return((val & mask) == mask);
39 * UHC(usb host controler) enable function.
40 * affect to both of OHCI and EHCI core module.
42 static void enable_scc_uhc(struct pci_dev *dev)
44 void __iomem *uhc_base;
45 u32 __iomem *uhc_clkctrl;
46 u32 __iomem *uhc_ecmode;
50 if (!machine_is(celleb))
53 uhc_base = ioremap(pci_resource_start(dev, 0),
54 pci_resource_len(dev, 0));
56 printk(KERN_ERR "failed to map UHC register base.\n");
59 uhc_clkctrl = uhc_base + SCC_UHC_CKRCTRL;
60 uhc_ecmode = uhc_base + SCC_UHC_ECMODE;
62 /* setup for normal mode */
63 val |= SCC_UHC_F48MCKLEN;
64 out_be32(uhc_clkctrl, val);
65 val |= SCC_UHC_PHY_SUSPEND_SEL;
66 out_be32(uhc_clkctrl, val);
69 out_be32(uhc_clkctrl, val);
73 val |= SCC_UHC_HCLKEN;
74 out_be32(uhc_clkctrl, val);
75 val |= (SCC_UHC_USBCEN | SCC_UHC_USBEN);
76 out_be32(uhc_clkctrl, val);
78 while (!uhc_clkctrl_ready(in_be32(uhc_clkctrl))) {
80 if (i++ > UHC_RESET_WAIT_MAX) {
81 printk(KERN_ERR "Failed to disable UHC reset %x\n",
82 in_be32(uhc_clkctrl));
87 /* Endian Conversion Mode for Master ALL area */
88 out_be32(uhc_ecmode, SCC_UHC_ECMODE_BY_BYTE);
93 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA_2,
94 PCI_DEVICE_ID_TOSHIBA_SCC_USB, enable_scc_uhc);