From patchwork Wed Aug 22 17:27:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dromede@gmail.com X-Patchwork-Id: 1362841 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A11853FD40 for ; Wed, 22 Aug 2012 17:31:23 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T4Ei8-0000BM-Cr; Wed, 22 Aug 2012 17:27:20 +0000 Received: from mail-wg0-f49.google.com ([74.125.82.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T4Ei4-0000Ap-08 for linux-arm-kernel@lists.infradead.org; Wed, 22 Aug 2012 17:27:17 +0000 Received: by wgbez12 with SMTP id ez12so724121wgb.18 for ; Wed, 22 Aug 2012 10:27:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=czbxKwEs7c2Am2yWNAfhqKyMkghYZaQjwaIbxBvhVE8=; b=zdBY6t+M5dikUH4Kh9WYKBhFofxF78+1JWJVoD6iMR+2cTJNoU1lv40tEuQ7CRzhOd kPYcPr0Pfn2XddY729ryh7HZ72eVXPAAsl/zeEpyJsGuKCORWml+sFYEGvzihw4rJJbQ ibOank1ed2V0uUm73h+Pqn03BrJjISLr/ew8XTtam3Vx8fyS5qKW7CO9k/rBhHDy+wj7 6PSw0J94Zo8NPL4oR9PQ0W3Q0yAWPevaXpjmWn7C1HbLfosRiwrFw30JSG4HxuUjEw1P nwveOuMtBpIsw3VD2nt22cyFlUiVqWe35ZIwWye2qKM1qCa15Z+IOH9v9juosDz0kI+H VYfg== Received: by 10.216.214.208 with SMTP id c58mr11299632wep.148.1345656428906; Wed, 22 Aug 2012 10:27:08 -0700 (PDT) Received: from localhost.localdomain (93-142-253-239.adsl.net.t-com.hr. [93.142.253.239]) by mx.google.com with ESMTPS id w7sm40124143wiz.0.2012.08.22.10.27.03 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Aug 2012 10:27:04 -0700 (PDT) From: dromede@gmail.com To: linux-arm-kernel@lists.infradead.org Subject: [RFC][PATCH] Disintegrate sharpsl_param.c Date: Wed, 22 Aug 2012 19:27:04 +0200 Message-Id: <1345656424-31234-1-git-send-email-dromede@gmail.com> X-Mailer: git-send-email 1.7.4.1 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.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.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dromede[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: rpurdie@rpsys.net X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Marko Katic I recently tried running 3.6-rc2 kernel on my Sharp Zaurus C-1000. It hanged almost immediately after uncompressing the kernel. I tracked the problem down to a single line in arch/arm/common/sharpsl_param.c: memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info)); Commenting out the line makes the kernel boot just fine. This left me wondering whether sharpsl_param.c is actually needed. Here's a comment from sharpsl_param.c that describes what sharpsl_param.c actually does: /* * Certain hardware parameters determined at the time of device manufacture, * typically including LCD parameters are loaded by the bootloader at the * address PARAM_BASE. As the kernel will overwrite them, we need to store * them early in the boot process, then pass them to the appropriate drivers. * Not all devices use all parameters but the format is common to all. */ So sharpsl_save_param() is supposed to fill the sharpsl_param_info struct with various parameters or fill some of the struct fields with -1. I found only four drivers that use some of these parameters (only two parameters are used by these drivers, comadj and phadadj). These drivers are: drivers/video/backlight/corgi_lcd.c drivers/video/backlight/locomolcd.c drivers/video/backlight/tosa_bl.c drivers/video/backlight/tosa_lcd.c These drivers also have default values when comadj or phadadj == -1. I checked what values are actually contained in this struct in earlier kernels. 3.2.24 kernel is the latest one i know of where sharpsl_save_param() works properly. And it also has these fields initialised to -1. So it seems to me that sharpsl_param.c is redundant as it currently only serves to assign -1 to a few variables. And drivers that use these variables then handle -1 with assigning default values. I propose a patch that completely removes the usage of sharpsl_param.c. I confirm that this patch works fine on a C-1000 and therefore i assume that it should work fine on all machines that use the corgi_lcd.c driver. This patch should be tested on collie and tosa machines. --- arch/arm/common/Kconfig | 3 - arch/arm/common/Makefile | 1 - arch/arm/common/sharpsl_param.c | 62 ----------------------------- arch/arm/include/asm/mach/sharpsl_param.h | 37 ----------------- arch/arm/mach-pxa/Kconfig | 1 - arch/arm/mach-pxa/corgi.c | 2 - arch/arm/mach-pxa/poodle.c | 2 - arch/arm/mach-pxa/spitz.c | 2 - arch/arm/mach-pxa/tosa.c | 2 - arch/arm/mach-sa1100/Kconfig | 1 - arch/arm/mach-sa1100/collie.c | 2 - drivers/power/collie_battery.c | 1 - drivers/video/backlight/corgi_lcd.c | 9 +--- drivers/video/backlight/locomolcd.c | 8 +-- drivers/video/backlight/tosa_bl.c | 4 +- drivers/video/backlight/tosa_lcd.c | 2 - 16 files changed, 6 insertions(+), 133 deletions(-) delete mode 100644 arch/arm/common/sharpsl_param.c delete mode 100644 arch/arm/include/asm/mach/sharpsl_param.h diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 283fa1d..8a2688a 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig @@ -35,8 +35,5 @@ config DMABOUNCE config SHARP_LOCOMO bool -config SHARP_PARAM - bool - config SHARP_SCOOP bool diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile index e8a4e58..c8634c8 100644 --- a/arch/arm/common/Makefile +++ b/arch/arm/common/Makefile @@ -9,7 +9,6 @@ obj-$(CONFIG_SA1111) += sa1111.o obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o obj-$(CONFIG_DMABOUNCE) += dmabounce.o obj-$(CONFIG_SHARP_LOCOMO) += locomo.o -obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o diff --git a/arch/arm/common/sharpsl_param.c b/arch/arm/common/sharpsl_param.c deleted file mode 100644 index d56c932..0000000 --- a/arch/arm/common/sharpsl_param.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Hardware parameter area specific to Sharp SL series devices - * - * Copyright (c) 2005 Richard Purdie - * - * Based on Sharp's 2.4 kernel patches - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -#include -#include -#include -#include - -/* - * Certain hardware parameters determined at the time of device manufacture, - * typically including LCD parameters are loaded by the bootloader at the - * address PARAM_BASE. As the kernel will overwrite them, we need to store - * them early in the boot process, then pass them to the appropriate drivers. - * Not all devices use all parameters but the format is common to all. - */ -#ifdef CONFIG_ARCH_SA1100 -#define PARAM_BASE 0xe8ffc000 -#else -#define PARAM_BASE 0xa0000a00 -#endif -#define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a ) - -#define COMADJ_MAGIC MAGIC_CHG('C','M','A','D') -#define UUID_MAGIC MAGIC_CHG('U','U','I','D') -#define TOUCH_MAGIC MAGIC_CHG('T','U','C','H') -#define AD_MAGIC MAGIC_CHG('B','V','A','D') -#define PHAD_MAGIC MAGIC_CHG('P','H','A','D') - -struct sharpsl_param_info sharpsl_param; -EXPORT_SYMBOL(sharpsl_param); - -void sharpsl_save_param(void) -{ - memcpy(&sharpsl_param, (void *)PARAM_BASE, sizeof(struct sharpsl_param_info)); - - if (sharpsl_param.comadj_keyword != COMADJ_MAGIC) - sharpsl_param.comadj=-1; - - if (sharpsl_param.phad_keyword != PHAD_MAGIC) - sharpsl_param.phadadj=-1; - - if (sharpsl_param.uuid_keyword != UUID_MAGIC) - sharpsl_param.uuid[0]=-1; - - if (sharpsl_param.touch_keyword != TOUCH_MAGIC) - sharpsl_param.touch_xp=-1; - - if (sharpsl_param.adadj_keyword != AD_MAGIC) - sharpsl_param.adadj=-1; -} - - diff --git a/arch/arm/include/asm/mach/sharpsl_param.h b/arch/arm/include/asm/mach/sharpsl_param.h deleted file mode 100644 index 7a24ecf..0000000 --- a/arch/arm/include/asm/mach/sharpsl_param.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Hardware parameter area specific to Sharp SL series devices - * - * Copyright (c) 2005 Richard Purdie - * - * Based on Sharp's 2.4 kernel patches - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - */ - -struct sharpsl_param_info { - unsigned int comadj_keyword; - unsigned int comadj; - - unsigned int uuid_keyword; - unsigned char uuid[16]; - - unsigned int touch_keyword; - unsigned int touch_xp; - unsigned int touch_yp; - unsigned int touch_xd; - unsigned int touch_yd; - - unsigned int adadj_keyword; - unsigned int adadj; - - unsigned int phad_keyword; - unsigned int phadadj; -} __attribute__((packed)); - - -extern struct sharpsl_param_info sharpsl_param; -extern void sharpsl_save_param(void); - diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index fe2d1f8..71e9429 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig @@ -471,7 +471,6 @@ config MACH_RAUMFELD_SPEAKER config PXA_SHARPSL bool "SHARP Zaurus SL-5600, SL-C7xx and SL-Cxx00 Models" select SHARP_SCOOP - select SHARP_PARAM help Say Y here if you intend to run this kernel on a Sharp Zaurus SL-5600 (Poodle), SL-C700 (Corgi), diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index c1fe32d..1ddf87f 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c @@ -52,7 +52,6 @@ #include #include -#include #include #include "generic.h" @@ -716,7 +715,6 @@ static void __init corgi_init(void) static void __init fixup_corgi(struct tag *tags, char **cmdline, struct meminfo *mi) { - sharpsl_save_param(); mi->nr_banks=1; mi->bank[0].start = 0xa0000000; if (machine_is_corgi()) diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 89d98c8..0c4c083 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c @@ -48,7 +48,6 @@ #include #include -#include #include "generic.h" #include "devices.h" @@ -457,7 +456,6 @@ static void __init poodle_init(void) static void __init fixup_poodle(struct tag *tags, char **cmdline, struct meminfo *mi) { - sharpsl_save_param(); mi->nr_banks=1; mi->bank[0].start = 0xa0000000; mi->bank[0].size = (32*1024*1024); diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 363d91b..9a0d583 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -971,7 +970,6 @@ static void __init spitz_init(void) static void __init spitz_fixup(struct tag *tags, char **cmdline, struct meminfo *mi) { - sharpsl_save_param(); mi->nr_banks = 1; mi->bank[0].start = 0xa0000000; mi->bank[0].size = (64*1024*1024); diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 4d4eb60..3f8fe17 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c @@ -53,7 +53,6 @@ #include #include -#include #include "generic.h" #include "clock.h" @@ -968,7 +967,6 @@ static void __init tosa_init(void) static void __init fixup_tosa(struct tag *tags, char **cmdline, struct meminfo *mi) { - sharpsl_save_param(); mi->nr_banks=1; mi->bank[0].start = 0xa0000000; mi->bank[0].size = (64*1024*1024); diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig index 42625e4..87b8604 100644 --- a/arch/arm/mach-sa1100/Kconfig +++ b/arch/arm/mach-sa1100/Kconfig @@ -50,7 +50,6 @@ config SA1100_COLLIE # FIXME: select CPU_FREQ_SA11x0 select SHARP_LOCOMO select SHARP_SCOOP - select SHARP_PARAM help Say Y here to support the Sharp Zaurus SL5500 PDAs. diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index ea5cff3..98287a4 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c @@ -43,7 +43,6 @@ #include #include -#include #include #include #include @@ -366,7 +365,6 @@ static void __init collie_init(void) ARRAY_SIZE(collie_flash_resources)); sa11x0_register_mcp(&collie_mcp_data); - sharpsl_save_param(); } static struct map_desc collie_io_desc[] __initdata = { diff --git a/drivers/power/collie_battery.c b/drivers/power/collie_battery.c index 74c6b23..e83b963 100644 --- a/drivers/power/collie_battery.c +++ b/drivers/power/collie_battery.c @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index c781768..c28838a 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -25,7 +25,6 @@ #include #include #include -#include #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL) @@ -195,9 +194,7 @@ static void lcdtg_set_phadadj(struct corgi_lcd *lcd, int mode) switch(mode) { case CORGI_LCD_MODE_VGA: /* Setting for VGA */ - adj = sharpsl_param.phadadj; - adj = (adj < 0) ? PHACTRL_PHASE_MANUAL : - PHACTRL_PHASE_MANUAL | ((adj & 0xf) << 1); + adj = PHACTRL_PHASE_MANUAL; break; case CORGI_LCD_MODE_QVGA: default: @@ -242,9 +239,7 @@ static void corgi_lcd_power_on(struct corgi_lcd *lcd) PICTRL_INIT_STATE | PICTRL_COM_SIGNAL_OFF); /* Set Common Voltage */ - comadj = sharpsl_param.comadj; - if (comadj < 0) - comadj = DEFAULT_COMADJ; + comadj = DEFAULT_COMADJ; lcdtg_set_common_voltage(lcd, POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_OFF, comadj); diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index 3a6d541..62c4cb9 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -21,7 +21,6 @@ #include #include -#include #include #include "../../../arch/arm/mach-sa1100/generic.h" @@ -82,7 +81,7 @@ static void locomolcd_off(int comadj) void locomolcd_power(int on) { - int comadj = sharpsl_param.comadj; + int comadj; unsigned long flags; local_irq_save(flags); @@ -92,10 +91,9 @@ void locomolcd_power(int on) return; } - /* read comadj */ - if (comadj == -1 && machine_is_collie()) + if (machine_is_collie()) comadj = 128; - if (comadj == -1 && machine_is_poodle()) + if (machine_is_poodle()) comadj = 118; if (on) diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index 49342e1..2918075 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c @@ -20,8 +20,6 @@ #include #include -#include - #include #define COMADJ_DEFAULT 97 @@ -90,7 +88,7 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, if (!data) return -ENOMEM; - data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj; + data->comadj = COMADJ_DEFAULT; ret = devm_gpio_request(&client->dev, TOSA_GPIO_BL_C20MA, "backlight"); if (ret) { diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c index 33047a66..6fc575f 100644 --- a/drivers/video/backlight/tosa_lcd.c +++ b/drivers/video/backlight/tosa_lcd.c @@ -21,8 +21,6 @@ #include #include -#include - #include #define POWER_IS_ON(pwr) ((pwr) <= FB_BLANK_NORMAL)