1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> 4 */ 5 6 #include <linux/bitops.h> 7 #include <linux/io.h> 8 9 #include "../init.h" 10 #include "../sc-regs.h" 11 12 void uniphier_pxs2_clk_init(void) 13 { 14 u32 tmp; 15 16 /* deassert reset */ 17 tmp = readl(SC_RSTCTRL); 18 #ifdef CONFIG_USB_DWC3_UNIPHIER 19 tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_GIO; 20 #endif 21 #ifdef CONFIG_NAND_DENALI 22 tmp |= SC_RSTCTRL_NRST_NAND; 23 #endif 24 writel(tmp, SC_RSTCTRL); 25 readl(SC_RSTCTRL); /* dummy read */ 26 27 #ifdef CONFIG_USB_DWC3_UNIPHIER 28 tmp = readl(SC_RSTCTRL2); 29 tmp |= SC_RSTCTRL2_NRST_USB3B1; 30 writel(tmp, SC_RSTCTRL2); 31 readl(SC_RSTCTRL2); /* dummy read */ 32 33 tmp = readl(SC_RSTCTRL6); 34 tmp |= 0x37; 35 writel(tmp, SC_RSTCTRL6); 36 #endif 37 38 /* provide clocks */ 39 tmp = readl(SC_CLKCTRL); 40 #ifdef CONFIG_USB_DWC3_UNIPHIER 41 tmp |= BIT(20) | BIT(19) | SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | 42 SC_CLKCTRL_CEN_GIO; 43 #endif 44 #ifdef CONFIG_NAND_DENALI 45 tmp |= SC_CLKCTRL_CEN_NAND; 46 #endif 47 writel(tmp, SC_CLKCTRL); 48 readl(SC_CLKCTRL); /* dummy read */ 49 } 50