From: ben-linux@fluff.org (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: gta02: Add gpio bank B quirk for hardware revision 5 and earlier
Date: Tue, 1 Dec 2009 18:27:25 +0000 [thread overview]
Message-ID: <20091201182725.GN4808@trinity.fluff.org> (raw)
In-Reply-To: <1259377532-8012-5-git-send-email-lars@metafoo.de>
On Sat, Nov 28, 2009 at 04:05:32AM +0100, Lars-Peter Clausen wrote:
> On gta02 hardware revision 5 and earlier the basis resistors for transistors of
> the leds are missing and reading their gpio pin status will always return 0.
> So we have to shadow the led states in software. This is done by "hijacking"
> the gpio accessor functions for bank B.
I think it would be worth investigating the idea of having GPxDAT cached
in our gpio chip structure for all banks, as it might even speed up changing
the gpios as instead of read-modify-write an uncached memory area, we would
change the read-cached,modify,write-cached,write-uncached.
I'll try this and see if there is any measurable GPIO performance increase
from doing this.
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Acked-By: Nelson Castillo <arhuaco@freaks-unidos.net>
> ---
> arch/arm/mach-s3c2442/mach-gta02.c | 54 ++++++++++++++++++++++++++++++++++++
> 1 files changed, 54 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c
> index 13b14ab..9298db4 100644
> --- a/arch/arm/mach-s3c2442/mach-gta02.c
> +++ b/arch/arm/mach-s3c2442/mach-gta02.c
> @@ -90,6 +90,7 @@
> #include <plat/pm.h>
> #include <plat/udc.h>
> #include <plat/gpio-cfg.h>
> +#include <plat/gpio-core.h>
> #include <plat/iic.h>
>
> static struct pcf50633 *gta02_pcf;
> @@ -706,11 +707,64 @@ static void gta02_poweroff(void)
> pcf50633_reg_set_bit_mask(gta02_pcf, PCF50633_REG_OOCSHDWN, 1, 1);
> }
>
> +/* On hardware rev 5 and earlier the leds are missing a resistor and reading
> + * from their gpio pins will always return 0, so we have to shadow the
> + * led states software */
> +static unsigned long gpb_shadow;
> +extern struct s3c_gpio_chip s3c24xx_gpios[];
> +
> +static void gta02_gpb_set(struct gpio_chip *chip,
> + unsigned offset, int value)
> +{
> + void __iomem *base = S3C24XX_GPIO_BASE(S3C2410_GPB(0));
> + unsigned long flags;
> + unsigned long dat;
> +
> + local_irq_save(flags);
> +
> + dat = __raw_readl(base + 0x04) | gpb_shadow;
> + dat &= ~(1 << offset);
> + gpb_shadow &= ~(1 << offset);
> + if (value) {
> + dat |= 1 << offset;
> + switch (offset) {
> + case 0 ... 2:
> + gpb_shadow |= 1 << offset;
> + break;
> + default:
> + break;
> + }
> + }
> + __raw_writel(dat, base + 0x04);
> +
> + local_irq_restore(flags);
> +}
> +
> +static int gta02_gpb_get(struct gpio_chip *chip, unsigned offset)
> +{
> + void __iomem *base = S3C24XX_GPIO_BASE(S3C2410_GPB(0));
> + unsigned long val;
> +
> + val = __raw_readl(base + 0x04) | gpb_shadow;
> + val >>= offset;
> + val &= 1;
> +
> + return val;
> +}
> +
> +static void gta02_hijack_gpb(void)
> +{
> + s3c24xx_gpios[1].chip.set = gta02_gpb_set;
> + s3c24xx_gpios[1].chip.get = gta02_gpb_get;
> +}
> +
> static void __init gta02_machine_init(void)
> {
> /* Set the panic callback to make AUX LED blink at ~5Hz. */
> panic_blink = gta02_panic_blink;
>
> + gta02_hijack_gpb();
> +
> s3c_pm_init();
>
> #ifdef CONFIG_CHARGER_PCF50633
> --
> 1.5.6.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
--
Ben
Q: What's a light-year?
A: One-third less calories than a regular year.
next prev parent reply other threads:[~2009-12-01 18:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-28 3:05 ARM: gta02: Add Button, LED and Vibrator support Lars-Peter Clausen
2009-11-28 3:05 ` [PATCH] ARM: gta02: Add button support Lars-Peter Clausen
2009-11-28 3:05 ` [PATCH] ARM: gta02: Add LED support Lars-Peter Clausen
2009-11-28 3:05 ` [PATCH] ARM: gta02: Add vibrator support Lars-Peter Clausen
2009-11-28 3:05 ` [PATCH] ARM: gta02: Add gpio bank B quirk for hardware revision 5 and earlier Lars-Peter Clausen
2009-11-29 8:34 ` Pavel Machek
2009-11-29 10:56 ` Lars-Peter Clausen
2009-11-30 12:31 ` Pavel Machek
2009-11-30 18:56 ` Jamie Lokier
2009-12-01 12:32 ` Pavel Machek
2009-12-01 18:27 ` Ben Dooks [this message]
2009-11-29 8:37 ` [PATCH] ARM: gta02: Add vibrator support Pavel Machek
2009-11-29 8:31 ` [PATCH] ARM: gta02: Add button support Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091201182725.GN4808@trinity.fluff.org \
--to=ben-linux@fluff.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.