Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * arch/arm/mach-spear3xx/spear3xx.c
0004  *
0005  * SPEAr3XX machines common source file
0006  *
0007  * Copyright (C) 2009-2012 ST Microelectronics
0008  * Viresh Kumar <vireshk@kernel.org>
0009  */
0010 
0011 #define pr_fmt(fmt) "SPEAr3xx: " fmt
0012 
0013 #include <linux/amba/pl022.h>
0014 #include <linux/amba/pl080.h>
0015 #include <linux/clk.h>
0016 #include <linux/io.h>
0017 #include <asm/mach/map.h>
0018 #include "pl080.h"
0019 #include "generic.h"
0020 #include "spear.h"
0021 #include "misc_regs.h"
0022 
0023 /* ssp device registration */
0024 struct pl022_ssp_controller pl022_plat_data = {
0025     .bus_id = 0,
0026     .enable_dma = 1,
0027     .dma_filter = pl08x_filter_id,
0028     .dma_tx_param = "ssp0_tx",
0029     .dma_rx_param = "ssp0_rx",
0030 };
0031 
0032 /* dmac device registration */
0033 struct pl08x_platform_data pl080_plat_data = {
0034     .memcpy_burst_size = PL08X_BURST_SZ_16,
0035     .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS,
0036     .memcpy_prot_buff = true,
0037     .memcpy_prot_cache = true,
0038     .lli_buses = PL08X_AHB1,
0039     .mem_buses = PL08X_AHB1,
0040     .get_xfer_signal = pl080_get_signal,
0041     .put_xfer_signal = pl080_put_signal,
0042 };
0043 
0044 /*
0045  * Following will create 16MB static virtual/physical mappings
0046  * PHYSICAL     VIRTUAL
0047  * 0xD0000000       0xFD000000
0048  * 0xFC000000       0xFC000000
0049  */
0050 struct map_desc spear3xx_io_desc[] __initdata = {
0051     {
0052         .virtual    = (unsigned long)VA_SPEAR_ICM1_2_BASE,
0053         .pfn        = __phys_to_pfn(SPEAR_ICM1_2_BASE),
0054         .length     = SZ_16M,
0055         .type       = MT_DEVICE
0056     }, {
0057         .virtual    = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE,
0058         .pfn        = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE),
0059         .length     = SZ_16M,
0060         .type       = MT_DEVICE
0061     },
0062 };
0063 
0064 /* This will create static memory mapping for selected devices */
0065 void __init spear3xx_map_io(void)
0066 {
0067     iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc));
0068 }
0069 
0070 void __init spear3xx_timer_init(void)
0071 {
0072     char pclk_name[] = "pll3_clk";
0073     struct clk *gpt_clk, *pclk;
0074 
0075     spear3xx_clk_init(MISC_BASE, VA_SPEAR320_SOC_CONFIG_BASE);
0076 
0077     /* get the system timer clock */
0078     gpt_clk = clk_get_sys("gpt0", NULL);
0079     if (IS_ERR(gpt_clk)) {
0080         pr_err("%s:couldn't get clk for gpt\n", __func__);
0081         BUG();
0082     }
0083 
0084     /* get the suitable parent clock for timer*/
0085     pclk = clk_get(NULL, pclk_name);
0086     if (IS_ERR(pclk)) {
0087         pr_err("%s:couldn't get %s as parent for gpt\n",
0088                 __func__, pclk_name);
0089         BUG();
0090     }
0091 
0092     clk_set_parent(gpt_clk, pclk);
0093     clk_put(gpt_clk);
0094     clk_put(pclk);
0095 
0096     spear_setup_of_timer();
0097 }