From patchwork Thu Nov 13 09:32:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 40715 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC28624493 for ; Thu, 13 Nov 2014 09:43:12 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id mc6sf8782702lab.11 for ; Thu, 13 Nov 2014 01:43:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=xDlFs8nFzREBi/nxg94YeURmI+dpGOe08ijApB3G7L0=; b=bMls23wPZznjKUU01GgW5HvQ8z/ccTC2fNdNqkxiZ+vqD9dFzF9JXaiKQs87HRlk9a SKBLk+vY24IptPrQf3E+OvtG9KSuB5y2yWVOVkyS5i+MiUvHvJZlcIqcYIr3omP4jPdb MCPukQkCfHrbnbWlddYiRZbFiBndx1rkqSde5OC50pRx7XtUVlVTYMpuA8mGhra/uaov zIf2KT0rf/lA58JlUdjJiH/uZg4jCsJmZWIzsq0pPGS159AnC4zInEihWk7limN8sDyy fIJ/Jp6ryUE2Y4dsiMxqZ2dNYbpMPo4T2Nvs6EpMXDh1fv/6nEaeO55orlGk63AX1KZD EA5A== X-Gm-Message-State: ALoCoQlye92pIhGVLbDzTQ+4WQWpSwY0AQmaioyVK30Q1NSFUxCZzQmG2M75mK2yXF+SAHuOZI5X X-Received: by 10.112.137.202 with SMTP id qk10mr554437lbb.11.1415871791740; Thu, 13 Nov 2014 01:43:11 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.169 with SMTP id 9ls833500lan.109.gmail; Thu, 13 Nov 2014 01:43:11 -0800 (PST) X-Received: by 10.112.173.100 with SMTP id bj4mr1339661lbc.78.1415871791499; Thu, 13 Nov 2014 01:43:11 -0800 (PST) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id jb8si18766587lbc.58.2014.11.13.01.43.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Nov 2014 01:43:11 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by mail-la0-f47.google.com with SMTP id gd6so12611230lab.6 for ; Thu, 13 Nov 2014 01:43:11 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr1280530lbc.23.1415871791377; Thu, 13 Nov 2014 01:43:11 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp562347lbc; Thu, 13 Nov 2014 01:43:10 -0800 (PST) X-Received: by 10.70.134.74 with SMTP id pi10mr1446235pdb.126.1415871789630; Thu, 13 Nov 2014 01:43:09 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id fc5si25271704pdb.29.2014.11.13.01.43.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Nov 2014 01:43:09 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xoqtr-00019S-Ga; Thu, 13 Nov 2014 09:41:11 +0000 Received: from mail-wg0-f43.google.com ([74.125.82.43]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xoqmf-0007FV-Vx for linux-arm-kernel@lists.infradead.org; Thu, 13 Nov 2014 09:33:47 +0000 Received: by mail-wg0-f43.google.com with SMTP id y10so16298676wgg.30 for ; Thu, 13 Nov 2014 01:33:23 -0800 (PST) X-Received: by 10.180.100.129 with SMTP id ey1mr2125983wib.28.1415871203349; Thu, 13 Nov 2014 01:33:23 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id s8sm34780905wjx.9.2014.11.13.01.33.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Nov 2014 01:33:22 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] ARM: integrator: move debug LEDs to syscon LED driver Date: Thu, 13 Nov 2014 10:32:54 +0100 Message-Id: <1415871176-11368-2-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1415871176-11368-1-git-send-email-linus.walleij@linaro.org> References: <1415871176-11368-1-git-send-email-linus.walleij@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141113_013346_211062_DBC908A5 X-CRM114-Status: GOOD ( 15.93 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.43 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.43 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Linus Walleij X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The Integrator debug block is a simple set of registers, make it a syscon and register the four LEDs on the Integrator/AP baseboard as syscon LEDs. Signed-off-by: Linus Walleij --- arch/arm/boot/dts/integrator.dtsi | 36 +++++++++++++++++++++++++++++ arch/arm/mach-integrator/leds.c | 48 ++------------------------------------- 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi index 5546630c4fd2..5d27087d5248 100644 --- a/arch/arm/boot/dts/integrator.dtsi +++ b/arch/arm/boot/dts/integrator.dtsi @@ -82,5 +82,41 @@ reg = <0x19000000 0x1000>; interrupts = <4>; }; + + syscon { + /* Debug registers mapped as syscon */ + compatible = "syscon"; + reg = <0x1a000000 0x10>; + + led@04.0 { + compatible = "register-bit-led"; + offset = <0x04>; + mask = <0x01>; + label = "integrator:green0"; + linux,default-trigger = "heartbeat"; + default-state = "on"; + }; + led@04.1 { + compatible = "register-bit-led"; + offset = <0x04>; + mask = <0x02>; + label = "integrator:yellow"; + default-state = "off"; + }; + led@04.2 { + compatible = "register-bit-led"; + offset = <0x04>; + mask = <0x04>; + label = "integrator:red"; + default-state = "off"; + }; + led@04.3 { + compatible = "register-bit-led"; + offset = <0x04>; + mask = <0x08>; + label = "integrator:green1"; + default-state = "off"; + }; + }; }; }; diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c index f1dcb57a59e2..56f243744b98 100644 --- a/arch/arm/mach-integrator/leds.c +++ b/arch/arm/mach-integrator/leds.c @@ -16,12 +16,8 @@ #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) -#define ALPHA_REG __io_address(INTEGRATOR_DBG_BASE) -#define LEDREG (__io_address(INTEGRATOR_DBG_BASE) + INTEGRATOR_DBG_LEDS_OFFSET) - struct integrator_led { struct led_classdev cdev; - u8 mask; }; /* @@ -32,40 +28,9 @@ static const struct { const char *name; const char *trigger; } integrator_leds[] = { - { "integrator:green0", "heartbeat", }, - { "integrator:yellow", }, - { "integrator:red", }, - { "integrator:green1", }, { "integrator:core_module", "cpu0", }, }; -static void integrator_led_set(struct led_classdev *cdev, - enum led_brightness b) -{ - struct integrator_led *led = container_of(cdev, - struct integrator_led, cdev); - u32 reg = __raw_readl(LEDREG); - - if (b != LED_OFF) - reg |= led->mask; - else - reg &= ~led->mask; - - while (__raw_readl(ALPHA_REG) & 1) - cpu_relax(); - - __raw_writel(reg, LEDREG); -} - -static enum led_brightness integrator_led_get(struct led_classdev *cdev) -{ - struct integrator_led *led = container_of(cdev, - struct integrator_led, cdev); - u32 reg = __raw_readl(LEDREG); - - return (reg & led->mask) ? LED_FULL : LED_OFF; -} - static void cm_led_set(struct led_classdev *cdev, enum led_brightness b) { @@ -93,19 +58,10 @@ static int __init integrator_leds_init(void) if (!led) break; - led->cdev.name = integrator_leds[i].name; - - if (i == 4) { /* Setting for LED in core module */ - led->cdev.brightness_set = cm_led_set; - led->cdev.brightness_get = cm_led_get; - } else { - led->cdev.brightness_set = integrator_led_set; - led->cdev.brightness_get = integrator_led_get; - } - + led->cdev.brightness_set = cm_led_set; + led->cdev.brightness_get = cm_led_get; led->cdev.default_trigger = integrator_leds[i].trigger; - led->mask = BIT(i); if (led_classdev_register(NULL, &led->cdev) < 0) { kfree(led);