summaryrefslogtreecommitdiff
path: root/chip/npcx/gpio.c
diff options
context:
space:
mode:
authorMulin Chao <mlchao@nuvoton.com>2017-03-22 17:42:34 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-03-24 06:49:55 -0700
commite43ba03ebf3c921f2abfd4e9153725e87f28da62 (patch)
treee25bf9ac0b742400e88b83ea95b673fa40ccedeb /chip/npcx/gpio.c
parent61f61b368eeacc3c4d4627bdfa8d81e9b6538675 (diff)
downloadchrome-ec-e43ba03ebf3c921f2abfd4e9153725e87f28da62.tar.gz
npcx: Move pwm open-drain functionality from gpio to pwm driver.
Setting PWM IO type in gpio driver seems not a proper way. This CL moves this functionality to pwm driver and introduces a new flag PWM_CONFIG_OPEN_DRAIN to achieve it when user declared it in board driver. BRANCH=none BUG=none TEST=test pwm functionality on npcx_evb. Change-Id: I90c60445d1fb10902244ddf0f635d8304e72f4ab Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/458043 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/npcx/gpio.c')
-rw-r--r--chip/npcx/gpio.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c
index b3916027fc..d49872c808 100644
--- a/chip/npcx/gpio.c
+++ b/chip/npcx/gpio.c
@@ -34,10 +34,6 @@ static const struct npcx_wui gpio_wui_table[] = {
#include "gpio.wrap"
};
-/* Flags for PWM IO type */
-#define PWM_IO_FUNC (1 << 1) /* PWM optional func bit */
-#define PWM_IO_OD (1 << 2) /* PWM IO open-drain bit */
-
struct npcx_gpio {
uint8_t port : 4;
uint8_t bit : 3;
@@ -199,16 +195,6 @@ static int gpio_match(uint8_t port, uint8_t mask, struct npcx_gpio gpio)
return (gpio.valid && (gpio.port == port) && ((1 << gpio.bit) == mask));
}
-static void gpio_pwm_io_type_sel(uint8_t chan, uint8_t func)
-{
- if (func & PWM_IO_OD)
- /* Set PWM open drain output is open drain type*/
- SET_BIT(NPCX_PWMCTLEX(chan), NPCX_PWMCTLEX_OD_OUT);
- else
- /* Set PWM open drain output is push-pull type*/
- CLEAR_BIT(NPCX_PWMCTLEX(chan), NPCX_PWMCTLEX_OD_OUT);
-}
-
static int gpio_alt_sel(uint8_t port, uint8_t bit, int8_t func)
{
struct gpio_alt_map const *map;
@@ -228,10 +214,6 @@ static int gpio_alt_sel(uint8_t port, uint8_t bit, int8_t func)
else
NPCX_DEVALT(map->alt.group) |= alt_mask;
- /* PWM optional functionality */
- if ((func >= 0) && (func & PWM_IO_FUNC))
- gpio_pwm_io_type_sel(map->alt.bit, func);
-
return 1;
}
}