summaryrefslogtreecommitdiff
path: root/board/snow
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2012-06-25 13:51:46 -0700
committerGerrit <chrome-bot@google.com>2012-07-02 15:26:02 -0700
commit1bedd55970387fd019c5a6fd368b1576606e8563 (patch)
treee5ecb8d1d60d90ad1a87adcb3f0232294fd9ad73 /board/snow
parentbb27b96f13541f8df5fd8c210a619705c2c24d26 (diff)
downloadchrome-ec-1bedd55970387fd019c5a6fd368b1576606e8563.tar.gz
Daisy/Snow: Drive power LED with PWM
This drives the power LED for Snow (PB3) using TIM2 in PWM mode. Since timer setup and manipulation is STM32-specific, the power LED logic moved to to chip/stm32/power_led.c. This also adds a "powerled" console command for testing. Signed-off-by: David Hendricks <dhendrix@chromium.org> BUG=chrome-os-partner:10647 TEST=Tested on Snow with powerled command, compiled for Daisy Change-Id: I5a7dc20d201ea058767e3e76d54e7c8567a3b83c Reviewed-on: https://gerrit.chromium.org/gerrit/26267 Commit-Ready: David Hendricks <dhendrix@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org>
Diffstat (limited to 'board/snow')
-rw-r--r--board/snow/board.c10
-rw-r--r--board/snow/board.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/board/snow/board.c b/board/snow/board.c
index b536ff3eda..4c9e30bd4b 100644
--- a/board/snow/board.c
+++ b/board/snow/board.c
@@ -56,7 +56,6 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"PMIC_PWRON_L",GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL},
{"ENTERING_RW", GPIO_D, (1<<0), GPIO_OUT_LOW, NULL},
{"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
- {"POWER_LED_L", GPIO_B, (1<<3), GPIO_OUT_HIGH, NULL},
{"EC_INT", GPIO_B, (1<<9), GPIO_HI_Z, NULL},
{"CODEC_INT", GPIO_D, (1<<1), GPIO_HI_Z, NULL},
{"KB_OUT00", GPIO_B, (1<<0), GPIO_KB_OUTPUT, NULL},
@@ -130,6 +129,15 @@ void configure_board(void)
STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x7 << 24))
| (2 << 24);
+ /* remap TIM2_CH2 to PB3 */
+ STM32_GPIO_AFIO_MAPR = (STM32_GPIO_AFIO_MAPR & ~(0x3 << 8))
+ | (1 << 8);
+
+ /* set power LED to alternate function to be driven by TIM2/PWM */
+ val = STM32_GPIO_CRL_OFF(GPIO_B) & ~0x0000f000;
+ val |= 0x00009000;
+ STM32_GPIO_CRL_OFF(GPIO_B) = val;
+
/*
* I2C SCL/SDA on PB10-11 and PB6-7, bi-directional, no pull-up/down,
* initialized as hi-Z until alt. function is set
diff --git a/board/snow/board.h b/board/snow/board.h
index 15db5a64d7..c78a30f574 100644
--- a/board/snow/board.h
+++ b/board/snow/board.h
@@ -79,7 +79,6 @@ enum gpio_signal {
GPIO_PMIC_PWRON_L, /* 5v rail ready */
GPIO_EC_ENTERING_RW, /* EC is R/W mode for the kbc mux */
GPIO_CHARGER_EN,
- GPIO_POWER_LED_L, /* Power state keyboard LED */
GPIO_EC_INT,
GPIO_CODEC_INT, /* To audio codec (KB noise cancellation) */
GPIO_KB_OUT00,