Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, 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 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 15 | #include <linux/i2c.h> |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 16 | #include <asm/mach-types.h> |
| 17 | #include <asm/mach/arch.h> |
| 18 | #include <mach/board.h> |
| 19 | #include <mach/msm_iomap.h> |
| 20 | #include <mach/gpio.h> |
| 21 | #include <mach/gpiomux.h> |
| 22 | #include "timer.h" |
| 23 | #include "devices.h" |
| 24 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 25 | static struct platform_device *common_devices[] = { |
| 26 | &msm9615_device_uart_gsbi4, |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 27 | &msm9615_device_qup_i2c_gsbi5, |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 28 | }; |
| 29 | |
| 30 | static struct gpiomux_setting gsbi4 = { |
| 31 | .func = GPIOMUX_FUNC_1, |
| 32 | .drv = GPIOMUX_DRV_8MA, |
| 33 | .pull = GPIOMUX_PULL_NONE, |
| 34 | }; |
| 35 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 36 | static struct gpiomux_setting gsbi5 = { |
| 37 | .func = GPIOMUX_FUNC_1, |
| 38 | .drv = GPIOMUX_DRV_8MA, |
| 39 | .pull = GPIOMUX_PULL_NONE, |
| 40 | }; |
| 41 | |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 42 | struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = { |
| 43 | { |
| 44 | .gpio = 12, /* GSBI4 UART */ |
| 45 | .settings = { |
| 46 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 47 | }, |
| 48 | }, |
| 49 | { |
| 50 | .gpio = 13, /* GSBI4 UART */ |
| 51 | .settings = { |
| 52 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 53 | }, |
| 54 | }, |
| 55 | { |
| 56 | .gpio = 14, /* GSBI4 UART */ |
| 57 | .settings = { |
| 58 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 59 | }, |
| 60 | }, |
| 61 | { |
| 62 | .gpio = 15, /* GSBI4 UART */ |
| 63 | .settings = { |
| 64 | [GPIOMUX_SUSPENDED] = &gsbi4, |
| 65 | }, |
| 66 | }, |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 67 | { |
| 68 | .gpio = 16, /* GSBI5 I2C QUP SCL */ |
| 69 | .settings = { |
| 70 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 71 | }, |
| 72 | }, |
| 73 | { |
| 74 | .gpio = 17, /* GSBI5 I2C QUP SDA */ |
| 75 | .settings = { |
| 76 | [GPIOMUX_SUSPENDED] = &gsbi5, |
| 77 | }, |
| 78 | }, |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 79 | }; |
| 80 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 81 | static int __init gpiomux_init(void) |
| 82 | { |
| 83 | int rc; |
| 84 | |
| 85 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 86 | if (rc) { |
| 87 | pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc); |
| 88 | return rc; |
| 89 | } |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 90 | msm_gpiomux_install(msm9615_gsbi_configs, |
| 91 | ARRAY_SIZE(msm9615_gsbi_configs)); |
| 92 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 93 | return 0; |
| 94 | } |
| 95 | |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 96 | static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = { |
| 97 | .clk_freq = 100000, |
| 98 | .src_clk_rate = 24000000, |
| 99 | }; |
| 100 | |
| 101 | static void __init msm9615_i2c_init(void) |
| 102 | { |
| 103 | msm9615_device_qup_i2c_gsbi5.dev.platform_data = |
| 104 | &msm9615_i2c_qup_gsbi5_pdata; |
| 105 | } |
| 106 | |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 107 | static void __init msm9615_common_init(void) |
| 108 | { |
| 109 | msm9615_device_init(); |
| 110 | gpiomux_init(); |
Harini Jayaraman | eba5267 | 2011-09-08 15:13:00 -0600 | [diff] [blame] | 111 | msm9615_i2c_init(); |
Rohit Vaswani | 0966687 | 2011-08-23 17:41:54 -0700 | [diff] [blame] | 112 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Rohit Vaswani | ced9b3b | 2011-08-23 17:21:49 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | static void __init msm9615_cdp_init(void) |
| 116 | { |
| 117 | msm9615_common_init(); |
| 118 | } |
| 119 | |
| 120 | static void __init msm9615_mtp_init(void) |
| 121 | { |
| 122 | msm9615_common_init(); |
| 123 | } |
| 124 | |
| 125 | MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP") |
| 126 | .map_io = msm9615_map_io, |
| 127 | .init_irq = msm9615_init_irq, |
| 128 | .timer = &msm_timer, |
| 129 | .init_machine = msm9615_cdp_init, |
| 130 | MACHINE_END |
| 131 | |
| 132 | MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP") |
| 133 | .map_io = msm9615_map_io, |
| 134 | .init_irq = msm9615_init_irq, |
| 135 | .timer = &msm_timer, |
| 136 | .init_machine = msm9615_mtp_init, |
| 137 | MACHINE_END |