msm8x25: Initial commit for 8x25 target support

Change-Id: I889f3b542ec072c96ca2c1ca6b596deed0d03ceb
diff --git a/platform/msm7x27a/acpuclock.c b/platform/msm7x27a/acpuclock.c
index 33375ad..ba0b939 100644
--- a/platform/msm7x27a/acpuclock.c
+++ b/platform/msm7x27a/acpuclock.c
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2008, Google Inc.
  * All rights reserved.
- * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -102,6 +102,14 @@
 #endif
 };
 
+/*
+ * Use PLL4 to run acpu @ 1.2 GHZ
+ */
+uint32_t const clk_cntl_reg_val_8X25[] = {
+	(WAIT_CNT << 16) | (SRC_SEL_PLL4 << 4)  | DIV_2,
+	(WAIT_CNT << 16) | (SRC_SEL_PLL4 << 12) | (DIV_1 << 8),
+};
+
 uint32_t const clk_cntl_reg_val_7625A[] = {
 	(WAIT_CNT << 16) | (SRC_SEL_PLL2 << 4) | DIV_16,
 	(WAIT_CNT << 16) | (SRC_SEL_PLL2 << 12) | (DIV_8 << 8),
@@ -225,6 +233,12 @@
 		pll_request(4, 1);
 #endif
 		break;
+	case MSM8625:
+		/* Fix me: Will move to PLL4 later */
+		clk_cntl_reg_val = clk_cntl_reg_val_7627A;
+		size = ARRAY_SIZE(clk_cntl_reg_val_7627A);
+		pll_request(2, 1);
+		break;
 
 	case MSM7225A:
 	case MSM7625A:
diff --git a/platform/msm7x27a/include/platform/irqs.h b/platform/msm7x27a/include/platform/irqs.h
index 76a41d5..d5dce0f 100644
--- a/platform/msm7x27a/include/platform/irqs.h
+++ b/platform/msm7x27a/include/platform/irqs.h
@@ -2,6 +2,8 @@
  * Copyright (c) 2008, Google Inc.
  * All rights reserved.
  *
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -32,6 +34,11 @@
 #ifndef _PLATFORM_MSM7K_IRQS_H_
 #define _PLATFORM_MSM7K_IRQS_H_
 
+extern int debug_timer;
+extern int gpt_timer;
+extern int usb_hs_int;
+
+#define GIC_PPI_START		16
 #define INT_A9_M2A_0		 0
 #define INT_A9_M2A_1		 1
 #define INT_A9_M2A_2		 2
@@ -39,8 +46,8 @@
 #define INT_A9_M2A_4		 4
 #define INT_A9_M2A_5		 5
 #define INT_A9_M2A_6		 6
-#define INT_GP_TIMER_EXP	 7
-#define INT_DEBUG_TIMER_EXP  8
+#define INT_GP_TIMER_EXP	 gpt_timer
+#define INT_DEBUG_TIMER_EXP	 debug_timer
 #define INT_UART1			9
 #define INT_UART2			10
 #define INT_UART3			11
@@ -80,7 +87,9 @@
 #define INT_TSIF_IRQ		 (32 + 12)
 #define INT_UART1DM_IRQ	  (32 + 13)
 #define INT_UART1DM_RX	   (32 + 14)
-#define INT_USB_HS		   (32 + 15)
+#define INT_USB_HS_VIC		(32 + 15)
+#define INT_USB_HS_GIC		(32 + 32 + 15)
+#define INT_USB_HS		usb_hs_int
 #define INT_SDC3_0		   (32 + 16)
 #define INT_SDC3_1		   (32 + 17)
 #define INT_SDC4_0		   (32 + 18)
@@ -90,6 +99,8 @@
 
 #define MSM_IRQ_BIT(irq)	 (1 << ((irq) & 31))
 
-#define NR_IRQS 54
+#define NR_IRQS		NR_IRQS_QGIC
+#define NR_IRQS_VIC	54
+#define NR_IRQS_QGIC	261
 
 #endif
diff --git a/platform/msm7x27a/interrupts.c b/platform/msm7x27a/interrupts.c
index 9f72908..fdc7798 100644
--- a/platform/msm7x27a/interrupts.c
+++ b/platform/msm7x27a/interrupts.c
@@ -2,6 +2,8 @@
  * Copyright (c) 2008, Google Inc.
  * All rights reserved.
  *
+ * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -78,7 +80,7 @@
 	void *arg;
 };
 
-static struct ihandler handler[NR_IRQS];
+static struct ihandler handler[NR_IRQS_VIC];
 
 void platform_init_interrupts(void)
 {
@@ -98,7 +100,7 @@
 	enum handler_return ret;
 	num = readl(VIC_IRQ_VEC_RD);
 	num = readl(VIC_IRQ_VEC_PEND_RD);
-	if (num > NR_IRQS)
+	if (num > NR_IRQS_VIC)
 		return 0;
 	writel(1 << (num & 31), (num > 31) ? VIC_INT_CLEAR1 : VIC_INT_CLEAR0);
 	ret = handler[num].func(handler[num].arg);
@@ -129,7 +131,7 @@
 
 void vic_register_int_handler(unsigned int vector, int_handler func, void *arg)
 {
-	if (vector >= NR_IRQS)
+	if (vector >= NR_IRQS_VIC)
 		return;
 
 	enter_critical_section();
diff --git a/platform/msm7x27a/platform.c b/platform/msm7x27a/platform.c
index 76964f9..c9f39d1 100755
--- a/platform/msm7x27a/platform.c
+++ b/platform/msm7x27a/platform.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2008, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@
 #include <kernel/thread.h>
 #include <platform/debug.h>
 #include <platform/iomap.h>
+#include <platform/irqs.h>
 #include <mddi.h>
 #include <dev/fbcon.h>
 #include <dev/gpio.h>
@@ -59,7 +60,9 @@
 
 unsigned board_msm_id(void);
 
-static int target_uses_qgic = 0;
+static int target_uses_qgic;
+int debug_timer = 0, gpt_timer = 0, usb_hs_int = 0;
+
 void platform_early_init(void)
 {
 #if WITH_DEBUG_UART
@@ -69,8 +72,14 @@
 	if(machine_is_8x25()) {
 		qgic_init();
 		target_uses_qgic = 1;
+		debug_timer = (GIC_PPI_START + 2);
+		gpt_timer = (GIC_PPI_START + 3);
+		usb_hs_int = INT_USB_HS_GIC;
 	} else {
 		platform_init_interrupts();
+		debug_timer = 8;
+		gpt_timer = 7;
+		usb_hs_int = INT_USB_HS_VIC;
 	}
 	platform_init_timer();
 }
@@ -105,7 +114,7 @@
 void display_shutdown(void)
 {
 #if DISPLAY_TYPE_MIPI
-	if (machine_is_7x27a_evb())
+	if (machine_is_evb())
 		return;
 	dprintf(SPEW, "display_shutdown()\n");
 	mipi_dsi_shutdown();
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index 0813be3..97f01e6 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -2,7 +2,7 @@
  * Copyright (c) 2009, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -185,6 +185,8 @@
 	MSM8660A = 122,
 	MSM8260A = 123,
 	APQ8060A = 124,
+	MSM8225 = 127,
+	MSM8625 = 129
 };
 
 enum platform {