From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C60CC4321E for ; Sun, 4 Dec 2022 15:06:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 669A6852FB; Sun, 4 Dec 2022 16:06:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="KaIzA+kN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC659852FC; Sun, 4 Dec 2022 16:06:00 +0100 (CET) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5F284852F1 for ; Sun, 4 Dec 2022 16:05:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-ej1-x62d.google.com with SMTP id qk9so4533364ejc.3 for ; Sun, 04 Dec 2022 07:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vWgPoCys7788JpcL1YW3iaIYsAdDu6tg3dTQT1HiWXE=; b=KaIzA+kN+Khi6phfg4SBo9G6sXfobeynFD/tlTD70ozfgyJpjNKULvBd2JkzKi2dsX iemmQWVP+w81p9l5cB+JYdTu9W9jFKrlpUx21EoIaOmK6wuj4dkvvVysHzae8c74tMII 7vsCHbs4aLzBveiq4DVdsrrWZr/GSSjitCoII= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vWgPoCys7788JpcL1YW3iaIYsAdDu6tg3dTQT1HiWXE=; b=jzSCa4y4e5kNCgBiWkqXcOPyph4/BcFMwWC4gIpVuHVw5NgmsZHdBhMx6NlLHMRgeP cCyvDo0jvbJLAJdFyj+LYvZanpihcTDVkncWQOLRt5LFEG8MzGshZ9ghh2/JmUI093bS TCz1O5/EIN6lzQUwW0uY1PhtTwr9oiMBAukvL3xLWPtXtCjAGREbcP0OFsclA20NcAcB liNHwgh6kUrdwNEN34/W+kstiF9U/IQGdASxek89U+hklgYT7W9HEwCCMKR7FMC4zpU2 /oME1heIrs8yn53wXzcRMkzJ7FVaYchEBL/UFfgRtN47JxUSlEbze8VaKjxpEuwGsaoq yYMQ== X-Gm-Message-State: ANoB5plT0Bhimmv/QbtgYmHVPt2DUgYuh1DTnSBlqFwnTfBPefgJB044 iUviCNvV3CB6jkM7G3Hl/E8q/FaeIL4xfOSE X-Google-Smtp-Source: AA0mqf7Wxk/frNfuKeQDndgzY1+ueFDGLHqjrn8JYyfLCSw3F0VLcFR1vudSiR8Y8HZphDbDTw75ow== X-Received: by 2002:a17:906:5442:b0:7c0:4030:ae09 with SMTP id d2-20020a170906544200b007c04030ae09mr4145690ejp.322.1670166357752; Sun, 04 Dec 2022 07:05:57 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-61c7-2644-b62d-0af3.res6.spectrum.com. [2603:6081:7b00:6400:61c7:2644:b62d:af3]) by smtp.gmail.com with ESMTPSA id g1-20020a17090604c100b0073dc5bb7c32sm5240058eja.64.2022.12.04.07.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Dec 2022 07:05:57 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Cc: Minkyu Kang , Jaehoon Chung , Dzmitry Sankouski , Stefan Bosch Subject: [PATCH 001/149] exynos: Rework legacy PWM usage Date: Sun, 4 Dec 2022 10:03:26 -0500 Message-Id: <20221204150554.4165941-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221202214251.3027264-41-trini@konsulko.com> References: <20221202214251.3027264-41-trini@konsulko.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean The way that the timer support is currently done for exynos/nexell platforms relies on the legacy PWM infrastructure, and that needs to be updated. However, we really cannot safely undef CONFIG_DM_PWM to build the timer.c file without warnings. For now, rename the relevant legacy functions to be prefixed with s5p_ and add prototypes to the arch pwm.h files. Cc: Minkyu Kang Cc: Jaehoon Chung Cc: Dzmitry Sankouski Cc: Stefan Bosch Signed-off-by: Tom Rini --- arch/arm/cpu/armv7/s5p-common/pwm.c | 11 +++++------ arch/arm/cpu/armv7/s5p-common/timer.c | 10 +++------- arch/arm/mach-exynos/include/mach/pwm.h | 5 +++++ arch/arm/mach-nexell/include/mach/pwm.h | 5 +++++ arch/arm/mach-s5pc1xx/include/mach/pwm.h | 5 +++++ board/friendlyarm/nanopi2/board.c | 4 ++-- board/friendlyarm/nanopi2/onewire.c | 4 ++-- 7 files changed, 27 insertions(+), 17 deletions(-) diff --git a/arch/arm/cpu/armv7/s5p-common/pwm.c b/arch/arm/cpu/armv7/s5p-common/pwm.c index aef2e5574b41..5068327d3c5f 100644 --- a/arch/arm/cpu/armv7/s5p-common/pwm.c +++ b/arch/arm/cpu/armv7/s5p-common/pwm.c @@ -7,12 +7,11 @@ #include #include -#include #include #include #include -int pwm_enable(int pwm_id) +int s5p_pwm_enable(int pwm_id) { const struct s5p_timer *pwm = #if defined(CONFIG_ARCH_NEXELL) @@ -30,7 +29,7 @@ int pwm_enable(int pwm_id) return 0; } -void pwm_disable(int pwm_id) +void s5p_pwm_disable(int pwm_id) { const struct s5p_timer *pwm = #if defined(CONFIG_ARCH_NEXELL) @@ -92,7 +91,7 @@ static unsigned long pwm_calc_tin(int pwm_id, unsigned long freq) #define NS_IN_SEC 1000000000UL -int pwm_config(int pwm_id, int duty_ns, int period_ns) +int s5p_pwm_config(int pwm_id, int duty_ns, int period_ns) { const struct s5p_timer *pwm = #if defined(CONFIG_ARCH_NEXELL) @@ -157,7 +156,7 @@ int pwm_config(int pwm_id, int duty_ns, int period_ns) return 0; } -int pwm_init(int pwm_id, int div, int invert) +int s5p_pwm_init(int pwm_id, int div, int invert) { u32 val; const struct s5p_timer *pwm = @@ -219,7 +218,7 @@ int pwm_init(int pwm_id, int div, int invert) val |= TCON_INVERTER(pwm_id); writel(val, &pwm->tcon); - pwm_enable(pwm_id); + s5p_pwm_enable(pwm_id); return 0; } diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c index 8533d04878c2..f4a045e2f0d2 100644 --- a/arch/arm/cpu/armv7/s5p-common/timer.c +++ b/arch/arm/cpu/armv7/s5p-common/timer.c @@ -16,10 +16,6 @@ #include #include -/* Use the old PWM interface for now */ -#undef CONFIG_DM_PWM -#include - DECLARE_GLOBAL_DATA_PTR; unsigned long get_current_tick(void); @@ -49,9 +45,9 @@ static unsigned long timer_get_us_down(void) int timer_init(void) { /* PWM Timer 4 */ - pwm_init(4, MUX_DIV_4, 0); - pwm_config(4, 100000, 100000); - pwm_enable(4); + s5p_pwm_init(4, MUX_DIV_4, 0); + s5p_pwm_config(4, 100000, 100000); + s5p_pwm_enable(4); /* Use this as the current monotonic time in us */ gd->arch.timer_reset_value = 0; diff --git a/arch/arm/mach-exynos/include/mach/pwm.h b/arch/arm/mach-exynos/include/mach/pwm.h index 417fc15551d5..17372492d586 100644 --- a/arch/arm/mach-exynos/include/mach/pwm.h +++ b/arch/arm/mach-exynos/include/mach/pwm.h @@ -49,6 +49,11 @@ struct s5p_timer { unsigned int tcnto4; unsigned int tintcstat; }; + +int s5p_pwm_init (int pwm_id, int div, int invert); +int s5p_pwm_config (int pwm_id, int duty_ns, int period_ns); +int s5p_pwm_enable (int pwm_id); +void s5p_pwm_disable (int pwm_id); #endif /* __ASSEMBLY__ */ #endif diff --git a/arch/arm/mach-nexell/include/mach/pwm.h b/arch/arm/mach-nexell/include/mach/pwm.h index 08a287d308ff..1e12058dd534 100644 --- a/arch/arm/mach-nexell/include/mach/pwm.h +++ b/arch/arm/mach-nexell/include/mach/pwm.h @@ -49,6 +49,11 @@ struct s5p_timer { unsigned int tcnto4; unsigned int tintcstat; }; + +int s5p_pwm_init (int pwm_id, int div, int invert); +int s5p_pwm_config (int pwm_id, int duty_ns, int period_ns); +int s5p_pwm_enable (int pwm_id); +void s5p_pwm_disable (int pwm_id); #endif /* __ASSEMBLY__ */ #endif diff --git a/arch/arm/mach-s5pc1xx/include/mach/pwm.h b/arch/arm/mach-s5pc1xx/include/mach/pwm.h index 1a531beddc63..6d53e52f6497 100644 --- a/arch/arm/mach-s5pc1xx/include/mach/pwm.h +++ b/arch/arm/mach-s5pc1xx/include/mach/pwm.h @@ -49,6 +49,11 @@ struct s5p_timer { unsigned int tcnto4; unsigned int tintcstat; }; + +int s5p_pwm_init (int pwm_id, int div, int invert); +int s5p_pwm_config (int pwm_id, int duty_ns, int period_ns); +int s5p_pwm_enable (int pwm_id); +void s5p_pwm_disable (int pwm_id); #endif /* __ASSEMBLY__ */ #endif diff --git a/board/friendlyarm/nanopi2/board.c b/board/friendlyarm/nanopi2/board.c index 954197282e6b..393c5a447d6f 100644 --- a/board/friendlyarm/nanopi2/board.c +++ b/board/friendlyarm/nanopi2/board.c @@ -80,9 +80,9 @@ static void bd_backlight_on(void) #elif defined(BACKLIGHT_CH) /* pwm backlight ON: HIGH, ON: LOW */ - pwm_init(BACKLIGHT_CH, + s5p_pwm_init(BACKLIGHT_CH, BACKLIGHT_DIV, BACKLIGHT_INV); - pwm_config(BACKLIGHT_CH, + s5p_pwm_config(BACKLIGHT_CH, TO_DUTY_NS(BACKLIGHT_DUTY, BACKLIGHT_HZ), TO_PERIOD_NS(BACKLIGHT_HZ)); #endif diff --git a/board/friendlyarm/nanopi2/onewire.c b/board/friendlyarm/nanopi2/onewire.c index fb356639be2f..56f0f2dfceba 100644 --- a/board/friendlyarm/nanopi2/onewire.c +++ b/board/friendlyarm/nanopi2/onewire.c @@ -9,8 +9,8 @@ #include #include #include +#include #include -#include #include @@ -102,7 +102,7 @@ static int onewire_init_timer(void) /* range: 1080~1970 */ period_ns -= 1525; - return pwm_config(PWM_CH, period_ns >> 1, period_ns); + return s5p_pwm_config(PWM_CH, period_ns >> 1, period_ns); } static void wait_one_tick(void) -- 2.25.1