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> |
Pavankumar Kondeti | 7032d51 | 2010-12-08 13:37:07 +0530 | [diff] [blame^] | 23 | #include <linux/usb/msm_hsusb.h> |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 24 | |
| 25 | #include <asm/mach-types.h> |
| 26 | #include <asm/mach/arch.h> |
| 27 | #include <asm/io.h> |
| 28 | #include <asm/setup.h> |
| 29 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 30 | #include <mach/board.h> |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 31 | #include <mach/irqs.h> |
| 32 | #include <mach/sirc.h> |
| 33 | #include <mach/gpio.h> |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 34 | |
| 35 | #include "devices.h" |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 36 | |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 37 | extern struct sys_timer msm_timer; |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 38 | |
Gregory Bean | 5d73c53 | 2010-09-29 13:46:45 -0700 | [diff] [blame] | 39 | static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300; |
| 40 | static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156; |
| 41 | |
| 42 | /* Leave smc91x resources empty here, as we'll fill them in |
| 43 | * at run-time: they vary from board to board, and the true |
| 44 | * configuration won't be known until boot. |
| 45 | */ |
| 46 | static struct resource smc91x_resources[] __initdata = { |
| 47 | [0] = { |
| 48 | .flags = IORESOURCE_MEM, |
| 49 | }, |
| 50 | [1] = { |
| 51 | .flags = IORESOURCE_IRQ, |
| 52 | }, |
| 53 | }; |
| 54 | |
| 55 | static struct platform_device smc91x_device __initdata = { |
| 56 | .name = "smc91x", |
| 57 | .id = 0, |
| 58 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 59 | .resource = smc91x_resources, |
| 60 | }; |
| 61 | |
| 62 | static int __init msm_init_smc91x(void) |
| 63 | { |
| 64 | if (machine_is_qsd8x50_surf()) { |
| 65 | smc91x_resources[0].start = qsd8x50_surf_smc91x_base; |
| 66 | smc91x_resources[0].end = qsd8x50_surf_smc91x_base + 0xff; |
| 67 | smc91x_resources[1].start = |
| 68 | gpio_to_irq(qsd8x50_surf_smc91x_gpio); |
| 69 | smc91x_resources[1].end = |
| 70 | gpio_to_irq(qsd8x50_surf_smc91x_gpio); |
| 71 | platform_device_register(&smc91x_device); |
| 72 | } |
| 73 | |
| 74 | return 0; |
| 75 | } |
| 76 | module_init(msm_init_smc91x); |
| 77 | |
Pavankumar Kondeti | 7032d51 | 2010-12-08 13:37:07 +0530 | [diff] [blame^] | 78 | static int hsusb_phy_init_seq[] = { |
| 79 | 0x08, 0x31, /* Increase HS Driver Amplitude */ |
| 80 | 0x20, 0x32, /* Enable and set Pre-Emphasis Depth to 10% */ |
| 81 | -1 |
| 82 | }; |
| 83 | |
| 84 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 85 | .phy_init_seq = hsusb_phy_init_seq, |
| 86 | .mode = USB_PERIPHERAL, |
| 87 | .otg_control = OTG_PHY_CONTROL, |
| 88 | }; |
| 89 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 90 | static struct platform_device *devices[] __initdata = { |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 91 | &msm_device_uart3, |
Niranjana Vishwanathapura | 88b5227 | 2010-10-06 13:52:11 -0700 | [diff] [blame] | 92 | &msm_device_smd, |
Pavankumar Kondeti | 7032d51 | 2010-12-08 13:37:07 +0530 | [diff] [blame^] | 93 | &msm_device_otg, |
| 94 | &msm_device_hsusb, |
| 95 | &msm_device_hsusb_host, |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 96 | }; |
| 97 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 98 | static void __init qsd8x50_map_io(void) |
| 99 | { |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 100 | msm_map_qsd8x50_io(); |
| 101 | msm_clock_init(msm_clocks_8x50, msm_num_clocks_8x50); |
| 102 | } |
| 103 | |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 104 | static void __init qsd8x50_init_irq(void) |
| 105 | { |
| 106 | msm_init_irq(); |
| 107 | msm_init_sirc(); |
| 108 | } |
| 109 | |
| 110 | static void __init qsd8x50_init(void) |
| 111 | { |
Pavankumar Kondeti | 7032d51 | 2010-12-08 13:37:07 +0530 | [diff] [blame^] | 112 | msm_device_otg.dev.platform_data = &msm_otg_pdata; |
| 113 | msm_device_hsusb.dev.parent = &msm_device_otg.dev; |
| 114 | msm_device_hsusb_host.dev.parent = &msm_device_otg.dev; |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 115 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
| 116 | } |
| 117 | |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 118 | MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF") |
| 119 | #ifdef CONFIG_MSM_DEBUG_UART |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 120 | #endif |
| 121 | .boot_params = PHYS_OFFSET + 0x100, |
| 122 | .map_io = qsd8x50_map_io, |
| 123 | .init_irq = qsd8x50_init_irq, |
| 124 | .init_machine = qsd8x50_init, |
| 125 | .timer = &msm_timer, |
| 126 | MACHINE_END |
| 127 | |
Daniel Walker | d1c0d43 | 2010-05-05 07:17:31 -0700 | [diff] [blame] | 128 | MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5") |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 129 | #ifdef CONFIG_MSM_DEBUG_UART |
Daniel Walker | a32d2fe | 2010-02-25 11:38:39 -0800 | [diff] [blame] | 130 | #endif |
| 131 | .boot_params = PHYS_OFFSET + 0x100, |
| 132 | .map_io = qsd8x50_map_io, |
| 133 | .init_irq = qsd8x50_init_irq, |
| 134 | .init_machine = qsd8x50_init, |
| 135 | .timer = &msm_timer, |
| 136 | MACHINE_END |