18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * arch/arm/mach-spear3xx/spear3xx.c 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * SPEAr3XX machines common source file 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2009-2012 ST Microelectronics 78c2ecf20Sopenharmony_ci * Viresh Kumar <vireshk@kernel.org> 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This file is licensed under the terms of the GNU General Public 108c2ecf20Sopenharmony_ci * License version 2. This program is licensed "as is" without any 118c2ecf20Sopenharmony_ci * warranty of any kind, whether express or implied. 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#define pr_fmt(fmt) "SPEAr3xx: " fmt 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/amba/pl022.h> 178c2ecf20Sopenharmony_ci#include <linux/amba/pl080.h> 188c2ecf20Sopenharmony_ci#include <linux/clk.h> 198c2ecf20Sopenharmony_ci#include <linux/io.h> 208c2ecf20Sopenharmony_ci#include <asm/mach/map.h> 218c2ecf20Sopenharmony_ci#include "pl080.h" 228c2ecf20Sopenharmony_ci#include "generic.h" 238c2ecf20Sopenharmony_ci#include <mach/spear.h> 248c2ecf20Sopenharmony_ci#include <mach/misc_regs.h> 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* ssp device registration */ 278c2ecf20Sopenharmony_cistruct pl022_ssp_controller pl022_plat_data = { 288c2ecf20Sopenharmony_ci .bus_id = 0, 298c2ecf20Sopenharmony_ci .enable_dma = 1, 308c2ecf20Sopenharmony_ci .dma_filter = pl08x_filter_id, 318c2ecf20Sopenharmony_ci .dma_tx_param = "ssp0_tx", 328c2ecf20Sopenharmony_ci .dma_rx_param = "ssp0_rx", 338c2ecf20Sopenharmony_ci /* 348c2ecf20Sopenharmony_ci * This is number of spi devices that can be connected to spi. There are 358c2ecf20Sopenharmony_ci * two type of chipselects on which slave devices can work. One is chip 368c2ecf20Sopenharmony_ci * select provided by spi masters other is controlled through external 378c2ecf20Sopenharmony_ci * gpio's. We can't use chipselect provided from spi master (because as 388c2ecf20Sopenharmony_ci * soon as FIFO becomes empty, CS is disabled and transfer ends). So 398c2ecf20Sopenharmony_ci * this number now depends on number of gpios available for spi. each 408c2ecf20Sopenharmony_ci * slave on each master requires a separate gpio pin. 418c2ecf20Sopenharmony_ci */ 428c2ecf20Sopenharmony_ci .num_chipselect = 2, 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* dmac device registration */ 468c2ecf20Sopenharmony_cistruct pl08x_platform_data pl080_plat_data = { 478c2ecf20Sopenharmony_ci .memcpy_burst_size = PL08X_BURST_SZ_16, 488c2ecf20Sopenharmony_ci .memcpy_bus_width = PL08X_BUS_WIDTH_32_BITS, 498c2ecf20Sopenharmony_ci .memcpy_prot_buff = true, 508c2ecf20Sopenharmony_ci .memcpy_prot_cache = true, 518c2ecf20Sopenharmony_ci .lli_buses = PL08X_AHB1, 528c2ecf20Sopenharmony_ci .mem_buses = PL08X_AHB1, 538c2ecf20Sopenharmony_ci .get_xfer_signal = pl080_get_signal, 548c2ecf20Sopenharmony_ci .put_xfer_signal = pl080_put_signal, 558c2ecf20Sopenharmony_ci}; 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* 588c2ecf20Sopenharmony_ci * Following will create 16MB static virtual/physical mappings 598c2ecf20Sopenharmony_ci * PHYSICAL VIRTUAL 608c2ecf20Sopenharmony_ci * 0xD0000000 0xFD000000 618c2ecf20Sopenharmony_ci * 0xFC000000 0xFC000000 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_cistruct map_desc spear3xx_io_desc[] __initdata = { 648c2ecf20Sopenharmony_ci { 658c2ecf20Sopenharmony_ci .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE, 668c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE), 678c2ecf20Sopenharmony_ci .length = SZ_16M, 688c2ecf20Sopenharmony_ci .type = MT_DEVICE 698c2ecf20Sopenharmony_ci }, { 708c2ecf20Sopenharmony_ci .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE, 718c2ecf20Sopenharmony_ci .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE), 728c2ecf20Sopenharmony_ci .length = SZ_16M, 738c2ecf20Sopenharmony_ci .type = MT_DEVICE 748c2ecf20Sopenharmony_ci }, 758c2ecf20Sopenharmony_ci}; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* This will create static memory mapping for selected devices */ 788c2ecf20Sopenharmony_civoid __init spear3xx_map_io(void) 798c2ecf20Sopenharmony_ci{ 808c2ecf20Sopenharmony_ci iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc)); 818c2ecf20Sopenharmony_ci} 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_civoid __init spear3xx_timer_init(void) 848c2ecf20Sopenharmony_ci{ 858c2ecf20Sopenharmony_ci char pclk_name[] = "pll3_clk"; 868c2ecf20Sopenharmony_ci struct clk *gpt_clk, *pclk; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci spear3xx_clk_init(MISC_BASE, VA_SPEAR320_SOC_CONFIG_BASE); 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci /* get the system timer clock */ 918c2ecf20Sopenharmony_ci gpt_clk = clk_get_sys("gpt0", NULL); 928c2ecf20Sopenharmony_ci if (IS_ERR(gpt_clk)) { 938c2ecf20Sopenharmony_ci pr_err("%s:couldn't get clk for gpt\n", __func__); 948c2ecf20Sopenharmony_ci BUG(); 958c2ecf20Sopenharmony_ci } 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci /* get the suitable parent clock for timer*/ 988c2ecf20Sopenharmony_ci pclk = clk_get(NULL, pclk_name); 998c2ecf20Sopenharmony_ci if (IS_ERR(pclk)) { 1008c2ecf20Sopenharmony_ci pr_err("%s:couldn't get %s as parent for gpt\n", 1018c2ecf20Sopenharmony_ci __func__, pclk_name); 1028c2ecf20Sopenharmony_ci BUG(); 1038c2ecf20Sopenharmony_ci } 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci clk_set_parent(gpt_clk, pclk); 1068c2ecf20Sopenharmony_ci clk_put(gpt_clk); 1078c2ecf20Sopenharmony_ci clk_put(pclk); 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci spear_setup_of_timer(); 1108c2ecf20Sopenharmony_ci} 111