summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-04-02 12:55:58 -0700
committerChromeBot <chrome-bot@google.com>2013-04-03 11:49:07 -0700
commit4d1aadaf601f04be9f45a540284f9b1184681787 (patch)
treebb1611c290acab471e004c439377d44ac477b5da
parent9137686ebec50f44300168d48617790edf67bece (diff)
downloadchrome-ec-4d1aadaf601f04be9f45a540284f9b1184681787.tar.gz
Trigger dma_init() via HOOK_INIT
There's no need for it to be initalized in board_init(); it just needs to be done before ADC / I2C / SPI initialize. BUG=chrome-os-partner:18343 BRANCH=none TEST=boot spring; verify EC communication and 'adc' console command still work Change-Id: I6039848fe031222d5ca59b459adfe18fc3e8ef08 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47182 Reviewed-by: Vic Yang <victoryang@chromium.org>
-rw-r--r--board/daisy/board.c3
-rw-r--r--board/mccroskey/board.c3
-rw-r--r--board/snow/board.c3
-rw-r--r--board/spring/board.c3
-rw-r--r--chip/stm32/dma.c8
-rw-r--r--include/dma.h (renamed from chip/stm32/dma.h)7
-rw-r--r--include/hooks.h2
7 files changed, 8 insertions, 21 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c
index f48faeb852..2f432d0842 100644
--- a/board/daisy/board.c
+++ b/board/daisy/board.c
@@ -5,7 +5,6 @@
/* Daisy board-specific configuration */
#include "common.h"
-#include "dma.h"
#include "extpower.h"
#include "gaia_power.h"
#include "gpio.h"
@@ -139,8 +138,6 @@ int board_i2c_host_port(void)
void configure_board(void)
{
- dma_init();
-
/* Enable all GPIOs clocks
* TODO: more fine-grained enabling for power saving
*/
diff --git a/board/mccroskey/board.c b/board/mccroskey/board.c
index ba18740b24..22457fad3c 100644
--- a/board/mccroskey/board.c
+++ b/board/mccroskey/board.c
@@ -7,7 +7,6 @@
#include "chipset.h"
#include "common.h"
#include "console.h"
-#include "dma.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
@@ -102,8 +101,6 @@ void configure_board(void)
{
uint32_t val;
- dma_init();
-
/* Enable all GPIOs clocks
* TODO: more fine-grained enabling for power saving
*/
diff --git a/board/snow/board.c b/board/snow/board.c
index 3316ce87ce..7af5011e8a 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -7,7 +7,6 @@
#include "chipset.h"
#include "common.h"
#include "console.h"
-#include "dma.h"
#include "extpower.h"
#include "gaia_power.h"
#include "gpio.h"
@@ -99,8 +98,6 @@ void configure_board(void)
{
uint32_t val;
- dma_init();
-
/* Enable all GPIOs clocks
* TODO: more fine-grained enabling for power saving
*/
diff --git a/board/spring/board.c b/board/spring/board.c
index ed9a269516..2eb324929d 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -8,7 +8,6 @@
#include "chipset.h"
#include "common.h"
#include "console.h"
-#include "dma.h"
#include "extpower.h"
#include "gaia_power.h"
#include "gpio.h"
@@ -115,8 +114,6 @@ void configure_board(void)
{
uint32_t val;
- dma_init();
-
/* Enable all GPIOs clocks
* TODO: more fine-grained enabling for power saving
*/
diff --git a/chip/stm32/dma.c b/chip/stm32/dma.c
index c5d1c5e493..06f65e12f9 100644
--- a/chip/stm32/dma.c
+++ b/chip/stm32/dma.c
@@ -1,11 +1,12 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "board.h"
+#include "common.h"
#include "console.h"
#include "dma.h"
+#include "hooks.h"
#include "registers.h"
#include "task.h"
#include "timer.h"
@@ -192,7 +193,7 @@ void dma_test(void)
}
#endif /* CONFIG_DMA_HELP */
-void dma_init(void)
+static void dma_init(void)
{
int i;
@@ -203,6 +204,7 @@ void dma_init(void)
for (i = 0; i < DMA_NUM_CHANNELS; i++)
id[i] = TASK_ID_INVALID;
}
+DECLARE_HOOK(HOOK_INIT, dma_init, HOOK_PRIO_INIT_DMA);
int dma_wait(int channel)
{
diff --git a/chip/stm32/dma.h b/include/dma.h
index 4aed23ff05..c784558612 100644
--- a/chip/stm32/dma.h
+++ b/include/dma.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -190,11 +190,6 @@ void dma_dump(unsigned channel);
void dma_test(void);
/**
- * Init DMA peripheral ready for use
- */
-void dma_init(void);
-
-/**
* Clear the DMA interrupt/event flags for a given channel
*
* @param channel Which channel's isr to clear (DMAC_...)
diff --git a/include/hooks.h b/include/hooks.h
index 71939d05da..084e9bb36b 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -17,6 +17,8 @@ enum hook_priority {
HOOK_PRIO_LAST = 9999, /* Lowest priority */
/* Specific hook vales for HOOK_INIT */
+ /* DMA inits before ADC, I2C, SPI */
+ HOOK_PRIO_INIT_DMA = HOOK_PRIO_FIRST + 1,
/* LPC inits before modules which need memory-mapped I/O */
HOOK_PRIO_INIT_LPC = HOOK_PRIO_FIRST + 1,
/* Chipset inits before modules which need to know its initial state. */