Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | * You should have received a copy of the GNU General Public License |
| 13 | * along with this program; if not, write to the Free Software |
| 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 15 | * 02110-1301, USA. |
| 16 | */ |
| 17 | |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/irq.h> |
| 20 | #include <linux/gpio.h> |
| 21 | #include <linux/platform_device.h> |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 22 | #include <linux/delay.h> |
| 23 | |
| 24 | #include <asm/mach-types.h> |
| 25 | #include <asm/mach/arch.h> |
| 26 | #include <asm/io.h> |
| 27 | #include <asm/setup.h> |
| 28 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 29 | #include <mach/board.h> |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 30 | #include <mach/irqs.h> |
| 31 | #include <mach/sirc.h> |
| 32 | #include <mach/gpio.h> |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 33 | |
| 34 | #include "devices.h" |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 35 | |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 36 | extern struct sys_timer msm_timer; |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 37 | |
Gregory Bean | 5d73c53 | 2010-09-29 13:46:45 -0700 | [diff] [blame] | 38 | static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300; |
| 39 | static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156; |
| 40 | |
| 41 | /* Leave smc91x resources empty here, as we'll fill them in |
| 42 | * at run-time: they vary from board to board, and the true |
| 43 | * configuration won't be known until boot. |
| 44 | */ |
Stephen Boyd | 7c63ded | 2010-12-20 15:00:17 -0800 | [diff] [blame^] | 45 | static struct resource smc91x_resources[] = { |
Gregory Bean | 5d73c53 | 2010-09-29 13:46:45 -0700 | [diff] [blame] | 46 | [0] = { |
| 47 | .flags = IORESOURCE_MEM, |
| 48 | }, |
| 49 | [1] = { |
| 50 | .flags = IORESOURCE_IRQ, |
| 51 | }, |
| 52 | }; |
| 53 | |
Stephen Boyd | 7c63ded | 2010-12-20 15:00:17 -0800 | [diff] [blame^] | 54 | static struct platform_device smc91x_device = { |
Gregory Bean | 5d73c53 | 2010-09-29 13:46:45 -0700 | [diff] [blame] | 55 | .name = "smc91x", |
| 56 | .id = 0, |
| 57 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 58 | .resource = smc91x_resources, |
| 59 | }; |
| 60 | |
| 61 | static int __init msm_init_smc91x(void) |
| 62 | { |
| 63 | if (machine_is_qsd8x50_surf()) { |
| 64 | smc91x_resources[0].start = qsd8x50_surf_smc91x_base; |
| 65 | smc91x_resources[0].end = qsd8x50_surf_smc91x_base + 0xff; |
| 66 | smc91x_resources[1].start = |
| 67 | gpio_to_irq(qsd8x50_surf_smc91x_gpio); |
| 68 | smc91x_resources[1].end = |
| 69 | gpio_to_irq(qsd8x50_surf_smc91x_gpio); |
| 70 | platform_device_register(&smc91x_device); |
| 71 | } |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | module_init(msm_init_smc91x); |
| 76 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 77 | static struct platform_device *devices[] __initdata = { |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 78 | &msm_device_uart3, |
Niranjana Vishwanathapura | 88b5227 | 2010-10-06 13:52:11 -0700 | [diff] [blame] | 79 | &msm_device_smd, |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 80 | }; |
| 81 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 82 | static void __init qsd8x50_map_io(void) |
| 83 | { |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 84 | msm_map_qsd8x50_io(); |
| 85 | msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50); |
| 86 | } |
| 87 | |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 88 | static void __init qsd8x50_init_irq(void) |
| 89 | { |
| 90 | msm_init_irq(); |
| 91 | msm_init_sirc(); |
| 92 | } |
| 93 | |
| 94 | static void __init qsd8x50_init(void) |
| 95 | { |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 96 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 97 | } |
| 98 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 99 | MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF") |
| 100 | #ifdef CONFIG_MSM_DEBUG_UART |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 101 | #endif |
| 102 | .boot_params = PHYS_OFFSET + 0x100, |
| 103 | .map_io = qsd8x50_map_io, |
| 104 | .init_irq = qsd8x50_init_irq, |
| 105 | .init_machine = qsd8x50_init, |
| 106 | .timer = &msm_timer, |
| 107 | MACHINE_END |
| 108 | |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 109 | MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5") |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 110 | #ifdef CONFIG_MSM_DEBUG_UART |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 111 | #endif |
| 112 | .boot_params = PHYS_OFFSET + 0x100, |
| 113 | .map_io = qsd8x50_map_io, |
| 114 | .init_irq = qsd8x50_init_irq, |
| 115 | .init_machine = qsd8x50_init, |
| 116 | .timer = &msm_timer, |
| 117 | MACHINE_END |