1*c2952e27SDavid Lechner // SPDX-License-Identifier: GPL-2.0 2*c2952e27SDavid Lechner /* 3*c2952e27SDavid Lechner * PSC clock descriptions for TI DA830/OMAP-L137/AM17XX 4*c2952e27SDavid Lechner * 5*c2952e27SDavid Lechner * Copyright (C) 2018 David Lechner <david@lechnology.com> 6*c2952e27SDavid Lechner */ 7*c2952e27SDavid Lechner 8*c2952e27SDavid Lechner #include <linux/clk-provider.h> 9*c2952e27SDavid Lechner #include <linux/clk.h> 10*c2952e27SDavid Lechner #include <linux/clkdev.h> 11*c2952e27SDavid Lechner #include <linux/init.h> 12*c2952e27SDavid Lechner #include <linux/kernel.h> 13*c2952e27SDavid Lechner #include <linux/types.h> 14*c2952e27SDavid Lechner 15*c2952e27SDavid Lechner #include "psc.h" 16*c2952e27SDavid Lechner 17*c2952e27SDavid Lechner LPSC_CLKDEV1(spi0_clkdev, NULL, "spi_davinci.0"); 18*c2952e27SDavid Lechner LPSC_CLKDEV1(mmcsd_clkdev, NULL, "da830-mmc.0"); 19*c2952e27SDavid Lechner LPSC_CLKDEV1(uart0_clkdev, NULL, "serial8250.0"); 20*c2952e27SDavid Lechner 21*c2952e27SDavid Lechner static const struct davinci_lpsc_clk_info da830_psc0_info[] = { 22*c2952e27SDavid Lechner LPSC(0, 0, tpcc, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 23*c2952e27SDavid Lechner LPSC(1, 0, tptc0, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 24*c2952e27SDavid Lechner LPSC(2, 0, tptc1, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 25*c2952e27SDavid Lechner LPSC(3, 0, aemif, pll0_sysclk3, NULL, LPSC_ALWAYS_ENABLED), 26*c2952e27SDavid Lechner LPSC(4, 0, spi0, pll0_sysclk2, spi0_clkdev, 0), 27*c2952e27SDavid Lechner LPSC(5, 0, mmcsd, pll0_sysclk2, mmcsd_clkdev, 0), 28*c2952e27SDavid Lechner LPSC(6, 0, aintc, pll0_sysclk4, NULL, LPSC_ALWAYS_ENABLED), 29*c2952e27SDavid Lechner LPSC(7, 0, arm_rom, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 30*c2952e27SDavid Lechner LPSC(8, 0, secu_mgr, pll0_sysclk4, NULL, LPSC_ALWAYS_ENABLED), 31*c2952e27SDavid Lechner LPSC(9, 0, uart0, pll0_sysclk2, uart0_clkdev, 0), 32*c2952e27SDavid Lechner LPSC(10, 0, scr0_ss, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 33*c2952e27SDavid Lechner LPSC(11, 0, scr1_ss, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 34*c2952e27SDavid Lechner LPSC(12, 0, scr2_ss, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 35*c2952e27SDavid Lechner LPSC(13, 0, pruss, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 36*c2952e27SDavid Lechner LPSC(14, 0, arm, pll0_sysclk6, NULL, LPSC_ALWAYS_ENABLED), 37*c2952e27SDavid Lechner { } 38*c2952e27SDavid Lechner }; 39*c2952e27SDavid Lechner 40*c2952e27SDavid Lechner static int da830_psc0_init(struct device *dev, void __iomem *base) 41*c2952e27SDavid Lechner { 42*c2952e27SDavid Lechner return davinci_psc_register_clocks(dev, da830_psc0_info, 16, base); 43*c2952e27SDavid Lechner } 44*c2952e27SDavid Lechner 45*c2952e27SDavid Lechner static struct clk_bulk_data da830_psc0_parent_clks[] = { 46*c2952e27SDavid Lechner { .id = "pll0_sysclk2" }, 47*c2952e27SDavid Lechner { .id = "pll0_sysclk3" }, 48*c2952e27SDavid Lechner { .id = "pll0_sysclk4" }, 49*c2952e27SDavid Lechner { .id = "pll0_sysclk6" }, 50*c2952e27SDavid Lechner }; 51*c2952e27SDavid Lechner 52*c2952e27SDavid Lechner const struct davinci_psc_init_data da830_psc0_init_data = { 53*c2952e27SDavid Lechner .parent_clks = da830_psc0_parent_clks, 54*c2952e27SDavid Lechner .num_parent_clks = ARRAY_SIZE(da830_psc0_parent_clks), 55*c2952e27SDavid Lechner .psc_init = &da830_psc0_init, 56*c2952e27SDavid Lechner }; 57*c2952e27SDavid Lechner 58*c2952e27SDavid Lechner LPSC_CLKDEV2(usb0_clkdev, NULL, "musb-da8xx", 59*c2952e27SDavid Lechner NULL, "cppi41-dmaengine"); 60*c2952e27SDavid Lechner LPSC_CLKDEV1(usb1_clkdev, NULL, "ohci-da8xx"); 61*c2952e27SDavid Lechner /* REVISIT: gpio-davinci.c should be modified to drop con_id */ 62*c2952e27SDavid Lechner LPSC_CLKDEV1(gpio_clkdev, "gpio", NULL); 63*c2952e27SDavid Lechner LPSC_CLKDEV2(emac_clkdev, NULL, "davinci_emac.1", 64*c2952e27SDavid Lechner "fck", "davinci_mdio.0"); 65*c2952e27SDavid Lechner LPSC_CLKDEV1(mcasp0_clkdev, NULL, "davinci-mcasp.0"); 66*c2952e27SDavid Lechner LPSC_CLKDEV1(mcasp1_clkdev, NULL, "davinci-mcasp.1"); 67*c2952e27SDavid Lechner LPSC_CLKDEV1(mcasp2_clkdev, NULL, "davinci-mcasp.2"); 68*c2952e27SDavid Lechner LPSC_CLKDEV1(spi1_clkdev, NULL, "spi_davinci.1"); 69*c2952e27SDavid Lechner LPSC_CLKDEV1(i2c1_clkdev, NULL, "i2c_davinci.2"); 70*c2952e27SDavid Lechner LPSC_CLKDEV1(uart1_clkdev, NULL, "serial8250.1"); 71*c2952e27SDavid Lechner LPSC_CLKDEV1(uart2_clkdev, NULL, "serial8250.2"); 72*c2952e27SDavid Lechner LPSC_CLKDEV1(lcdc_clkdev, "fck", "da8xx_lcdc.0"); 73*c2952e27SDavid Lechner LPSC_CLKDEV2(pwm_clkdev, "fck", "ehrpwm.0", 74*c2952e27SDavid Lechner "fck", "ehrpwm.1"); 75*c2952e27SDavid Lechner LPSC_CLKDEV3(ecap_clkdev, "fck", "ecap.0", 76*c2952e27SDavid Lechner "fck", "ecap.1", 77*c2952e27SDavid Lechner "fck", "ecap.2"); 78*c2952e27SDavid Lechner LPSC_CLKDEV2(eqep_clkdev, NULL, "eqep.0", 79*c2952e27SDavid Lechner NULL, "eqep.1"); 80*c2952e27SDavid Lechner 81*c2952e27SDavid Lechner static const struct davinci_lpsc_clk_info da830_psc1_info[] = { 82*c2952e27SDavid Lechner LPSC(1, 0, usb0, pll0_sysclk2, usb0_clkdev, 0), 83*c2952e27SDavid Lechner LPSC(2, 0, usb1, pll0_sysclk4, usb1_clkdev, 0), 84*c2952e27SDavid Lechner LPSC(3, 0, gpio, pll0_sysclk4, gpio_clkdev, 0), 85*c2952e27SDavid Lechner LPSC(5, 0, emac, pll0_sysclk4, emac_clkdev, 0), 86*c2952e27SDavid Lechner LPSC(6, 0, emif3, pll0_sysclk5, NULL, LPSC_ALWAYS_ENABLED), 87*c2952e27SDavid Lechner LPSC(7, 0, mcasp0, pll0_sysclk2, mcasp0_clkdev, 0), 88*c2952e27SDavid Lechner LPSC(8, 0, mcasp1, pll0_sysclk2, mcasp1_clkdev, 0), 89*c2952e27SDavid Lechner LPSC(9, 0, mcasp2, pll0_sysclk2, mcasp2_clkdev, 0), 90*c2952e27SDavid Lechner LPSC(10, 0, spi1, pll0_sysclk2, spi1_clkdev, 0), 91*c2952e27SDavid Lechner LPSC(11, 0, i2c1, pll0_sysclk4, i2c1_clkdev, 0), 92*c2952e27SDavid Lechner LPSC(12, 0, uart1, pll0_sysclk2, uart1_clkdev, 0), 93*c2952e27SDavid Lechner LPSC(13, 0, uart2, pll0_sysclk2, uart2_clkdev, 0), 94*c2952e27SDavid Lechner LPSC(16, 0, lcdc, pll0_sysclk2, lcdc_clkdev, 0), 95*c2952e27SDavid Lechner LPSC(17, 0, pwm, pll0_sysclk2, pwm_clkdev, 0), 96*c2952e27SDavid Lechner LPSC(20, 0, ecap, pll0_sysclk2, ecap_clkdev, 0), 97*c2952e27SDavid Lechner LPSC(21, 0, eqep, pll0_sysclk2, eqep_clkdev, 0), 98*c2952e27SDavid Lechner { } 99*c2952e27SDavid Lechner }; 100*c2952e27SDavid Lechner 101*c2952e27SDavid Lechner static int da830_psc1_init(struct device *dev, void __iomem *base) 102*c2952e27SDavid Lechner { 103*c2952e27SDavid Lechner return davinci_psc_register_clocks(dev, da830_psc1_info, 32, base); 104*c2952e27SDavid Lechner } 105*c2952e27SDavid Lechner 106*c2952e27SDavid Lechner static struct clk_bulk_data da830_psc1_parent_clks[] = { 107*c2952e27SDavid Lechner { .id = "pll0_sysclk2" }, 108*c2952e27SDavid Lechner { .id = "pll0_sysclk4" }, 109*c2952e27SDavid Lechner { .id = "pll0_sysclk5" }, 110*c2952e27SDavid Lechner }; 111*c2952e27SDavid Lechner 112*c2952e27SDavid Lechner const struct davinci_psc_init_data da830_psc1_init_data = { 113*c2952e27SDavid Lechner .parent_clks = da830_psc1_parent_clks, 114*c2952e27SDavid Lechner .num_parent_clks = ARRAY_SIZE(da830_psc1_parent_clks), 115*c2952e27SDavid Lechner .psc_init = &da830_psc1_init, 116*c2952e27SDavid Lechner }; 117