1a7ed099fSArnd Bergmann /* 2a7ed099fSArnd Bergmann * arch/arm/mach-spear3xx/spear3xx.c 3a7ed099fSArnd Bergmann * 4a7ed099fSArnd Bergmann * SPEAr3XX machines common source file 5a7ed099fSArnd Bergmann * 6a7ed099fSArnd Bergmann * Copyright (C) 2009-2012 ST Microelectronics 7a7ed099fSArnd Bergmann * Viresh Kumar <viresh.linux@gmail.com> 8a7ed099fSArnd Bergmann * 9a7ed099fSArnd Bergmann * This file is licensed under the terms of the GNU General Public 10a7ed099fSArnd Bergmann * License version 2. This program is licensed "as is" without any 11a7ed099fSArnd Bergmann * warranty of any kind, whether express or implied. 12a7ed099fSArnd Bergmann */ 13a7ed099fSArnd Bergmann 14a7ed099fSArnd Bergmann #define pr_fmt(fmt) "SPEAr3xx: " fmt 15a7ed099fSArnd Bergmann 16a7ed099fSArnd Bergmann #include <linux/amba/pl022.h> 17a7ed099fSArnd Bergmann #include <linux/amba/pl080.h> 18a7ed099fSArnd Bergmann #include <linux/clk.h> 19a7ed099fSArnd Bergmann #include <linux/io.h> 20a7ed099fSArnd Bergmann #include <asm/mach/map.h> 212b9c613cSArnd Bergmann #include "pl080.h" 222b9c613cSArnd Bergmann #include "generic.h" 23a7ed099fSArnd Bergmann #include <mach/spear.h> 24*d9909ebeSArnd Bergmann #include <mach/misc_regs.h> 25a7ed099fSArnd Bergmann 26a7ed099fSArnd Bergmann /* ssp device registration */ 27a7ed099fSArnd Bergmann struct pl022_ssp_controller pl022_plat_data = { 28a7ed099fSArnd Bergmann .bus_id = 0, 29a7ed099fSArnd Bergmann .enable_dma = 1, 30a7ed099fSArnd Bergmann .dma_filter = pl08x_filter_id, 31a7ed099fSArnd Bergmann .dma_tx_param = "ssp0_tx", 32a7ed099fSArnd Bergmann .dma_rx_param = "ssp0_rx", 33a7ed099fSArnd Bergmann /* 34a7ed099fSArnd Bergmann * This is number of spi devices that can be connected to spi. There are 35a7ed099fSArnd Bergmann * two type of chipselects on which slave devices can work. One is chip 36a7ed099fSArnd Bergmann * select provided by spi masters other is controlled through external 37a7ed099fSArnd Bergmann * gpio's. We can't use chipselect provided from spi master (because as 38a7ed099fSArnd Bergmann * soon as FIFO becomes empty, CS is disabled and transfer ends). So 39a7ed099fSArnd Bergmann * this number now depends on number of gpios available for spi. each 40a7ed099fSArnd Bergmann * slave on each master requires a separate gpio pin. 41a7ed099fSArnd Bergmann */ 42a7ed099fSArnd Bergmann .num_chipselect = 2, 43a7ed099fSArnd Bergmann }; 44a7ed099fSArnd Bergmann 45a7ed099fSArnd Bergmann /* dmac device registration */ 46a7ed099fSArnd Bergmann struct pl08x_platform_data pl080_plat_data = { 47a7ed099fSArnd Bergmann .memcpy_channel = { 48a7ed099fSArnd Bergmann .bus_id = "memcpy", 49a7ed099fSArnd Bergmann .cctl_memcpy = 50a7ed099fSArnd Bergmann (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \ 51a7ed099fSArnd Bergmann PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \ 52a7ed099fSArnd Bergmann PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \ 53a7ed099fSArnd Bergmann PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \ 54a7ed099fSArnd Bergmann PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \ 55a7ed099fSArnd Bergmann PL080_CONTROL_PROT_SYS), 56a7ed099fSArnd Bergmann }, 57a7ed099fSArnd Bergmann .lli_buses = PL08X_AHB1, 58a7ed099fSArnd Bergmann .mem_buses = PL08X_AHB1, 59a7ed099fSArnd Bergmann .get_signal = pl080_get_signal, 60a7ed099fSArnd Bergmann .put_signal = pl080_put_signal, 61a7ed099fSArnd Bergmann }; 62a7ed099fSArnd Bergmann 63a7ed099fSArnd Bergmann /* 64a7ed099fSArnd Bergmann * Following will create 16MB static virtual/physical mappings 65a7ed099fSArnd Bergmann * PHYSICAL VIRTUAL 66a7ed099fSArnd Bergmann * 0xD0000000 0xFD000000 67a7ed099fSArnd Bergmann * 0xFC000000 0xFC000000 68a7ed099fSArnd Bergmann */ 69a7ed099fSArnd Bergmann struct map_desc spear3xx_io_desc[] __initdata = { 70a7ed099fSArnd Bergmann { 71*d9909ebeSArnd Bergmann .virtual = (unsigned long)VA_SPEAR_ICM1_2_BASE, 72a7ed099fSArnd Bergmann .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE), 73a7ed099fSArnd Bergmann .length = SZ_16M, 74a7ed099fSArnd Bergmann .type = MT_DEVICE 75a7ed099fSArnd Bergmann }, { 76*d9909ebeSArnd Bergmann .virtual = (unsigned long)VA_SPEAR_ICM3_SMI_CTRL_BASE, 77a7ed099fSArnd Bergmann .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE), 78a7ed099fSArnd Bergmann .length = SZ_16M, 79a7ed099fSArnd Bergmann .type = MT_DEVICE 80a7ed099fSArnd Bergmann }, 81a7ed099fSArnd Bergmann }; 82a7ed099fSArnd Bergmann 83a7ed099fSArnd Bergmann /* This will create static memory mapping for selected devices */ 84a7ed099fSArnd Bergmann void __init spear3xx_map_io(void) 85a7ed099fSArnd Bergmann { 86a7ed099fSArnd Bergmann iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc)); 87a7ed099fSArnd Bergmann } 88a7ed099fSArnd Bergmann 89a7ed099fSArnd Bergmann void __init spear3xx_timer_init(void) 90a7ed099fSArnd Bergmann { 91a7ed099fSArnd Bergmann char pclk_name[] = "pll3_clk"; 92a7ed099fSArnd Bergmann struct clk *gpt_clk, *pclk; 93a7ed099fSArnd Bergmann 94*d9909ebeSArnd Bergmann spear3xx_clk_init(MISC_BASE, VA_SPEAR320_SOC_CONFIG_BASE); 95a7ed099fSArnd Bergmann 96a7ed099fSArnd Bergmann /* get the system timer clock */ 97a7ed099fSArnd Bergmann gpt_clk = clk_get_sys("gpt0", NULL); 98a7ed099fSArnd Bergmann if (IS_ERR(gpt_clk)) { 99a7ed099fSArnd Bergmann pr_err("%s:couldn't get clk for gpt\n", __func__); 100a7ed099fSArnd Bergmann BUG(); 101a7ed099fSArnd Bergmann } 102a7ed099fSArnd Bergmann 103a7ed099fSArnd Bergmann /* get the suitable parent clock for timer*/ 104a7ed099fSArnd Bergmann pclk = clk_get(NULL, pclk_name); 105a7ed099fSArnd Bergmann if (IS_ERR(pclk)) { 106a7ed099fSArnd Bergmann pr_err("%s:couldn't get %s as parent for gpt\n", 107a7ed099fSArnd Bergmann __func__, pclk_name); 108a7ed099fSArnd Bergmann BUG(); 109a7ed099fSArnd Bergmann } 110a7ed099fSArnd Bergmann 111a7ed099fSArnd Bergmann clk_set_parent(gpt_clk, pclk); 112a7ed099fSArnd Bergmann clk_put(gpt_clk); 113a7ed099fSArnd Bergmann clk_put(pclk); 114a7ed099fSArnd Bergmann 115a7ed099fSArnd Bergmann spear_setup_of_timer(); 116a7ed099fSArnd Bergmann } 117