Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7261
-gerrit
commit 52b07f713674b6bee27b87b1d24a396f53979c52
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Mon Apr 7 15:26:39 2014 -0700
Provide ability to integrate with QComm SBLs
Ipq8064 SBLs initialize the hardware to prepare it to run an arbitrary
user provided bootloader. The only bootloader requirements imposed by
the SBLs are that it is concatenated with the SBL chunks in the
bootprm AND it uses MBN encapsulation (mostly to specify the size and
load address).
This patch adds configuration options to specify the location of the
SBL blobs and to require MBN encapsulation of the bootblock.
BRANCH=none
BUG=chrome-os-partner:27784
TEST=manual
- the below demonstrates added encapsulation, no code run attempts
have been made yet:
$ FEATURES=noclean emerge-storm coreboot
$ cd /build/storm/tmp/portage/sys-boot/coreboot-9999/work/coreboot-9999
$ \od -t x4 build/cbfs/fallback/bootblock.bin | head -3
0000000 00000005 00000003 00000000 2a010000
0000020 00000be0 00000be0 2a010be0 00000000
0000040 2a010be0 00000000 e32bf0df e59f0030
Original-Change-Id: Iae30ad08059e2b35c434ac25a410ac2017752957
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/193511
(cherry picked from commit bf16ea915c723ab124d817e3b0d950282e3cf1c1)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I53c71d382ec1d826f530d7afb545f64ec4eaf96b
---
src/soc/qualcomm/ipq806x/Kconfig | 18 ++++++++++++++++++
src/soc/qualcomm/ipq806x/Makefile.inc | 10 ++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/soc/qualcomm/ipq806x/Kconfig b/src/soc/qualcomm/ipq806x/Kconfig
index fcf8ccd..0f65990 100644
--- a/src/soc/qualcomm/ipq806x/Kconfig
+++ b/src/soc/qualcomm/ipq806x/Kconfig
@@ -19,4 +19,22 @@ config CBFS_ROM_OFFSET
hex "offset of CBFS data in ROM"
default 0x18080
+config MBN_ENCAPSULATION
+ depends on USE_BLOBS
+ bool "bootblock encapsulation for ipq8064"
+ default y
+
+config SBL_BLOB
+ depends on USE_BLOBS
+ string "file name of the Qualcomm SBL blob"
+ default "3rdparty/cpu/qualcomm/ipq8064/sbls.bin"
+ help
+ The path and filename of the binary blob containing
+ ipq806x early initialization code, as supplied by the
+ vendor.
+
+config BOOTBLOCK_BASE
+ hex "64K bytes left for TZBSP"
+ default 0x2a010000
+
endif
diff --git a/src/soc/qualcomm/ipq806x/Makefile.inc b/src/soc/qualcomm/ipq806x/Makefile.inc
index be37581..2487f46 100644
--- a/src/soc/qualcomm/ipq806x/Makefile.inc
+++ b/src/soc/qualcomm/ipq806x/Makefile.inc
@@ -6,3 +6,13 @@ romstage-y += timer.c
ramstage-y += cbfs.c
ramstage-y += timer.c
+
+ifeq ($(CONFIG_MBN_ENCAPSULATION),y)
+
+$(objcbfs)/%.bin: $(objcbfs)/%.elf
+ @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
+ $(OBJCOPY_bootblock) -O binary $< $@.prembn
+ @printf " ADD MBN $(subst $(obj)/,,$(@))\n"
+ ./util/ipqheader/ipqheader.py $(CONFIG_BOOTBLOCK_BASE) $@.prembn $@.tmp
+ @mv $@.tmp $@
+endif
the following patch was just integrated into master:
commit cfa06c746023fbb79169260012539253811525aa
Author: Marc Jones <marc.jones(a)se-eng.com>
Date: Fri Nov 7 16:41:06 2014 -0700
blobs: Update to IPQ blob commit
Update the 3rdparty repo to the IPQ binary commit
Change-Id: I50fd7254eaf97ac44fb046e39ff1a81d2baad16f
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Reviewed-on: http://review.coreboot.org/7354
Reviewed-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
See http://review.coreboot.org/7354 for details.
-gerrit
Tobias Diedrich (ranma+coreboot(a)tdiedrich.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7355
-gerrit
commit 4daeed9c113d11041f12300aeb6821318900d56d
Author: Tobias Diedrich <ranma+coreboot(a)tdiedrich.de>
Date: Sat Nov 8 00:38:33 2014 +0100
Hudson: Add support for hiding the USB1.1-only OHCI
The hudson chipset has 4 USB controllers, the fourth is USB1.1-only and
(presumably) not used very often, add support for hiding it.
On the F2A85M the vendor BIOS is hiding both the USB4 OHCI and the SD
controller, adjust devicetree.cb accordingly.
Support for hiding the SD controller already exists, but was not yet
used in the F2A85M devicetree.cb.
Includes a small whitespace fix.
Change-Id: I804e7852fd0a6f870dd118b429473cb06ebac9a4
Signed-off-by: Tobias Diedrich <ranma+coreboot(a)tdiedrich.de>
---
src/mainboard/asus/f2a85-m/devicetree.cb | 7 +++----
src/southbridge/amd/agesa/hudson/hudson.c | 14 ++++++++++++++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/mainboard/asus/f2a85-m/devicetree.cb b/src/mainboard/asus/f2a85-m/devicetree.cb
index 9ac5574..40d9c88 100644
--- a/src/mainboard/asus/f2a85-m/devicetree.cb
+++ b/src/mainboard/asus/f2a85-m/devicetree.cb
@@ -32,7 +32,7 @@ chip northbridge/amd/agesa/family15tn/root_complex
device pci 0.0 on end # Root Complex
device pci 1.0 on end # Internal Graphics P2P bridge 0x99XX
device pci 1.1 on end # Internal Multimedia
- device pci 2.0 on end # PCIE SLOT0 x16 blue
+ device pci 2.0 on end # PCIE SLOT0 x16 blue
device pci 3.0 off end # unused?
device pci 4.0 on end # PCIE 4x black
device pci 5.0 off end # unused?
@@ -108,10 +108,9 @@ chip northbridge/amd/agesa/family15tn/root_complex
end #superio/ite/it8728f
end #device pci 14.3 # LPC
device pci 14.4 on end # PCI 0x4384
- device pci 14.5 on end # USB 2
+ device pci 14.5 off end # Hide USB4 (USB1.1-only OHCI)
device pci 14.6 off end # Gec
- # SD, make it on so the BAR is assigned (if proper hudson on/off handling is implemented this may go away)
- device pci 14.7 on end
+ device pci 14.7 off end # Hide unused SD controller
device pci 15.0 on end # PCIe 0 - onboard PCIe 1x
device pci 15.1 on end # PCIe 1 onboard gigabit
device pci 15.2 off end # unused
diff --git a/src/southbridge/amd/agesa/hudson/hudson.c b/src/southbridge/amd/agesa/hudson/hudson.c
index 3b57221..c33dc9b 100644
--- a/src/southbridge/amd/agesa/hudson/hudson.c
+++ b/src/southbridge/amd/agesa/hudson/hudson.c
@@ -109,6 +109,20 @@ void hudson_enable(device_t dev)
pm_write8(0xd3, reg8);
}
break;
+ case (0x14 << 3) | 5: /* 0:14.5 USB1.1 OHCI (USB4) */
+ if (dev->enabled == 0) {
+ // read the VENDEV ID
+ device_t sd_dev = dev_find_slot( 0, PCI_DEVFN( 0x14, 5));
+ u32 sd_device_id = pci_read_config32( sd_dev, 0) >> 16;
+ u8 reg8;
+ if (sd_device_id == PCI_DEVICE_ID_ATI_SB900_USB_20_5) {
+ /* turn off and remove device 0:14.5 from PCI space */
+ reg8 = pm_read8(0xef);
+ reg8 &= ~(1 << 6);
+ pm_write8(0xef, reg8);
+ }
+ }
+ break;
default:
break;
}
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7265
-gerrit
commit 0f4323318e598ea6112b2142fcc904d0e4a4a12d
Author: Furquan Shaikh <furquan(a)google.com>
Date: Fri Apr 11 14:57:11 2014 -0700
ipq806x: Typecast address to void * in read/write operations
Typecast address to void* to accomodate address being passed as integers
BUG=None
BRANCH=None
TEST=Compiled successfully
Original-Change-Id: Iceb51056c8a30a9a9dbd0594f75c23000faa6120
Original-Reviewed-on: https://chromium-review.googlesource.com/194365
Original-Tested-by: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
(cherry picked from commit abf9b1e77b8a078e6ed873cbf34246bd97c81e98)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I1806e96e194e936975a43e95b9fd7d7458ef1653
---
src/soc/qualcomm/ipq806x/include/iomap.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/soc/qualcomm/ipq806x/include/iomap.h b/src/soc/qualcomm/ipq806x/include/iomap.h
index 514c6a7..a7066af 100644
--- a/src/soc/qualcomm/ipq806x/include/iomap.h
+++ b/src/soc/qualcomm/ipq806x/include/iomap.h
@@ -37,6 +37,15 @@
#define _PLATFORM_MSM8960_IOMAP_H_
#include <configs/ipq806x_cdp.h>
+
+/* Typecast to allow integers being passed as address
+ This needs to be included because vendor code is not compliant with our
+ macros for read/write. Hence, special macros for readl_i and writel_i are
+ included to do this in one place for all occurrences in vendor code
+ */
+#define readl_i(a) read32((const void *)(a))
+#define writel_i(v,a) write32(v,(void *)a)
+
#define MSM_CLK_CTL_BASE 0x00900000
#define MSM_TMR_BASE 0x0200A000
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7267
-gerrit
commit 6c8cf57b664a1dcd839970c91b4b4b562f06f83f
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Tue Apr 15 14:42:30 2014 -0700
Use sbl blobs from a private location
The sbl blobs could not yet be published, they have been moved to a
private location. Update coreboot to pick up the blobs at the correct
place.
BRANCH=None
CQ-DEPEND=CL:195003
BUG=chrome-os-partner:28059
TEST=manual
$ emerge-storm coreboot succeeds
Original-Change-Id: I8c4163bc978307e41c156ef9f7f2a211d57db7a8
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/194997
Original-Reviewed-by: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
(cherry picked from commit 1a1848b00acfc2f58990559e824ea9c13c3c239c)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: If597ebbfd348039d578c99cd7a8e3c4bcbf60c10
---
src/soc/qualcomm/ipq806x/Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/soc/qualcomm/ipq806x/Makefile.inc b/src/soc/qualcomm/ipq806x/Makefile.inc
index 33bd763..002e59c 100644
--- a/src/soc/qualcomm/ipq806x/Makefile.inc
+++ b/src/soc/qualcomm/ipq806x/Makefile.inc
@@ -22,7 +22,7 @@ $(objcbfs)/bootblock.mbn: $(objcbfs)/bootblock.raw
@mv $@.tmp $@
# Create a complete bootblock which will start up the system
-$(objcbfs)/bootblock.bin: ./$(call strip_quotes,$(CONFIG_SBL_BLOB)) \
+$(objcbfs)/bootblock.bin: $(call strip_quotes,$(CONFIG_SBL_BLOB)) \
$(objcbfs)/bootblock.mbn
@printf " CAT $(subst $(obj)/,,$(@))\n"
@cat $^ > $@.tmp
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7268
-gerrit
commit 170ede4a44af98c08d8e80af3cb451cf1cce7196
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Mon Apr 21 18:53:47 2014 -0700
ipq8064: Configure proper bootblock stack and load address
The SBL3 currently seems to be preventing the bootblock from being
loaded into the IMEM. As a temporary measure, map bootblock into DRAM
(as it is available after SBL2 finished running) and specify the
correct stack space.
BUG=chrome-os-partner:27784
TEST=not much testing yet, just verify 'emerge-storm coreboot' still succeeds.
Original-Change-Id: Ibe9d4911ad22ada1bbd01af54a2ef80009df3a28
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/196168
Original-Reviewed-by: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
(cherry picked from commit 950323d6091c3b795034c24a08b6c176f56f0e0f)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: Ib3ec21f2cb4058b3e3cc82864de89dadf3b6aa84
---
src/soc/qualcomm/ipq806x/Kconfig | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/soc/qualcomm/ipq806x/Kconfig b/src/soc/qualcomm/ipq806x/Kconfig
index 88dbd36..03be33a 100644
--- a/src/soc/qualcomm/ipq806x/Kconfig
+++ b/src/soc/qualcomm/ipq806x/Kconfig
@@ -35,6 +35,14 @@ config SBL_BLOB
config BOOTBLOCK_BASE
hex "256K bytes left for TZBSP"
- default 0x2a040000
+ default 0x40600000
+
+config STACK_TOP
+ hex
+ default 0x40600000
+
+config STACK_BOTTOM
+ hex
+ default 0x405fc000
endif
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7269
-gerrit
commit f1c02de09a8510504c3711bae7932f48ead1b5f2
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Wed Apr 9 19:23:04 2014 -0700
ipq8064: Make timer code compile
Commment out nonessential timer services and modify the source code to
cleanly build in coeboot environment. Do not remove dead code just
yet, these functions might be necessary later.
Need to rename the soc timer.h to prevent collisions with timer.h in
the top level include directory.
Currently build timer code for ramstage only.
BUG=chrome-os-partner:27784
TEST='emerge-storm coreboot' still succeeds
Original-Change-Id: Ib10133ccb42697840708845a8ea6d75ceeaeb3d5
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/194067
Original-Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
(cherry picked from commit 987ce95220953c16216d1e1d70d5a941d05fc9bc)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: Ia9cf175da11c70709354def5e51bf79df4fda2fe
---
src/soc/qualcomm/ipq806x/Makefile.inc | 1 +
src/soc/qualcomm/ipq806x/cbfs.c | 9 ------
src/soc/qualcomm/ipq806x/include/cdp.h | 40 +++++++++++++++++-------
src/soc/qualcomm/ipq806x/include/iomap.h | 4 ++-
src/soc/qualcomm/ipq806x/include/ipq_timer.h | 40 ++++++++++++++++++++++++
src/soc/qualcomm/ipq806x/include/timer.h | 40 ------------------------
src/soc/qualcomm/ipq806x/timer.c | 46 ++++++++++++----------------
7 files changed, 93 insertions(+), 87 deletions(-)
diff --git a/src/soc/qualcomm/ipq806x/Makefile.inc b/src/soc/qualcomm/ipq806x/Makefile.inc
index 002e59c..41cde31 100644
--- a/src/soc/qualcomm/ipq806x/Makefile.inc
+++ b/src/soc/qualcomm/ipq806x/Makefile.inc
@@ -6,6 +6,7 @@ romstage-y += gpio.c
ramstage-y += cbfs.c
ramstage-y += gpio.c
+ramstage-y += timer.c
ifeq ($(CONFIG_USE_BLOBS),y)
diff --git a/src/soc/qualcomm/ipq806x/cbfs.c b/src/soc/qualcomm/ipq806x/cbfs.c
index eec9b73..97ae548 100644
--- a/src/soc/qualcomm/ipq806x/cbfs.c
+++ b/src/soc/qualcomm/ipq806x/cbfs.c
@@ -24,12 +24,3 @@ int init_default_cbfs_media(struct cbfs_media *media)
{
return 0;
}
-
-/*
- * Temporary change to make sure storm code still builds. Will be dropped
- * shortly.
- */
-#include <delay.h> /* This driver serves as a CBFS media source. */
-void init_timer(void)
-{
-}
diff --git a/src/soc/qualcomm/ipq806x/include/cdp.h b/src/soc/qualcomm/ipq806x/include/cdp.h
index 4ae476a..22ba192 100644
--- a/src/soc/qualcomm/ipq806x/include/cdp.h
+++ b/src/soc/qualcomm/ipq806x/include/cdp.h
@@ -4,9 +4,23 @@
#ifndef _IPQ806X_CDP_H_
#define _IPQ806X_CDP_H_
-#include <phy.h>
+unsigned smem_get_board_machtype(void);
-unsigned int smem_get_board_machtype(void);
+typedef enum {
+ PHY_INTERFACE_MODE_MII,
+ PHY_INTERFACE_MODE_GMII,
+ PHY_INTERFACE_MODE_SGMII,
+ PHY_INTERFACE_MODE_QSGMII,
+ PHY_INTERFACE_MODE_TBI,
+ PHY_INTERFACE_MODE_RMII,
+ PHY_INTERFACE_MODE_RGMII,
+ PHY_INTERFACE_MODE_RGMII_ID,
+ PHY_INTERFACE_MODE_RGMII_RXID,
+ PHY_INTERFACE_MODE_RGMII_TXID,
+ PHY_INTERFACE_MODE_RTBI,
+ PHY_INTERFACE_MODE_XGMII,
+ PHY_INTERFACE_MODE_NONE /* Must be last */
+} phy_interface_t;
typedef struct {
unsigned int gpio;
@@ -73,17 +87,17 @@ typedef struct {
} spinorflash_params_t;
typedef struct {
- uint count;
- u8 addr[7];
+ unsigned count;
+ uint8_t addr[7];
} ipq_gmac_phy_addr_t;
typedef struct {
- uint base;
+ unsigned base;
int unit;
- uint is_macsec;
- uint mac_pwr0;
- uint mac_pwr1;
- uint mac_conn_to_phy;
+ unsigned is_macsec;
+ unsigned mac_pwr0;
+ unsigned mac_pwr1;
+ unsigned mac_conn_to_phy;
phy_interface_t phy;
ipq_gmac_phy_addr_t phy_addr;
} ipq_gmac_board_cfg_t;
@@ -98,6 +112,7 @@ typedef struct {
unsigned int uart_gsbi_base;
unsigned int uart_dm_base;
unsigned int clk_dummy;
+#if 0
uart_clk_mnd_t mnd_value;
unsigned int gmac_gpio_count;
gpio_func_data_t *gmac_gpio;
@@ -105,10 +120,12 @@ typedef struct {
flash_desc flashdesc;
spinorflash_params_t flash_param;
gpio_func_data_t dbg_uart_gpio[NO_OF_DBG_UART_GPIOS];
+#endif
} __attribute__ ((__packed__)) board_ipq806x_params_t;
extern board_ipq806x_params_t *gboard_param;
+#if 0
static inline int gmac_cfg_is_valid(ipq_gmac_board_cfg_t *cfg)
{
/*
@@ -121,7 +138,8 @@ static inline int gmac_cfg_is_valid(ipq_gmac_board_cfg_t *cfg)
(cfg < &gboard_param->gmac_cfg[IPQ_GMAC_NMACS]) &&
(cfg->unit >= 0) && (cfg->unit < IPQ_GMAC_NMACS));
}
+#endif
-unsigned int get_board_index(unsigned int machid);
-void ipq_configure_gpio(gpio_func_data_t *gpio, uint count);
+unsigned int get_board_index(unsigned machid);
+void ipq_configure_gpio(gpio_func_data_t *gpio, unsigned count);
#endif
diff --git a/src/soc/qualcomm/ipq806x/include/iomap.h b/src/soc/qualcomm/ipq806x/include/iomap.h
index 5fcfde9..8642410 100644
--- a/src/soc/qualcomm/ipq806x/include/iomap.h
+++ b/src/soc/qualcomm/ipq806x/include/iomap.h
@@ -43,6 +43,8 @@
*/
#define readl_i(a) read32((const void *)(a))
#define writel_i(v,a) write32(v,(void *)a)
+#include <arch/io.h>
+#include <cdp.h>
#define MSM_CLK_CTL_BASE 0x00900000
@@ -50,7 +52,7 @@
#define MSM_GPT_BASE (MSM_TMR_BASE + 0x04)
#define MSM_DGT_BASE (MSM_TMR_BASE + 0x24)
-#define GPT_REG(off) (MSM_GPT_BASE + (off))
+#define GPT_REG(off) (((uint8_t *)(MSM_GPT_BASE)) + (off))
#define DGT_REG(off) (MSM_DGT_BASE + (off))
#define APCS_WDT0_EN (MSM_TMR_BASE + 0x0040)
diff --git a/src/soc/qualcomm/ipq806x/include/ipq_timer.h b/src/soc/qualcomm/ipq806x/include/ipq_timer.h
new file mode 100644
index 0000000..4e1ef34
--- /dev/null
+++ b/src/soc/qualcomm/ipq806x/include/ipq_timer.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011-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:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google, Inc. nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#define TIMER_LOAD_VAL 0x21
+
+#define GPT_ENABLE_CLR_ON_MATCH_EN 2
+#define GPT_ENABLE_EN 1
+#define DGT_ENABLE_CLR_ON_MATCH_EN 2
+#define DGT_ENABLE_EN 1
+
+#define SPSS_TIMER_STATUS_DGT_EN (1 << 0)
+
+
diff --git a/src/soc/qualcomm/ipq806x/include/timer.h b/src/soc/qualcomm/ipq806x/include/timer.h
deleted file mode 100644
index 4e1ef34..0000000
--- a/src/soc/qualcomm/ipq806x/include/timer.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2011-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:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google, Inc. nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define TIMER_LOAD_VAL 0x21
-
-#define GPT_ENABLE_CLR_ON_MATCH_EN 2
-#define GPT_ENABLE_EN 1
-#define DGT_ENABLE_CLR_ON_MATCH_EN 2
-#define DGT_ENABLE_EN 1
-
-#define SPSS_TIMER_STATUS_DGT_EN (1 << 0)
-
-
diff --git a/src/soc/qualcomm/ipq806x/timer.c b/src/soc/qualcomm/ipq806x/timer.c
index 691ccbd..5c0dcb2 100644
--- a/src/soc/qualcomm/ipq806x/timer.c
+++ b/src/soc/qualcomm/ipq806x/timer.c
@@ -31,14 +31,10 @@
* SUCH DAMAGE.
*/
-#include <asm/arch-ipq806x/iomap.h>
-#include <asm/io.h>
-#include <common.h>
-#include <asm/types.h>
-#include <asm/arch-ipq806x/timer.h>
-
-static ulong timestamp;
-static ulong lastinc;
+#include <delay.h>
+#include <iomap.h>
+#include <ipq_timer.h>
+#include <timer.h>
#define GPT_FREQ_KHZ 32
#define GPT_FREQ (GPT_FREQ_KHZ * 1000) /* 32 KHz */
@@ -46,36 +42,24 @@ static ulong lastinc;
/**
* timer_init - initialize timer
*/
-int timer_init(void)
+void init_timer(void)
{
writel(0, GPT_ENABLE);
writel(GPT_ENABLE_EN, GPT_ENABLE);
- return 0;
-}
-
-/**
- * get_timer - returns time lapsed
- * @base: base/start time
- *
- * Returns time lapsed, since the specified base time value.
- */
-ulong get_timer(ulong base)
-{
- return get_timer_masked() - base;
}
/**
- * __udelay - generates micro second delay.
+ * udelay - generates micro second delay.
* @usec: delay duration in microseconds
*
* With 32KHz clock, minimum possible delay is 31.25 Micro seconds and
* its multiples. In Rumi GPT clock is 32 KHz
*/
-void __udelay(unsigned long usec)
+void udelay(unsigned usec)
{
- unsigned int val;
- ulong now, last;
- ulong runcount;
+ unsigned val;
+ unsigned now, last;
+ unsigned runcount;
usec = (usec + GPT_FREQ_KHZ - 1) / GPT_FREQ_KHZ;
last = readl(GPT_COUNT_VAL);
@@ -92,6 +76,15 @@ void __udelay(unsigned long usec)
} while (runcount < val);
}
+#if 0
+
+/*
+ * TODO(vbendeb) clean it up later.
+ * Compile out the below code but leave it for now in case it will become
+ * necessary later in order to make the platform fully functional.
+ */
+static unsigned long timestamp;
+static unsigned long lastinc;
inline ulong gpt_to_sys_freq(unsigned int gpt)
{
@@ -137,3 +130,4 @@ ulong get_tbclk(void)
{
return GPT_FREQ;
}
+#endif