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> 21*2b9c613cSArnd Bergmann #include "pl080.h" 22*2b9c613cSArnd Bergmann #include "generic.h" 23a7ed099fSArnd Bergmann #include <mach/spear.h> 24a7ed099fSArnd Bergmann 25a7ed099fSArnd Bergmann /* ssp device registration */ 26a7ed099fSArnd Bergmann struct pl022_ssp_controller pl022_plat_data = { 27a7ed099fSArnd Bergmann .bus_id = 0, 28a7ed099fSArnd Bergmann .enable_dma = 1, 29a7ed099fSArnd Bergmann .dma_filter = pl08x_filter_id, 30a7ed099fSArnd Bergmann .dma_tx_param = "ssp0_tx", 31a7ed099fSArnd Bergmann .dma_rx_param = "ssp0_rx", 32a7ed099fSArnd Bergmann /* 33a7ed099fSArnd Bergmann * This is number of spi devices that can be connected to spi. There are 34a7ed099fSArnd Bergmann * two type of chipselects on which slave devices can work. One is chip 35a7ed099fSArnd Bergmann * select provided by spi masters other is controlled through external 36a7ed099fSArnd Bergmann * gpio's. We can't use chipselect provided from spi master (because as 37a7ed099fSArnd Bergmann * soon as FIFO becomes empty, CS is disabled and transfer ends). So 38a7ed099fSArnd Bergmann * this number now depends on number of gpios available for spi. each 39a7ed099fSArnd Bergmann * slave on each master requires a separate gpio pin. 40a7ed099fSArnd Bergmann */ 41a7ed099fSArnd Bergmann .num_chipselect = 2, 42a7ed099fSArnd Bergmann }; 43a7ed099fSArnd Bergmann 44a7ed099fSArnd Bergmann /* dmac device registration */ 45a7ed099fSArnd Bergmann struct pl08x_platform_data pl080_plat_data = { 46a7ed099fSArnd Bergmann .memcpy_channel = { 47a7ed099fSArnd Bergmann .bus_id = "memcpy", 48a7ed099fSArnd Bergmann .cctl_memcpy = 49a7ed099fSArnd Bergmann (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | \ 50a7ed099fSArnd Bergmann PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | \ 51a7ed099fSArnd Bergmann PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | \ 52a7ed099fSArnd Bergmann PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | \ 53a7ed099fSArnd Bergmann PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | \ 54a7ed099fSArnd Bergmann PL080_CONTROL_PROT_SYS), 55a7ed099fSArnd Bergmann }, 56a7ed099fSArnd Bergmann .lli_buses = PL08X_AHB1, 57a7ed099fSArnd Bergmann .mem_buses = PL08X_AHB1, 58a7ed099fSArnd Bergmann .get_signal = pl080_get_signal, 59a7ed099fSArnd Bergmann .put_signal = pl080_put_signal, 60a7ed099fSArnd Bergmann }; 61a7ed099fSArnd Bergmann 62a7ed099fSArnd Bergmann /* 63a7ed099fSArnd Bergmann * Following will create 16MB static virtual/physical mappings 64a7ed099fSArnd Bergmann * PHYSICAL VIRTUAL 65a7ed099fSArnd Bergmann * 0xD0000000 0xFD000000 66a7ed099fSArnd Bergmann * 0xFC000000 0xFC000000 67a7ed099fSArnd Bergmann */ 68a7ed099fSArnd Bergmann struct map_desc spear3xx_io_desc[] __initdata = { 69a7ed099fSArnd Bergmann { 70a7ed099fSArnd Bergmann .virtual = VA_SPEAR_ICM1_2_BASE, 71a7ed099fSArnd Bergmann .pfn = __phys_to_pfn(SPEAR_ICM1_2_BASE), 72a7ed099fSArnd Bergmann .length = SZ_16M, 73a7ed099fSArnd Bergmann .type = MT_DEVICE 74a7ed099fSArnd Bergmann }, { 75a7ed099fSArnd Bergmann .virtual = VA_SPEAR_ICM3_SMI_CTRL_BASE, 76a7ed099fSArnd Bergmann .pfn = __phys_to_pfn(SPEAR_ICM3_SMI_CTRL_BASE), 77a7ed099fSArnd Bergmann .length = SZ_16M, 78a7ed099fSArnd Bergmann .type = MT_DEVICE 79a7ed099fSArnd Bergmann }, 80a7ed099fSArnd Bergmann }; 81a7ed099fSArnd Bergmann 82a7ed099fSArnd Bergmann /* This will create static memory mapping for selected devices */ 83a7ed099fSArnd Bergmann void __init spear3xx_map_io(void) 84a7ed099fSArnd Bergmann { 85a7ed099fSArnd Bergmann iotable_init(spear3xx_io_desc, ARRAY_SIZE(spear3xx_io_desc)); 86a7ed099fSArnd Bergmann } 87a7ed099fSArnd Bergmann 88a7ed099fSArnd Bergmann void __init spear3xx_timer_init(void) 89a7ed099fSArnd Bergmann { 90a7ed099fSArnd Bergmann char pclk_name[] = "pll3_clk"; 91a7ed099fSArnd Bergmann struct clk *gpt_clk, *pclk; 92a7ed099fSArnd Bergmann 93a7ed099fSArnd Bergmann spear3xx_clk_init(); 94a7ed099fSArnd Bergmann 95a7ed099fSArnd Bergmann /* get the system timer clock */ 96a7ed099fSArnd Bergmann gpt_clk = clk_get_sys("gpt0", NULL); 97a7ed099fSArnd Bergmann if (IS_ERR(gpt_clk)) { 98a7ed099fSArnd Bergmann pr_err("%s:couldn't get clk for gpt\n", __func__); 99a7ed099fSArnd Bergmann BUG(); 100a7ed099fSArnd Bergmann } 101a7ed099fSArnd Bergmann 102a7ed099fSArnd Bergmann /* get the suitable parent clock for timer*/ 103a7ed099fSArnd Bergmann pclk = clk_get(NULL, pclk_name); 104a7ed099fSArnd Bergmann if (IS_ERR(pclk)) { 105a7ed099fSArnd Bergmann pr_err("%s:couldn't get %s as parent for gpt\n", 106a7ed099fSArnd Bergmann __func__, pclk_name); 107a7ed099fSArnd Bergmann BUG(); 108a7ed099fSArnd Bergmann } 109a7ed099fSArnd Bergmann 110a7ed099fSArnd Bergmann clk_set_parent(gpt_clk, pclk); 111a7ed099fSArnd Bergmann clk_put(gpt_clk); 112a7ed099fSArnd Bergmann clk_put(pclk); 113a7ed099fSArnd Bergmann 114a7ed099fSArnd Bergmann spear_setup_of_timer(); 115a7ed099fSArnd Bergmann } 116