Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -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> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <linux/irqdomain.h> |
| 18 | #include <linux/of.h> |
| 19 | #include <linux/of_address.h> |
| 20 | #include <linux/of_platform.h> |
| 21 | #include <asm/mach/map.h> |
| 22 | #include <asm/hardware/gic.h> |
| 23 | #include <mach/board.h> |
| 24 | #include <mach/gpio.h> |
| 25 | #include <mach/gpiomux.h> |
| 26 | #include <mach/msm_iomap.h> |
| 27 | #include "clock.h" |
| 28 | |
| 29 | static int __init gpiomux_init(void) |
| 30 | { |
| 31 | int rc; |
| 32 | |
| 33 | rc = msm_gpiomux_init(NR_GPIO_IRQS); |
| 34 | if (rc) { |
| 35 | pr_err("%s: msm_gpiomux_init failed %d\n", __func__, rc); |
| 36 | return rc; |
| 37 | } |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | void __init msm_copper_add_devices(void) |
| 43 | { |
| 44 | } |
| 45 | |
| 46 | static struct of_device_id msm_copper_gic_match[] __initdata = { |
| 47 | { .compatible = "qcom,msm-qgic2", }, |
| 48 | {} |
| 49 | }; |
| 50 | |
| 51 | void __init msm_copper_init_irq(void) |
| 52 | { |
| 53 | unsigned int i; |
| 54 | |
| 55 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 56 | (void *)MSM_QGIC_CPU_BASE); |
| 57 | |
| 58 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 59 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 60 | |
| 61 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 62 | mb(); |
| 63 | |
| 64 | /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 65 | * as they are configured as level, which does not play nice with |
| 66 | * handle_percpu_irq. |
| 67 | */ |
| 68 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 69 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
| 70 | irq_set_handler(i, handle_percpu_irq); |
| 71 | } |
| 72 | irq_domain_generate_simple(msm_copper_gic_match, |
| 73 | COPPER_QGIC_DIST_PHYS, GIC_SPI_START); |
| 74 | } |
| 75 | |
| 76 | static struct clk_lookup msm_clocks_dummy[] = { |
Sathish Ambley | 3d50c76 | 2011-10-25 15:26:00 -0700 | [diff] [blame] | 77 | CLK_DUMMY("core_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF), |
| 78 | CLK_DUMMY("iface_clk", BLSP2_UART_CLK, "msm_serial_hsl.0", OFF), |
Sujit Reddy Thumma | 1a4a79e | 2011-11-04 09:44:32 +0530 | [diff] [blame] | 79 | CLK_DUMMY("core_clk", SDC1_CLK, NULL, OFF), |
| 80 | CLK_DUMMY("iface_clk", SDC1_P_CLK, NULL, OFF), |
| 81 | CLK_DUMMY("core_clk", SDC3_CLK, NULL, OFF), |
| 82 | CLK_DUMMY("iface_clk", SDC3_P_CLK, NULL, OFF), |
Pavankumar Kondeti | 7e6b4d6 | 2011-10-27 15:00:34 +0530 | [diff] [blame^] | 83 | CLK_DUMMY("usb_phy_clk", NULL, NULL, OFF), |
| 84 | CLK_DUMMY("usb_hs_clk", NULL, NULL, OFF), |
| 85 | CLK_DUMMY("usb_hs_pclk", NULL, NULL, OFF), |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | struct clock_init_data msm_dummy_clock_init_data __initdata = { |
| 89 | .table = msm_clocks_dummy, |
| 90 | .size = ARRAY_SIZE(msm_clocks_dummy), |
| 91 | }; |
| 92 | |
| 93 | static struct of_dev_auxdata msm_copper_auxdata_lookup[] __initdata = { |
Sathish Ambley | 3d50c76 | 2011-10-25 15:26:00 -0700 | [diff] [blame] | 94 | OF_DEV_AUXDATA("qcom,msm-lsuart-v14", 0xF9684000, \ |
| 95 | "msm_serial_hsl.0", NULL), |
Sathish Ambley | c58afc2 | 2011-10-09 21:55:39 -0700 | [diff] [blame] | 96 | {} |
| 97 | }; |
| 98 | |
| 99 | void __init msm_copper_init(struct of_dev_auxdata **adata) |
| 100 | { |
| 101 | if (gpiomux_init()) |
| 102 | pr_err("%s: gpiomux_init() failed\n", __func__); |
| 103 | msm_clock_init(&msm_dummy_clock_init_data); |
| 104 | |
| 105 | *adata = msm_copper_auxdata_lookup; |
| 106 | } |