[brcm63xx] fix SPI register switch and prepare for UDC, thanks to Henk Vergonet ...
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / files / arch / mips / bcm63xx / clk.c
index ae1f41f..ce93c30 100644 (file)
@@ -136,6 +136,26 @@ static struct clk clk_usbh = {
        .set    = usbh_set,
 };
 
+/*
+ * USB slave clock
+ */
+static void usbs_set(struct clk *clk, int enable)
+{
+       u32 mask;
+
+       switch(bcm63xx_get_cpu_id()) {
+       case BCM6338_CPU_ID: mask = CKCTL_6338_USBS_EN; break;
+       case BCM6348_CPU_ID: mask = CKCTL_6348_USBS_EN; break;
+       default:
+               return;
+       }
+       bcm_hwclock_set(mask, enable);
+}
+
+static struct clk clk_usbs = {
+       .set    = usbs_set,
+};
+
 /*
  * SPI clock
  */
@@ -202,6 +222,8 @@ struct clk *clk_get(struct device *dev, const char *id)
                return &clk_ephy;
        if (!strcmp(id, "usbh"))
                return &clk_usbh;
+       if (!strcmp(id, "usbs"))
+               return &clk_usbs;
        if (!strcmp(id, "spi"))
                return &clk_spi;
        if (!strcmp(id, "periph"))