Re: [Zaurus-devel] Zaurus CF tests -- ok
Hi! Backtrace from QEMU ... I think this is what Cyril observed. But heck, it happens in QEMU too ;-) Yes, that is pretty much it. It happens randomly, eg. adding printk() line into kernel code (somewhere in mmc stack). Or sometimes crashes in the pccard initalization when two cards are inserted at the boot time. It happens randomly in qemu too. -- metan ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
Re: [Zaurus-devel] zaurus: mmcblk0: error -110
On Wednesday, April 13, 2011 07:10:53 PM Marek Vasut wrote: On Tuesday, April 12, 2011 08:04:14 PM Pavel Machek wrote: On Tue 2011-04-12 17:52:17, Cyril Hrubis wrote: Hi! Which model do you have? And check the corresponding board file if card detect GPIO handling is doing right. I've got spitz (SL-3200). So I suppose the board file is arch/arm/mach-pxa/spitz.c, I'll have a look. Hmm, besides cleanup by Marek Vasut there were no changes in the code. And it seems that it was just cleanup in spitz_card_pwr_ctrl(). With vanilla 2.6.38, I observe similar problem. MMC removal is not detected; I get error -110 whilst initalising SD card on reinsert. Pavel I don't observe this problem with my tree (.38-rc8+). I'll have to check properly though. (On SL-C1000) Cyril, can you bisect between .37 and .38? I suspect some change in mmc subsys. Cheers I see it was solved, ignore this ;-) ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
Re: [Zaurus-devel] 2.6.36-rc1 on zaurus: bluetooth regression
Dne So 21. srpna 2010 17:24:45 Pavel Machek napsal(a): Hi! Good news is that it boots, suspends and resumes. Bad news is that bluetooth broke for me. I'm using CF bluetooth card. Socket 0 Bridge: [pxa2xx-pcmcia] (bus ID: pxa2xx-pcmcia) Configuration: state: on ready: yes Voltage: 3.3V Vcc: 3.3V Vpp: 0.0V Socket 0 Device 0:[serial_cs] (bus ID: 0.0) Configuration: state: on Product Name: Compact Flash Bluetooth Card Identification: manf_id: 0x0279 card_id: 0x950b function: 2 (serial) prod_id(1): Compact Flash (0x95521410) prod_id(2): Bluetooth Card (0x7664fb1d) prod_id(3): --- (---) prod_id(4): --- (---) Socket 1 Bridge: [pxa2xx-pcmcia] (bus ID: pxa2xx-pcmcia) Configuration: state: on ready: yes Voltage: 3.3V Vcc: 3.3V Vpp: 0.0V Socket 1 Device 0:[ide-cs](bus ID: 1.0) Configuration: state: on Product Name: HITACHI microdrive Identification: manf_id: 0x0319 card_id: 0x function: 4 (fixed disk) prod_id(1): HITACHI (0xf4f43949) prod_id(2): microdrive (0xa6d76178) prod_id(3): --- (---) prod_id(4): --- (---) In 2.6.35, I have lots of messages in the syslog, and speed is slow, but it works. Aug 19 08:01:06 toy kernel: bcsp_recv: Out-of-order packet arrived, got 3 expected 2 Aug 19 08:01:06 toy kernel: bcsp_recv: Out-of-order packet arrived, got 4 expected 2 Aug 19 08:01:11 toy kernel: bcsp_recv: Short BCSP packet Aug 19 08:01:11 toy kernel: bcsp_recv: Out-of-order packet arrived, got 3 expected 2 Aug 19 08:01:11 toy kernel: bcsp_recv: Out-of-order packet arrived, got 4 expected 2 Aug 19 08:01:12 toy kernel: bcsp_recv: Out-of-order packet arrived, got 5 expected 2 Aug 19 08:01:16 toy kernel: bcsp_recv: Short BCSP packet Aug 19 08:01:16 toy kernel: bcsp_recv: Out-of-order packet arrived, got 2 expected 1 Aug 19 08:01:16 toy kernel: bcsp_recv: Out-of-order packet arrived, got 3 expected 1 Aug 19 08:01:16 toy kernel: bcsp_recv: Out-of-order packet arrived, got 4 expected 1 In 2.6.36-rc1, I get: Aug 20 08:38:27 toy bluetoothd[1318]: HCI dev 0 down Aug 20 08:38:27 toy bluetoothd[1318]: Adapter /org/bluez/1318/hci0 has been disabled Aug 20 08:38:27 toy bluetoothd[1318]: Stopping security manager 0 Aug 20 08:38:27 toy kernel: pcmcia_socket pcmcia_socket0: pccard: card ejected from slot 0 Aug 20 08:38:27 toy kernel: PM: Removing info for pcmcia:0.0 Aug 20 08:38:27 toy kernel: PM: Removing info for No Bus:ttyS0 Aug 20 08:38:27 toy bluetoothd[1318]: HCI dev 0 unregistered Aug 20 08:38:27 toy bluetoothd[1318]: Unregister path: /org/bluez/1318/hci0 Aug 20 08:38:27 toy kernel: PM: Removing info for No Bus:hci0 Aug 20 08:38:27 toy kernel: PM: Adding info for No Bus:ttyS0 Aug 20 08:38:31 toy kernel: pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0 Aug 20 08:38:31 toy kernel: pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 201) Aug 20 08:38:31 toy kernel: PM: Adding info for pcmcia:0.0 Aug 20 08:38:31 toy kernel: PM: Removing info for No Bus:ttyS0 Aug 20 08:38:31 toy kernel: 0.0: ttyS0 at I/O 0xc48402f8 (irq = 201) is a 16C950/954 Aug 20 08:38:31 toy kernel: PM: Adding info for No Bus:ttyS0 Aug 20 08:38:36 toy bluetoothd[1318]: HCI dev 0 registered Aug 20 08:38:36 toy kernel: PM: Adding info for No Bus:hci0 Aug 20 08:38:36 toy kernel: bcsp_recv: Out-of-order packet arrived, got 1 expected 0 Aug 20 08:38:37 toy bluetoothd[1318]: accept: Socket operation on non-socket (88) Aug 20 08:38:37 toy bluetoothd[1318]: HCI dev 0 up Aug 20 08:38:37 toy bluetoothd[1318]: Starting security manager 0 Aug 20 08:38:37 toy kernel: bcsp_recv: Short BCSP packet Aug 20 08:38:39 toy kernel: PM: Removing info for No Bus:rfcomm1 Aug 20 08:38:39 toy kernel: PM: Adding info for No Bus:rfcomm1 Aug 20 08:38:40 toy pand[1546]: Bluetooth PAN daemon version 4.66 Aug 20 08:38:40 toy pand[1546]: Connecting to 00:21:BA:FF:2D:37 Aug 20 08:38:40 toy kernel: hci_cmd_task: hci0 command tx timeout Aug 20 08:38:42 toy bluetoothd[1318]: Can't read version info for /org/bluez/1318/hci0: Connection timed out (110) Aug 20 08:38:44 toy modprobe: FATAL: Could not load /lib/modules/2.6.36-rc1/modules.dep: No such file or directory Any ideas? Pavel Could it be due to the PCMCIA timings changes on pxa I did? Try reverting that change and retry. ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
Re: [Zaurus-devel] zaurus battery patches
Dne So 31. července 2010 08:18:17 Pavel Machek napsal(a): Hi! ...they certainly need more work. .7. version is newer but incomplete. use at your own risk ... its not too tested and contains lots of debuging goo. From 195c27ead448a9a6a5ae3958dc2c2a11450f84c7 Mon Sep 17 00:00:00 2001 From: Marek Vasut marek.va...@gmail.com Date: Sat, 31 Jul 2010 13:15:24 +0200 Subject: [PATCH] PXA: Reworked spitz-battery Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/mach-pxa/Makefile|2 +- arch/arm/mach-pxa/spitz.c | 23 ++ drivers/power/Kconfig |7 + drivers/power/Makefile|1 + drivers/power/spitz_battery.c | 680 + 5 files changed, 712 insertions(+), 1 deletions(-) create mode 100644 drivers/power/spitz_battery.c diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 85c7fb3..704fb31 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile @@ -82,7 +82,7 @@ obj-$(CONFIG_MACH_PALMZ72) += palmz72.o obj-$(CONFIG_MACH_PALMLD) += palmld.o obj-$(CONFIG_PALM_TREO) += palmtreo.o obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o sharpsl_pm.o corgi_pm.o -obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o sharpsl_pm.o spitz_pm.o +obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o obj-$(CONFIG_MACH_POODLE) += poodle.o obj-$(CONFIG_MACH_TOSA) += tosa.o obj-$(CONFIG_MACH_ICONTROL) += icontrol.o mxm8x10.o diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index a8d4e3a..6cee4aa 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -683,6 +683,28 @@ static inline void spitz_irda_init(void) {} #endif /** + * Battery + **/ +//#if defined(CONFIG_PXA_FICP) || defined(CONFIG_PXA_FICP_MODULE) +static struct platform_device spitz_batt_device = { + .name = spitz-battery, + .id = -1, +// .dev = { +// .platform_data = spitz_gpio_keys_platform_data, +// }, +}; + +static void __init spitz_batt_init(void) +{ + printk(%s[%i]\n, __FUNCTION__, __LINE__); + platform_device_register(spitz_batt_device); + printk(%s[%i]\n, __FUNCTION__, __LINE__); +} +//#else +//static inline void spitz_batt_init(void) {} +//#endif + +/** * Framebuffer **/ #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) @@ -966,6 +988,7 @@ static void __init spitz_init(void) spitz_nor_init(); spitz_nand_init(); spitz_i2c_init(); + spitz_batt_init(); } static void __init spitz_fixup(struct machine_desc *desc, diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 8e9ba17..e4c538c 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -136,6 +136,13 @@ config BATTERY_Z2 help Say Y to include support for the battery on the Zipit Z2. +config BATTERY_SPITZ + tristate Sharp Spitz/Akita/Borzoi battery driver + depends on SENSORS_MAX (MACH_AKITA || MACH_SPITZ || MACH_BORZOI) + help + Say Y to include support for the battery in the + Sharp Spitz/Akita/Borzoi. + config CHARGER_PCF50633 tristate NXP PCF50633 MBC depends on MFD_PCF50633 diff --git a/drivers/power/Makefile b/drivers/power/Makefile index 0005080..3d282be 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile @@ -33,4 +33,5 @@ obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o obj-$(CONFIG_BATTERY_Z2) += z2_battery.o +obj-$(CONFIG_BATTERY_SPITZ) += spitz_battery.o obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o diff --git a/drivers/power/spitz_battery.c b/drivers/power/spitz_battery.c new file mode 100644 index 000..46b07f1 --- /dev/null +++ b/drivers/power/spitz_battery.c @@ -0,0 +1,680 @@ +/* + * Battery and Power Management code for the Sharp SL-C + * + * Copyright (c) 2009 Pavel Machek pa...@ucw.cz + * Copyright (c) 2010 Marek Vasut marek.va...@gmail.com + * + * 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. + * + * Li-ion batteries are angry beasts, and they like to explode. + * If angry lithium comes your way, the hw was misdesigned. + * + */ +#include linux/platform_device.h +#include linux/kernel.h +#include linux/module.h +#include linux/power_supply.h +#include linux/delay.h +#include linux/spinlock.h +#include linux/interrupt.h +#include linux/gpio.h +#include linux/kthread.h +#include linux/freezer.h + +#include asm/mach-types.h +#include mach/spitz.h +//#include mach/sharpsl.h +//#include mach/sharpsl_pm.h + +//#include ../../arch/arm/mach-pxa/sharpsl.h +#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */ +#define
[Zaurus-devel] [PATCH 2/2] pxa/spitz: Formating and naming fixes
Improve formating so checkpatch passes. Also, change some function and variable names to make the naming consistent. Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/mach-pxa/spitz.c | 282 ++--- 1 files changed, 138 insertions(+), 144 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 26791de..7136da9 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -133,10 +133,8 @@ static unsigned long spitz_pin_config[] __initdata = { * Scoop GPIO expander **/ #if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE) -/* - * Spitz SCOOP Device #1 - */ -static struct resource spitz_scoop_resources[] = { +/* SCOOP Device #1 */ +static struct resource spitz_scoop_1_resources[] = { [0] = { .start = 0x1080, .end= 0x10800fff, @@ -144,7 +142,7 @@ static struct resource spitz_scoop_resources[] = { }, }; -static struct scoop_config spitz_scoop_setup = { +static struct scoop_config spitz_scoop_1_setup = { .io_dir = SPITZ_SCP_IO_DIR, .io_out = SPITZ_SCP_IO_OUT, .suspend_clr= SPITZ_SCP_SUS_CLR, @@ -152,20 +150,18 @@ static struct scoop_config spitz_scoop_setup = { .gpio_base = SPITZ_SCP_GPIO_BASE, }; -struct platform_device spitzscoop_device = { +struct platform_device spitz_scoop_1_device = { .name = sharp-scoop, .id = 0, .dev= { - .platform_data = spitz_scoop_setup, + .platform_data = spitz_scoop_1_setup, }, - .num_resources = ARRAY_SIZE(spitz_scoop_resources), - .resource = spitz_scoop_resources, + .num_resources = ARRAY_SIZE(spitz_scoop_1_resources), + .resource = spitz_scoop_1_resources, }; -/* - * Spitz SCOOP Device #2 - */ -static struct resource spitz_scoop2_resources[] = { +/* SCOOP Device #2 */ +static struct resource spitz_scoop_2_resources[] = { [0] = { .start = 0x08800040, .end= 0x08800fff, @@ -173,7 +169,7 @@ static struct resource spitz_scoop2_resources[] = { }, }; -static struct scoop_config spitz_scoop2_setup = { +static struct scoop_config spitz_scoop_2_setup = { .io_dir = SPITZ_SCP2_IO_DIR, .io_out = SPITZ_SCP2_IO_OUT, .suspend_clr= SPITZ_SCP2_SUS_CLR, @@ -181,23 +177,23 @@ static struct scoop_config spitz_scoop2_setup = { .gpio_base = SPITZ_SCP2_GPIO_BASE, }; -struct platform_device spitzscoop2_device = { +struct platform_device spitz_scoop_2_device = { .name = sharp-scoop, .id = 1, .dev= { - .platform_data = spitz_scoop2_setup, + .platform_data = spitz_scoop_2_setup, }, - .num_resources = ARRAY_SIZE(spitz_scoop2_resources), - .resource = spitz_scoop2_resources, + .num_resources = ARRAY_SIZE(spitz_scoop_2_resources), + .resource = spitz_scoop_2_resources, }; static void __init spitz_scoop_init(void) { - platform_device_register(spitz_scoop1_device); + platform_device_register(spitz_scoop_1_device); /* Akita doesn't have the second SCOOP chip */ if (!machine_is_akita()) - platform_device_register(spitzscoop2_device); + platform_device_register(spitz_scoop_2_device); } /* Power control is shared with between one of the CF slots and SD */ @@ -250,22 +246,22 @@ static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr) } static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { -{ - .dev= spitzscoop_device.dev, - .irq= SPITZ_IRQ_GPIO_CF_IRQ, - .cd_irq = SPITZ_IRQ_GPIO_CF_CD, - .cd_irq_str = PCMCIA0 CD, -},{ - .dev= spitzscoop2_device.dev, - .irq= SPITZ_IRQ_GPIO_CF2_IRQ, - .cd_irq = -1, -}, + { + .dev= spitz_scoop_1_device.dev, + .irq= SPITZ_IRQ_GPIO_CF_IRQ, + .cd_irq = SPITZ_IRQ_GPIO_CF_CD, + .cd_irq_str = PCMCIA0 CD, + }, { + .dev= spitz_scoop_2_device.dev, + .irq= SPITZ_IRQ_GPIO_CF2_IRQ, + .cd_irq = -1, + }, }; static struct scoop_pcmcia_config spitz_pcmcia_config = { - .devs = spitz_pcmcia_scoop[0], - .num_devs = 2, - .power_ctrl = spitz_pcmcia_pwr, + .devs = spitz_pcmcia_scoop[0], + .num_devs = 2, + .power_ctrl = spitz_pcmcia_pwr, }; static void __init spitz_pcmcia_init(void) @@ -300,7 +296,7 @@ static inline void spitz_pcmcia_init(void) {} #define
[Zaurus-devel] [PATCH 3/4] pxa2xx/cpufreq: Fix PCMCIA frequency scaling
The MCxx values must be based off memory clock, not CPU core clock. This also fixes the bug where on some machines the LCD went crazy while using PCMCIA. Signed-off-by: Marek Vasut marek.va...@gmail.com --- drivers/pcmcia/pxa2xx_base.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index df4532e..f370476 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -178,7 +178,6 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, unsigned long val, struct cpufreq_freqs *freqs) { -#warning it's not clear if this is right since the core CPU (N) clock has no effect on the memory (L) clock switch (val) { case CPUFREQ_PRECHANGE: if (freqs-new freqs-old) { @@ -186,7 +185,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, pre-updating\n, freqs-new / 1000, (freqs-new / 100) % 10, freqs-old / 1000, (freqs-old / 100) % 10); - pxa2xx_pcmcia_set_mcxx(skt, freqs-new); + pxa2xx_pcmcia_set_timing(skt); } break; @@ -196,7 +195,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, post-updating\n, freqs-new / 1000, (freqs-new / 100) % 10, freqs-old / 1000, (freqs-old / 100) % 10); - pxa2xx_pcmcia_set_mcxx(skt, freqs-new); + pxa2xx_pcmcia_set_timing(skt); } break; } -- 1.7.1 ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
[Zaurus-devel] [PATCH 1/4] pxa2xx/cpufreq: Simplify CPU frequency change asm
This patch does the following changes to cpufreq-pxa2xx: 1) Simplifies the assembler code for frequency change 2) Reads back the MDREFR value to make sure data latched 3) Does as little operations in lock as possible Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/mach-pxa/cpufreq-pxa2xx.c | 35 --- 1 files changed, 16 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c index 9e4d981..1949850 100644 --- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c +++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c @@ -297,7 +297,7 @@ static int pxa_set_target(struct cpufreq_policy *policy, unsigned int idx; unsigned long flags; unsigned int new_freq_cpu, new_freq_mem; - unsigned int unused, preset_mdrefr, postset_mdrefr, cclkcfg; + unsigned int preset_mdrefr, postset_mdrefr, cclkcfg; int ret = 0; /* Get the current policy */ @@ -355,29 +355,26 @@ static int pxa_set_target(struct cpufreq_policy *policy, postset_mdrefr = ~MDREFR_DB2_MASK; } + /* Prepare CCLKCFG */ + cclkcfg = pxa_freq_settings[idx].cclkcfg; + local_irq_save(flags); - /* Set new the CCCR and prepare CCLKCFG */ + /* Set new the CCCR */ CCCR = pxa_freq_settings[idx].cccr; - cclkcfg = pxa_freq_settings[idx].cclkcfg; asm volatile( \n\ - ldr r4, [%1]/* load MDREFR */ \n\ - b 2f \n\ - .align 5 \n\ -1: \n\ - str %3, [%1]/* preset the MDREFR */ \n\ - mcr p14, 0, %2, c6, c0, 0 /* set CCLKCFG[FCS] */ \n\ - str %4, [%1]/* postset the MDREFR */ \n\ - \n\ - b 3f \n\ -2: b 1b \n\ -3: nop \n\ - -: =r (unused) -: r (MDREFR), r (cclkcfg), - r (preset_mdrefr), r (postset_mdrefr) -: r4, r5); + .align 5 /* align to cache line */ \n\ + str %2, [%0]/* preset the MDREFR */ \n\ + ldr r4, [%0]/* make sure data latched */\n\ + mcr p14, 0, %1, c6, c0, 0 /* set CCLKCFG[FCS] */ \n\ + str %3, [%0]/* postset the MDREFR */\n\ + ldr r4, [%0]/* make sure data latched */\n\ + + :: r (MDREFR), r (cclkcfg), + r (preset_mdrefr), r (postset_mdrefr) + : r4); + local_irq_restore(flags); /* -- 1.7.1 ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
Re: [Zaurus-devel] [PATCH 1/3] ISL6271A voltage regulator support.
Dne So 12. června 2010 19:21:14 Mark Brown napsal(a): On Sat, Jun 12, 2010 at 02:44:37PM +0200, Marek Vasut wrote: This device is very simple, it supports only one LDO. This single LDO is programmed over I2C to 16 possible voltages. Google tells me that the device has three regulators on it - two LDOs and one DCDC buck convertor: http://www.intersil.com/products/deviceinfo.asp?pn=ISL6271A While the LDOs look like they have no software control it'd be best to provide hookup for them, even if that's just a case of instantiating the appropriate fixed voltage regulators. Is this necessary? I'd only increase the kernel size without any gain ... or am I wrong ? Signed-off-by: Marek Vasut marek.va...@gmail.com +/* Supported voltage values for regulators */ +static const u32 core_buck_table[] = { +85, 90, 95, 100, + 105, 110, 115, 120, + 125, 130, 135, 140, + 145, 150, 155, 160, +}; This looks like it could be replaced with a simple function rather than a lookup table which would simplify the code. Will do. Also, are you sure this is a buck? That's a specific technical term usually only applied to DCDC regulators - LDOs are a different type of regulator That's what's written in the ISL6271a TRM. On the first page, under the Features section. +static int __devinit isl6271a_probe(struct i2c_client *client, +const struct i2c_device_id *id) +{ + struct regulator_init_data *init_data = client-dev.platform_data; + struct isl_pmic *pmic; + int err; + + if (!i2c_check_functionality(client-adapter, I2C_FUNC_SMBUS_BYTE_DATA)) +return -EIO; + + if (!init_data) + return -EIO; It'd be better to print an error message here so users know what's going on when the device fails to appear. Ok. Thanks! ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
[Zaurus-devel] [PATCH 2/2] pxa/spitz: Rework spitz
This huge patch mostly shuffles code. The spitz.c file contained terrible mess and needed a cleanup, here it is: 1) Made every part modular, components are not built in if not selected. 2) Removed loads of preprocessor goo, mostly #ifdef MACH_AKITA #endif and similar code. The kernel size will grow by a few kb now, but the file is much more readable. 3) Reworked SD/CF power setting function and made it reentrant. 4) Add ISL6271A regulator support 5) Correctly register WM8750 Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/mach-pxa/include/mach/spitz.h |2 - arch/arm/mach-pxa/spitz.c | 810 ++- 2 files changed, 470 insertions(+), 342 deletions(-) diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h index fa1998c..685749a 100644 --- a/arch/arm/mach-pxa/include/mach/spitz.h +++ b/arch/arm/mach-pxa/include/mach/spitz.h @@ -185,7 +185,5 @@ /* * Shared data structures */ -extern struct platform_device spitzscoop_device; -extern struct platform_device spitzscoop2_device; extern struct platform_device spitzssp_device; extern struct sharpsl_charger_machinfo spitz_pm_machinfo; diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 4d2413e..fa31980 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -18,14 +18,15 @@ #include linux/gpio_keys.h #include linux/gpio.h #include linux/leds.h -#include linux/mtd/physmap.h #include linux/i2c.h #include linux/i2c/pca953x.h #include linux/spi/spi.h #include linux/spi/ads7846.h #include linux/spi/corgi_lcd.h +#include linux/mtd/physmap.h #include linux/mtd/sharpsl.h #include linux/input/matrix_keypad.h +#include linux/regulator/machine.h #include asm/setup.h #include asm/mach-types.h @@ -33,11 +34,9 @@ #include asm/mach/sharpsl_param.h #include asm/hardware/scoop.h - #include mach/pxa27x.h #include mach/pxa27x-udc.h #include mach/reset.h -#include plat/i2c.h #include mach/irda.h #include mach/mmc.h #include mach/ohci.h @@ -45,11 +44,16 @@ #include mach/pxa2xx_spi.h #include mach/spitz.h +#include plat/i2c.h + #include generic.h #include devices.h #include sharpsl.h -static unsigned long spitz_pin_config[] __initdata = { +/** + * Pin configuration + **/ +static unsigned long sharpslc_pin_config[] __initdata = { /* Chip Selects */ GPIO78_nCS_2, /* SCOOP #2 */ GPIO79_nCS_3, /* NAND */ @@ -124,10 +128,13 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ }; -/* - * Spitz SCOOP Device #1 - */ -static struct resource spitz_scoop_resources[] = { + +/** + * Scoop GPIO expander + **/ +#if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE) +/* SCOOP Device #1 */ +static struct resource sharpslc_scoop_1_resources[] = { [0] = { .start = 0x1080, .end= 0x10800fff, @@ -135,7 +142,7 @@ static struct resource spitz_scoop_resources[] = { }, }; -static struct scoop_config spitz_scoop_setup = { +static struct scoop_config sharpslc_scoop_1_setup = { .io_dir = SPITZ_SCP_IO_DIR, .io_out = SPITZ_SCP_IO_OUT, .suspend_clr= SPITZ_SCP_SUS_CLR, @@ -143,20 +150,18 @@ static struct scoop_config spitz_scoop_setup = { .gpio_base = SPITZ_SCP_GPIO_BASE, }; -struct platform_device spitzscoop_device = { +struct platform_device sharpslc_scoop_1_device = { .name = sharp-scoop, .id = 0, .dev= { - .platform_data = spitz_scoop_setup, + .platform_data = sharpslc_scoop_1_setup, }, - .num_resources = ARRAY_SIZE(spitz_scoop_resources), - .resource = spitz_scoop_resources, + .num_resources = ARRAY_SIZE(sharpslc_scoop_1_resources), + .resource = sharpslc_scoop_1_resources, }; -/* - * Spitz SCOOP Device #2 - */ -static struct resource spitz_scoop2_resources[] = { +/* SCOOP Device #2 */ +static struct resource sharpslc_scoop_2_resources[] = { [0] = { .start = 0x08800040, .end= 0x08800fff, @@ -164,7 +169,7 @@ static struct resource spitz_scoop2_resources[] = { }, }; -static struct scoop_config spitz_scoop2_setup = { +static struct scoop_config sharpslc_scoop_2_setup = { .io_dir = SPITZ_SCP2_IO_DIR, .io_out = SPITZ_SCP2_IO_OUT, .suspend_clr= SPITZ_SCP2_SUS_CLR, @@ -172,82 +177,110 @@ static struct scoop_config spitz_scoop2_setup
[Zaurus-devel] [PATCH 1/2] ARM/scoop: Add CPR register bit definitions
Add bit definitions of the CPR register of the SCOOP chip into scoop.h. Also, cleanup the GPCR definitions to match coding style. Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/include/asm/hardware/scoop.h | 29 + 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/arch/arm/include/asm/hardware/scoop.h b/arch/arm/include/asm/hardware/scoop.h index 46492a6..ebb3cea 100644 --- a/arch/arm/include/asm/hardware/scoop.h +++ b/arch/arm/include/asm/hardware/scoop.h @@ -22,18 +22,23 @@ #define SCOOP_GPWR 0x24 #define SCOOP_GPRR 0x28 -#define SCOOP_GPCR_PA22( 1 12 ) -#define SCOOP_GPCR_PA21( 1 11 ) -#define SCOOP_GPCR_PA20( 1 10 ) -#define SCOOP_GPCR_PA19( 1 9 ) -#define SCOOP_GPCR_PA18( 1 8 ) -#define SCOOP_GPCR_PA17( 1 7 ) -#define SCOOP_GPCR_PA16( 1 6 ) -#define SCOOP_GPCR_PA15( 1 5 ) -#define SCOOP_GPCR_PA14( 1 4 ) -#define SCOOP_GPCR_PA13( 1 3 ) -#define SCOOP_GPCR_PA12( 1 2 ) -#define SCOOP_GPCR_PA11( 1 1 ) +#define SCOOP_CPR_OUT (1 7) +#define SCOOP_CPR_SD_3V(1 2) +#define SCOOP_CPR_CF_XV(1 1) +#define SCOOP_CPR_CF_3V(1 0) + +#define SCOOP_GPCR_PA22(1 12) +#define SCOOP_GPCR_PA21(1 11) +#define SCOOP_GPCR_PA20(1 10) +#define SCOOP_GPCR_PA19(1 9) +#define SCOOP_GPCR_PA18(1 8) +#define SCOOP_GPCR_PA17(1 7) +#define SCOOP_GPCR_PA16(1 6) +#define SCOOP_GPCR_PA15(1 5) +#define SCOOP_GPCR_PA14(1 4) +#define SCOOP_GPCR_PA13(1 3) +#define SCOOP_GPCR_PA12(1 2) +#define SCOOP_GPCR_PA11(1 1) struct scoop_config { unsigned short io_out; -- 1.7.1 ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
[Zaurus-devel] [PATCH 2/3] ARM/scoop: Add CPR register bit definitions
Add bit definitions of the CPR register of the SCOOP chip into scoop.h. Also, cleanup the GPCR definitions to match coding style. Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/include/asm/hardware/scoop.h | 29 + 1 files changed, 17 insertions(+), 12 deletions(-) diff --git a/arch/arm/include/asm/hardware/scoop.h b/arch/arm/include/asm/hardware/scoop.h index 46492a6..ebb3cea 100644 --- a/arch/arm/include/asm/hardware/scoop.h +++ b/arch/arm/include/asm/hardware/scoop.h @@ -22,18 +22,23 @@ #define SCOOP_GPWR 0x24 #define SCOOP_GPRR 0x28 -#define SCOOP_GPCR_PA22( 1 12 ) -#define SCOOP_GPCR_PA21( 1 11 ) -#define SCOOP_GPCR_PA20( 1 10 ) -#define SCOOP_GPCR_PA19( 1 9 ) -#define SCOOP_GPCR_PA18( 1 8 ) -#define SCOOP_GPCR_PA17( 1 7 ) -#define SCOOP_GPCR_PA16( 1 6 ) -#define SCOOP_GPCR_PA15( 1 5 ) -#define SCOOP_GPCR_PA14( 1 4 ) -#define SCOOP_GPCR_PA13( 1 3 ) -#define SCOOP_GPCR_PA12( 1 2 ) -#define SCOOP_GPCR_PA11( 1 1 ) +#define SCOOP_CPR_OUT (1 7) +#define SCOOP_CPR_SD_3V(1 2) +#define SCOOP_CPR_CF_XV(1 1) +#define SCOOP_CPR_CF_3V(1 0) + +#define SCOOP_GPCR_PA22(1 12) +#define SCOOP_GPCR_PA21(1 11) +#define SCOOP_GPCR_PA20(1 10) +#define SCOOP_GPCR_PA19(1 9) +#define SCOOP_GPCR_PA18(1 8) +#define SCOOP_GPCR_PA17(1 7) +#define SCOOP_GPCR_PA16(1 6) +#define SCOOP_GPCR_PA15(1 5) +#define SCOOP_GPCR_PA14(1 4) +#define SCOOP_GPCR_PA13(1 3) +#define SCOOP_GPCR_PA12(1 2) +#define SCOOP_GPCR_PA11(1 1) struct scoop_config { unsigned short io_out; -- 1.7.1 ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel
[Zaurus-devel] [PATCH 1/3] ISL6271A voltage regulator support.
This device is very simple, it supports only one LDO. This single LDO is programmed over I2C to 16 possible voltages. Signed-off-by: Marek Vasut marek.va...@gmail.com --- drivers/regulator/Kconfig |6 + drivers/regulator/Makefile |1 + drivers/regulator/isl6271a-regulator.c | 199 3 files changed, 206 insertions(+), 0 deletions(-) create mode 100644 drivers/regulator/isl6271a-regulator.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 04f2e08..6772ca7 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -201,5 +201,11 @@ config REGULATOR_88PM8607 help This driver supports 88PM8607 voltage regulator chips. +config REGULATOR_ISL6271A + tristate Intersil ISL6271A Power regulator + depends on I2C + help + This driver supports ISL6271A voltage regulator chip. + endif diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 4e7feec..e2191bf 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -31,5 +31,6 @@ obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o +obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c new file mode 100644 index 000..41cddc7 --- /dev/null +++ b/drivers/regulator/isl6271a-regulator.c @@ -0,0 +1,199 @@ +/* + * isl6271a-regulator.c + * + * Support for Intersil ISL6271A voltage regulator + * + * Copyright (C) 2010 Marek Vasut marek.va...@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed as is WITHOUT ANY WARRANTY of any kind, + * whether express or implied; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/init.h +#include linux/err.h +#include linux/platform_device.h +#include linux/regulator/driver.h +#include linux/i2c.h +#include linux/delay.h +#include linux/slab.h + +/* Supported voltage values for regulators */ +static const u32 core_buck_table[] = { +85, 90, 95, 100, + 105, 110, 115, 120, + 125, 130, 135, 140, + 145, 150, 155, 160, +}; + +/* PMIC details */ +struct isl_pmic { + struct regulator_desc desc; + struct i2c_client *client; + struct regulator_dev*rdev; + struct mutexmtx; +}; + +static int isl6271a_get_voltage(struct regulator_dev *dev) +{ + struct isl_pmic *pmic = rdev_get_drvdata(dev); + int idx, data; + + mutex_lock(pmic-mtx); + + idx = i2c_smbus_read_byte(pmic-client); + if (idx 0) { + dev_err(pmic-client-dev, Error getting voltage\n); + data = idx; + goto out; + } + + data = core_buck_table[idx 0xf]; + +out: + mutex_unlock(pmic-mtx); + return data; +} + +static int isl6271a_set_voltage(struct regulator_dev *dev, int minuV, int maxuV) +{ + struct isl_pmic *pmic = rdev_get_drvdata(dev); + int vsel, err; + int pmic_minuV = core_buck_table[0]; + int pmic_maxuV = core_buck_table[ARRAY_SIZE(core_buck_table) - 1]; + + if (minuV pmic_minuV || minuV pmic_maxuV) + return -EINVAL; + if (maxuV pmic_minuV || maxuV pmic_maxuV) + return -EINVAL; + + for (vsel = 0; vsel ARRAY_SIZE(core_buck_table); vsel++) { + int uV = core_buck_table[vsel]; + + if (minuV = uV uV = maxuV) + break; + } + + if (vsel == ARRAY_SIZE(core_buck_table)) + return -EINVAL; + + mutex_lock(pmic-mtx); + + err = i2c_smbus_write_byte(pmic-client, vsel); + if (err 0) + dev_err(pmic-client-dev, Error setting voltage\n); + + mutex_unlock(pmic-mtx); + return err; +} + +static int isl6271a_list_voltage(struct regulator_dev *dev, unsigned selector) +{ + return core_buck_table[selector]; +} + +static struct regulator_ops isl_core_ops = { + .get_voltage= isl6271a_get_voltage, + .set_voltage= isl6271a_set_voltage, + .list_voltage = isl6271a_list_voltage, +}; + +static int __devinit isl6271a_probe(struct i2c_client *client, +const struct i2c_device_id *id) +{ + struct regulator_init_data *init_data = client-dev.platform_data; + struct isl_pmic *pmic
[Zaurus-devel] [PATCH 3/3] pxa/spitz: Rework spitz
This huge patch mostly shuffles code. The spitz.c file contained terrible mess and needed a cleanup, here it is: 1) Made every part modular, components are not built in if not selected. 2) Removed loads of preprocessor goo, mostly #ifdef MACH_AKITA #endif and similar code. The kernel size will grow by a few kb now, but the file is much more readable. 3) Reworked SD/CF power setting function and made it reentrant. 4) Add ISL6271A regulator support 5) Correctly register WM8750 Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/mach-pxa/include/mach/spitz.h |2 - arch/arm/mach-pxa/spitz.c | 810 ++- 2 files changed, 470 insertions(+), 342 deletions(-) diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h index fa1998c..685749a 100644 --- a/arch/arm/mach-pxa/include/mach/spitz.h +++ b/arch/arm/mach-pxa/include/mach/spitz.h @@ -185,7 +185,5 @@ /* * Shared data structures */ -extern struct platform_device spitzscoop_device; -extern struct platform_device spitzscoop2_device; extern struct platform_device spitzssp_device; extern struct sharpsl_charger_machinfo spitz_pm_machinfo; diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 4d2413e..fa31980 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -18,14 +18,15 @@ #include linux/gpio_keys.h #include linux/gpio.h #include linux/leds.h -#include linux/mtd/physmap.h #include linux/i2c.h #include linux/i2c/pca953x.h #include linux/spi/spi.h #include linux/spi/ads7846.h #include linux/spi/corgi_lcd.h +#include linux/mtd/physmap.h #include linux/mtd/sharpsl.h #include linux/input/matrix_keypad.h +#include linux/regulator/machine.h #include asm/setup.h #include asm/mach-types.h @@ -33,11 +34,9 @@ #include asm/mach/sharpsl_param.h #include asm/hardware/scoop.h - #include mach/pxa27x.h #include mach/pxa27x-udc.h #include mach/reset.h -#include plat/i2c.h #include mach/irda.h #include mach/mmc.h #include mach/ohci.h @@ -45,11 +44,16 @@ #include mach/pxa2xx_spi.h #include mach/spitz.h +#include plat/i2c.h + #include generic.h #include devices.h #include sharpsl.h -static unsigned long spitz_pin_config[] __initdata = { +/** + * Pin configuration + **/ +static unsigned long sharpslc_pin_config[] __initdata = { /* Chip Selects */ GPIO78_nCS_2, /* SCOOP #2 */ GPIO79_nCS_3, /* NAND */ @@ -124,10 +128,13 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ }; -/* - * Spitz SCOOP Device #1 - */ -static struct resource spitz_scoop_resources[] = { + +/** + * Scoop GPIO expander + **/ +#if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE) +/* SCOOP Device #1 */ +static struct resource sharpslc_scoop_1_resources[] = { [0] = { .start = 0x1080, .end= 0x10800fff, @@ -135,7 +142,7 @@ static struct resource spitz_scoop_resources[] = { }, }; -static struct scoop_config spitz_scoop_setup = { +static struct scoop_config sharpslc_scoop_1_setup = { .io_dir = SPITZ_SCP_IO_DIR, .io_out = SPITZ_SCP_IO_OUT, .suspend_clr= SPITZ_SCP_SUS_CLR, @@ -143,20 +150,18 @@ static struct scoop_config spitz_scoop_setup = { .gpio_base = SPITZ_SCP_GPIO_BASE, }; -struct platform_device spitzscoop_device = { +struct platform_device sharpslc_scoop_1_device = { .name = sharp-scoop, .id = 0, .dev= { - .platform_data = spitz_scoop_setup, + .platform_data = sharpslc_scoop_1_setup, }, - .num_resources = ARRAY_SIZE(spitz_scoop_resources), - .resource = spitz_scoop_resources, + .num_resources = ARRAY_SIZE(sharpslc_scoop_1_resources), + .resource = sharpslc_scoop_1_resources, }; -/* - * Spitz SCOOP Device #2 - */ -static struct resource spitz_scoop2_resources[] = { +/* SCOOP Device #2 */ +static struct resource sharpslc_scoop_2_resources[] = { [0] = { .start = 0x08800040, .end= 0x08800fff, @@ -164,7 +169,7 @@ static struct resource spitz_scoop2_resources[] = { }, }; -static struct scoop_config spitz_scoop2_setup = { +static struct scoop_config sharpslc_scoop_2_setup = { .io_dir = SPITZ_SCP2_IO_DIR, .io_out = SPITZ_SCP2_IO_OUT, .suspend_clr= SPITZ_SCP2_SUS_CLR, @@ -172,82 +177,110 @@ static struct scoop_config spitz_scoop2_setup
[Zaurus-devel] [PATCH 1/2] ARM/scoop: Add CPR register bit definitions
Add bit definitions of the CPR register of the SCOOP chip into scoop.h Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/include/asm/hardware/scoop.h |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/arm/include/asm/hardware/scoop.h b/arch/arm/include/asm/hardware/scoop.h index 46492a6..5821f21 100644 --- a/arch/arm/include/asm/hardware/scoop.h +++ b/arch/arm/include/asm/hardware/scoop.h @@ -22,6 +22,11 @@ #define SCOOP_GPWR 0x24 #define SCOOP_GPRR 0x28 +#define SCOOP_CPR_OUT ( 1 7 ) +#define SCOOP_CPR_SD_3V( 1 2 ) +#define SCOOP_CPR_CF_XV( 1 1 ) +#define SCOOP_CPR_CF_3V( 1 0 ) + #define SCOOP_GPCR_PA22( 1 12 ) #define SCOOP_GPCR_PA21( 1 11 ) #define SCOOP_GPCR_PA20( 1 10 ) -- 1.7.1 ___ Zaurus-devel mailing list Zaurus-devel@lists.linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/zaurus-devel