[PATCH] rtc: add support for DS3232 RTC
This patch adds the driver for RTC chip DS3232 via I2C bus Signed-off-by: Mingkai Hu Signed-off-by: Jingchang Lu Signed-off-by: Srikanth Srinivasan Signed-off-by: Roy Zang --- Tested on MPC8536DS and P4080DS board drivers/rtc/Kconfig | 11 + drivers/rtc/Makefile |1 + drivers/rtc/rtc-ds3232.c | 466 ++ 3 files changed, 478 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-ds3232.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 6a13037..13c2fdb 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -166,6 +166,17 @@ config RTC_DRV_DS1672 This driver can also be built as a module. If so, the module will be called rtc-ds1672. +config RTC_DRV_DS3232 + tristate "Dallas/Maxim DS3232" + depends on RTC_CLASS && I2C + help + If you say yes here you get support for Dallas Semiconductor + DS3232 real-time clock chips. If an interrupt is associated + with the device, the alarm functionality is supported. + + This driver can also be built as a module. If so, the module + will be called rtc-ds3232. + config RTC_DRV_MAX6900 tristate "Maxim MAX6900" help diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 44ef194..0af190c 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_RTC_DRV_DS1511) += rtc-ds1511.o obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o +obj-$(CONFIG_RTC_DRV_DS3232) += rtc-ds3232.o obj-$(CONFIG_RTC_DRV_DS3234) += rtc-ds3234.o obj-$(CONFIG_RTC_DRV_EFI) += rtc-efi.o obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c new file mode 100644 index 000..21e1599 --- /dev/null +++ b/drivers/rtc/rtc-ds3232.c @@ -0,0 +1,466 @@ +/* + * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C + * + * Copyright (C) 2009-2010 Freescale Semiconductor. + * + * 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; either version 2 of the License, or (at your + * option) any later version. + */ +/* + * It would be more efficient to use i2c msgs/i2c_transfer directly but, as + * recommened in .../Documentation/i2c/writing-clients section + * "Sending and receiving", using SMBus level communication is preferred. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DS3232_REG_SECONDS 0x00 +#define DS3232_REG_MINUTES 0x01 +#define DS3232_REG_HOURS 0x02 +#define DS3232_REG_AMPM0x02 +#define DS3232_REG_DAY 0x03 +#define DS3232_REG_DATE0x04 +#define DS3232_REG_MONTH 0x05 +#define DS3232_REG_CENTURY 0x05 +#define DS3232_REG_YEAR0x06 +#define DS3232_REG_ALARM1 0x07 /* Alarm 1 BASE */ +#define DS3232_REG_ALARM2 0x0B /* Alarm 2 BASE */ +#define DS3232_REG_CR 0x0E/* Control register */ +# define DS3232_REG_CR_nEOSC0x80 +# define DS3232_REG_CR_INTCN0x04 +# define DS3232_REG_CR_A2IE0x02 +# define DS3232_REG_CR_A1IE0x01 + +#define DS3232_REG_SR 0x0F/* control/status register */ +# define DS3232_REG_SR_OSF 0x80 +# define DS3232_REG_SR_BSY 0x04 +# define DS3232_REG_SR_A2F 0x02 +# define DS3232_REG_SR_A1F 0x01 + +struct ds3232 { + struct i2c_client *client; + struct rtc_device *rtc; + struct work_struct work; + + /* The mutex protects alarm operations, and prevents a race +* between the enable_irq() in the workqueue and the free_irq() +* in the remove function. +*/ + struct mutex mutex; + int exiting; +}; + +static struct i2c_driver ds3232_driver; + +static int ds3232_check_rtc_status(struct i2c_client *client) +{ + int ret = 0; + int control, stat; + + stat = i2c_smbus_read_byte_data(client, DS3232_REG_SR); + if (stat < 0) + return stat; + + if (stat & DS3232_REG_SR_OSF) + dev_warn(&client->dev, + "oscillator discontinuity flagged, " + "time unreliable\n"); + + stat &= ~(DS3232_REG_SR_OSF | DS3232_REG_SR_A1F | DS3232_REG_SR_A2F); + + ret = i2c_smbus_write_byte_data(client, DS3232_REG_SR, stat); + if (ret < 0) + return ret; + + /* If the alarm is pending, clear it before requesting +* the interrupt, so an interrupt event isn't reported +* before everything is initialized. +*/ + + control = i2c_smbus_read_byte_data(client, DS3232_REG_CR); + if (control < 0) + return control; +
[PATCH] rtc: add support for DS3232 RTC
This patch adds the driver for RTC chip DS3232 via I2C bus Signed-off-by: Mingkai Hu Signed-off-by: Jingchang Lu Signed-off-by: Srikanth Srinivasan Signed-off-by: Roy Zang --- Tested on MPC8536DS and P4080DS board drivers/rtc/Kconfig | 11 + drivers/rtc/Makefile |1 + drivers/rtc/rtc-ds3232.c | 466 ++ 3 files changed, 478 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-ds3232.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 6a13037..13c2fdb 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -166,6 +166,17 @@ config RTC_DRV_DS1672 This driver can also be built as a module. If so, the module will be called rtc-ds1672. +config RTC_DRV_DS3232 + tristate "Dallas/Maxim DS3232" + depends on RTC_CLASS && I2C + help + If you say yes here you get support for Dallas Semiconductor + DS3232 real-time clock chips. If an interrupt is associated + with the device, the alarm functionality is supported. + + This driver can also be built as a module. If so, the module + will be called rtc-ds3232. + config RTC_DRV_MAX6900 tristate "Maxim MAX6900" help diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 44ef194..0af190c 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -39,6 +39,7 @@ obj-$(CONFIG_RTC_DRV_DS1511) += rtc-ds1511.o obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o +obj-$(CONFIG_RTC_DRV_DS3232) += rtc-ds3232.o obj-$(CONFIG_RTC_DRV_DS3234) += rtc-ds3234.o obj-$(CONFIG_RTC_DRV_EFI) += rtc-efi.o obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c new file mode 100644 index 000..21e1599 --- /dev/null +++ b/drivers/rtc/rtc-ds3232.c @@ -0,0 +1,466 @@ +/* + * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C + * + * Copyright (C) 2009-2010 Freescale Semiconductor. + * + * 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; either version 2 of the License, or (at your + * option) any later version. + */ +/* + * It would be more efficient to use i2c msgs/i2c_transfer directly but, as + * recommened in .../Documentation/i2c/writing-clients section + * "Sending and receiving", using SMBus level communication is preferred. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define DS3232_REG_SECONDS 0x00 +#define DS3232_REG_MINUTES 0x01 +#define DS3232_REG_HOURS 0x02 +#define DS3232_REG_AMPM0x02 +#define DS3232_REG_DAY 0x03 +#define DS3232_REG_DATE0x04 +#define DS3232_REG_MONTH 0x05 +#define DS3232_REG_CENTURY 0x05 +#define DS3232_REG_YEAR0x06 +#define DS3232_REG_ALARM1 0x07 /* Alarm 1 BASE */ +#define DS3232_REG_ALARM2 0x0B /* Alarm 2 BASE */ +#define DS3232_REG_CR 0x0E/* Control register */ +# define DS3232_REG_CR_nEOSC0x80 +# define DS3232_REG_CR_INTCN0x04 +# define DS3232_REG_CR_A2IE0x02 +# define DS3232_REG_CR_A1IE0x01 + +#define DS3232_REG_SR 0x0F/* control/status register */ +# define DS3232_REG_SR_OSF 0x80 +# define DS3232_REG_SR_BSY 0x04 +# define DS3232_REG_SR_A2F 0x02 +# define DS3232_REG_SR_A1F 0x01 + +struct ds3232 { + struct i2c_client *client; + struct rtc_device *rtc; + struct work_struct work; + + /* The mutex protects alarm operations, and prevents a race +* between the enable_irq() in the workqueue and the free_irq() +* in the remove function. +*/ + struct mutex mutex; + int exiting; +}; + +static struct i2c_driver ds3232_driver; + +static int ds3232_check_rtc_status(struct i2c_client *client) +{ + int ret = 0; + int control, stat; + + stat = i2c_smbus_read_byte_data(client, DS3232_REG_SR); + if (stat < 0) + return stat; + + if (stat & DS3232_REG_SR_OSF) + dev_warn(&client->dev, + "oscillator discontinuity flagged, " + "time unreliable\n"); + + stat &= ~(DS3232_REG_SR_OSF | DS3232_REG_SR_A1F | DS3232_REG_SR_A2F); + + ret = i2c_smbus_write_byte_data(client, DS3232_REG_SR, stat); + if (ret < 0) + return ret; + + /* If the alarm is pending, clear it before requesting +* the interrupt, so an interrupt event isn't reported +* before everything is initialized. +*/ + + control = i2c_smbus_read_byte_data(client, DS3232_REG_CR); + if (control < 0) + return control; +
RE: [linuxppc-release] [PATCH] rtc: add support for DS3232 RTC
> -Original Message- > From: linuxppc-release-boun...@linux.freescale.net > [mailto:linuxppc-release-boun...@linux.freescale.net] On > Behalf Of Zang Roy-R61911 > Sent: Monday, July 05, 2010 14:46 PM > To: linuxppc-rele...@linux.freescale.net > Cc: Hu Mingkai-B21284; linuxppc-dev@lists.ozlabs.org; > Srinivasan Srikanth-R9AABP > Subject: [linuxppc-release] [PATCH] rtc: add support for DS3232 RTC > > This patch adds the driver for RTC chip DS3232 via I2C bus > > Signed-off-by: Mingkai Hu > Signed-off-by: Jingchang Lu > Signed-off-by: Srikanth Srinivasan > Signed-off-by: Roy Zang > --- > Tested on MPC8536DS and P4080DS board Sorry for the duplicated patch. It is due to a mail script bug. Please only comment to the patch directly send to linux-...@vger.kernel.org Thanks. Roy ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
kernel boot stuck at udbg_putc_cpm()
Hi, I'm debugging the kernel (2.6.33.5) ported for a MPC870 board. The changes are mostly based on the board adder875. The first thing I want to test is the serial port. So I enabled CONFIG_PPC_EARLY_DEBUG and CONFIG_PPC_EARLY_DEBUG_CPM, and changed CONFIG_PPC_EARLY_DEBUG_CPM_ADDR to 0xfa202008. My IMMR is 0xfa20. However the kernel seems to stuck at udbg_putc_cpm(). The most significant bit at 0xfa202008 never changed to zero. I did a few debugging sessions, observed some frustrating things. Would anyone here more experienced shed some lights on potential causes? First I set breakpoint at machine_init(). Below is the debug session. (gdb) target remote bdi:2001 Remote debugging using bdi:2001 machine_init (dt_ptr=5890816) at arch/powerpc/kernel/setup_32.c:121 121 { (gdb) next 125 udbg_early_init(); (gdb) next ^C Program received signal SIGSTOP, Stopped (signal). udelay (usecs=) at /home/rayan/wti/code/wti-linux-2.6.33.5/arch/powerpc/include/asm/time.h:78 78 return mftbl(); (gdb) li 73 #if defined(CONFIG_403GCX) 74 unsigned long tbl; 75 asm volatile("mfspr %0, 0x3dd" : "=r" (tbl)); 76 return tbl; 77 #else 78 return mftbl(); 79 #endif 80 } 81 82 static inline unsigned int get_tbu(void) (gdb) step 413 while (get_tbl() - start < loops) (gdb) step 414 HMT_low(); (gdb) print start No symbol "start" in current context. (gdb) print loops No symbol "loops" in current context. (gdb) Several observations regarding to the above debugging session. 1. The kernel seems not able to pass udbg_early_init(). However if breakpoint was set at functions being executed later such as probe_machine() or start_kernel(), the udbg_early_init() was executed properly. 2. When the execution was interrupted, it stopped at __delay(). And the kernel seems not able to get out of this __delay() function. There was even no symbols for local variables. Why? Next I set the breakpoint at probe_machine(). The gdb session is shown below. Again a couple of frustrating observations. 1. The kernel seems not able to get into the for loop. The breakpoint set inside the for loop never got hit. 2. Once the execution was interrupted, it stopped at __delay() again, same as the previous gdb session. (gdb) target remote bdi:2001 Remote debugging using bdi:2001 probe_machine () at arch/powerpc/kernel/setup-common.c:525 525 { (gdb) step 535 for (machine_id = &__machine_desc_start; (gdb) print __machine_desc_start $1 = {name = 0xc013ea64 "My MPC870", pci_dma_dev_setup = 0, pci_dma_bus_setup = 0, probe = 0xc01544c4 , setup_arch = 0xc015442c , init_early = 0, show_cpuinfo = 0, show_percpuinfo = 0, init_IRQ = 0xc01541d4 , get_irq = 0xc001344c , pcibios_fixup = 0, pci_probe_mode = 0, pci_irq_fixup = 0, pci_setup_phb = 0, restart = 0xc0013f0c , power_off = 0, halt = 0, panic = 0, cpu_die = 0, time_init = 0, set_rtc_time = 0xc0013fdc , get_rtc_time = 0xc0013f78 , get_boot_time = 0, rtc_read_val = 0, rtc_write_val = 0, calibrate_decr = 0xc0151e70 , progress = 0xc0153110 , log_error = 0, nvram_read_val = 0, nvram_write_val = 0, nvram_write = 0, nvram_read = 0, nvram_size = 0, nvram_sync = 0, system_reset_exception = 0, machine_check_exception = 0, feature_call = 0, pci_get_legacy_ide_irq = 0, phys_mem_access_prot = 0, idle_loop = 0, power_save = 0, enable_pmcs = 0, set_dabr = 0, init = 0, kgdb_map_scc = 0, pcibios_after_init = 0, pci_exclude_device = 0, pcibios_fixup_resources = 0, pcibios_fixup_bus = 0, pcibios_enable_device_hook = 0, machine_shutdown = 0} (gdb) print __machine_desc_end $2 = {name = 0x0, pci_dma_dev_setup = 0, pci_dma_bus_setup = 0, probe = 0, setup_arch = 0, init_early = 0, show_cpuinfo = 0, show_percpuinfo = 0, init_IRQ = 0, get_irq = 0, pcibios_fixup = 0, pci_probe_mode = 0, pci_irq_fixup = 0, pci_setup_phb = 0, restart = 0, power_off = 0, halt = 0, panic = 0, cpu_die = 0, time_init = 0, set_rtc_time = 0, get_rtc_time = 0, get_boot_time = 0, rtc_read_val = 0, rtc_write_val = 0, calibrate_decr = 0, progress = 0, log_error = 0, nvram_read_val = 0, nvram_write_val = 0, nvram_write = 0, nvram_read = 0, nvram_size = 0, nvram_sync = 0, system_reset_exception = 0, machine_check_exception = 0, feature_call = 0, pci_get_legacy_ide_irq = 0, phys_mem_access_prot = 0, idle_loop = 0, power_save = 0, enable_pmcs = 0, set_dabr = 0, init = 0, kgdb_map_scc = 0, pcibios_after_init = 0, pci_exclude_device = 0, pcibios_fixup_resources = 0, pcibios_fixup_bus = 0, pcibios_enable_device_hook = 0, machine_shutdown = 0} (gdb) step 536 machine_id < &__machine_desc_end; (gdb) print machine_id $3 = (struct machdep_calls *) 0x0 (gdb) step 525 { (gdb) step 535 for (machine_id = &__machine_desc_start; (gdb) step 525 { (gdb) step 536 machine_id < &__machine_desc_end; (gdb) step 5
Re: [PATCH] rtc: add support for DS3232 RTC
Hi Roy, On Mon, 5 Jul 2010 14:45:26 +0800, Roy Zang wrote: > This patch adds the driver for RTC chip DS3232 via I2C bus > > Signed-off-by: Mingkai Hu > Signed-off-by: Jingchang Lu > Signed-off-by: Srikanth Srinivasan > Signed-off-by: Roy Zang > --- > Tested on MPC8536DS and P4080DS board > > drivers/rtc/Kconfig | 11 + > drivers/rtc/Makefile |1 + > drivers/rtc/rtc-ds3232.c | 466 > ++ > 3 files changed, 478 insertions(+), 0 deletions(-) > create mode 100644 drivers/rtc/rtc-ds3232.c You're sending this patch to the wrong list. Please read MAINTAINERS again. -- Jean Delvare ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] rtc: add support for DS3232 RTC
> -Original Message- > From: Jean Delvare [mailto:kh...@linux-fr.org] > Sent: Monday, July 05, 2010 15:23 PM > To: Zang Roy-R61911 > Cc: linux-...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; > Hu Mingkai-B21284; Srinivasan Srikanth-R9AABP > Subject: Re: [PATCH] rtc: add support for DS3232 RTC > > Hi Roy, > > On Mon, 5 Jul 2010 14:45:26 +0800, Roy Zang wrote: > > This patch adds the driver for RTC chip DS3232 via I2C bus > > > > Signed-off-by: Mingkai Hu > > Signed-off-by: Jingchang Lu > > Signed-off-by: Srikanth Srinivasan > > > Signed-off-by: Roy Zang > > --- > > Tested on MPC8536DS and P4080DS board > > > > drivers/rtc/Kconfig | 11 + > > drivers/rtc/Makefile |1 + > > drivers/rtc/rtc-ds3232.c | 466 > ++ > > 3 files changed, 478 insertions(+), 0 deletions(-) > > create mode 100644 drivers/rtc/rtc-ds3232.c > > You're sending this patch to the wrong list. Please read MAINTAINERS > again. Does linux-...@vger.kernel.org is the correct mail list? The rtc device is on the i2c bus. Roy ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] rtc: add support for DS3232 RTC
Zang Roy-R61911 wrote: > > > >> -Original Message- >> From: Jean Delvare [mailto:kh...@linux-fr.org] >> Sent: Monday, July 05, 2010 15:23 PM >> To: Zang Roy-R61911 >> Cc: linux-...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; >> Hu Mingkai-B21284; Srinivasan Srikanth-R9AABP >> Subject: Re: [PATCH] rtc: add support for DS3232 RTC >> >> Hi Roy, >> >> On Mon, 5 Jul 2010 14:45:26 +0800, Roy Zang wrote: >> >>> This patch adds the driver for RTC chip DS3232 via I2C bus >>> >>> Signed-off-by: Mingkai Hu >>> Signed-off-by: Jingchang Lu >>> Signed-off-by: Srikanth Srinivasan >>> >> >> >>> Signed-off-by: Roy Zang >>> --- >>> Tested on MPC8536DS and P4080DS board >>> >>> drivers/rtc/Kconfig | 11 + >>> drivers/rtc/Makefile |1 + >>> drivers/rtc/rtc-ds3232.c | 466 >>> >> ++ >> >>> 3 files changed, 478 insertions(+), 0 deletions(-) >>> create mode 100644 drivers/rtc/rtc-ds3232.c >>> >> You're sending this patch to the wrong list. Please read MAINTAINERS >> again. >> > Does linux-...@vger.kernel.org is the correct mail list? > The rtc device is on the i2c bus. > Roy > I think the RTC mailing list is probably a little more appropriate... Martyn -- Martyn Welch (Principal Software Engineer) | Registered in England and GE Intelligent Platforms | Wales (3828642) at 100 T +44(0)127322748| Barbirolli Square, Manchester, E martyn.we...@ge.com| M2 3AB VAT:GB 927559189 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: 2.6.34: arch/powerpc/sysdev/micropatch.c not compiling
On Mon, Jul 05, 2010 at 09:45:11AM +0200, LEROY Christophe wrote: > When activating micropatch option, the kernel does not compile. powerpc problems should alos CC linuxppc-dev. > It looks like a spi_t is not defined anywhere. > > CC arch/powerpc/sysdev/micropatch.o > arch/powerpc/sysdev/micropatch.c: In function ‘cpm_load_patch’: > arch/powerpc/sysdev/micropatch.c:629: erreur: expected ‘=’, ‘,’, > ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token > arch/powerpc/sysdev/micropatch.c:629: erreur: ‘spp’ undeclared > (first use in this function) > arch/powerpc/sysdev/micropatch.c:629: erreur: (Each undeclared > identifier is reported only once > arch/powerpc/sysdev/micropatch.c:629: erreur: for each function it > appears in.) > cc1: warnings being treated as errors > arch/powerpc/sysdev/micropatch.c:630: erreur: ISO C89 interdit les > mélanges de déclarations et de code > arch/powerpc/sysdev/micropatch.c:671: erreur: ‘spi_t’ undeclared > (first use in this function) > arch/powerpc/sysdev/micropatch.c:671: erreur: expected expression > before ‘)’ token > make[1]: *** [arch/powerpc/sysdev/micropatch.o] Erreur 1 > make: *** [arch/powerpc/sysdev] Erreur 2 spi_t was removed in commit 644b2a680ccc51a9ec4d6beb12e9d47d2dee98e2 (powerpc/cpm: Remove SPI defines and spi structs). Anton, Kumar it looks like something along the lines of: diff --git a/arch/powerpc/sysdev/micropatch.c b/arch/powerpc/sysdev/micropatch.c index d8d6028..aa1785e 100644 --- a/arch/powerpc/sysdev/micropatch.c +++ b/arch/powerpc/sysdev/micropatch.c @@ -626,7 +626,6 @@ cpm_load_patch(cpm8xx_t *cp) volatile uint *dp;/* Dual-ported RAM. */ volatile cpm8xx_t *commproc; volatile iic_t *iip; - volatile spi_t *spp; volatile smc_uart_t *smp; int i; @@ -668,8 +667,8 @@ cpm_load_patch(cpm8xx_t *cp) /* Put SPI above the IIC, also 32-byte aligned. */ i = (RPBASE + sizeof(iic_t) + 31) & ~31; - spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI]; - spp->spi_rpbase = i; + smp = (smc_uart_t *)&commproc->cp_dparam[PROFF_SPI]; + smp->smc_rpbase = i; # if defined(CONFIG_I2C_SPI_UCODE_PATCH) commproc->cp_cpmcr1 = 0x802a; Would help? Yours Tony ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] perf_event: Fix for power_pmu_disable()
When power_pmu_disable() removes the given event from a particular index into cpuhw->event[], it shuffles down higher event[] entries. But, this array is paired with cpuhw->events[] and cpuhw->flags[] so should shuffle them similarly. If these arrays get out of sync, code such as power_check_constraints() will fail. This caused a bug where events were temporarily disabled and then failed to be re-enabled; subsequent code tried to write_pmc() with its (disabled) idx of 0, causing a message "oops trying to write PMC0". This triggers this bug on POWER7, running a miss-heavy test: perf record -e L1-dcache-load-misses -e L1-dcache-store-misses ./misstest Signed-off-by: Matt Evans --- arch/powerpc/kernel/perf_event.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c index 08460a2..3766398 100644 --- a/arch/powerpc/kernel/perf_event.c +++ b/arch/powerpc/kernel/perf_event.c @@ -838,8 +838,11 @@ static void power_pmu_disable(struct perf_event *event) cpuhw = &__get_cpu_var(cpu_hw_events); for (i = 0; i < cpuhw->n_events; ++i) { if (event == cpuhw->event[i]) { - while (++i < cpuhw->n_events) + while (++i < cpuhw->n_events) { cpuhw->event[i-1] = cpuhw->event[i]; + cpuhw->events[i-1] = cpuhw->events[i]; + cpuhw->flags[i-1] = cpuhw->flags[i]; + } --cpuhw->n_events; ppmu->disable_pmc(event->hw.idx - 1, cpuhw->mmcr); if (event->hw.idx) { -- 1.6.3.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] [NAND FSL eLBC] Modified the NAND FSL elbc driver code to correctly determine which chipselect is connected to NAND flash.
The current code that determines which bank/chipselect is used for a given NAND instance only worked for 32-bit addresses and assumed a 1:1 mapping. This breaks in 36-bit physical configs. Signed-off-by: Poonam Aggrwal Acked-by: Scott Wood --- Tested on P2020RDB and P1020RDB platforms. drivers/mtd/nand/fsl_elbc_nand.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 09228c6..a9b0cfa 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c @@ -853,7 +853,7 @@ static int __devinit fsl_elbc_nand_probe(struct of_device *dev, (in_be32(&lbc->bank[bank].br) & BR_MSEL) == BR_MS_FCM && (in_be32(&lbc->bank[bank].br) & in_be32(&lbc->bank[bank].or) & BR_BA) -== res.start) +== (u32)res.start) break; if (bank >= MAX_BANKS) { -- 1.5.6.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: Fix bad include of stdint.h in ptrace.h when -D__ASSEMBLY__
In commit 3162d92dfb79a0b5fc03380b8819fa5f870ebf1e (powerpc: Extended ptrace interface) we #included stdint.h even if __ASSEMBLY__ is defined. This broke building of libc with modern kernel headers. --- ../sysdeps/generic/stdint.h: Assembler messages: ../sysdeps/generic/stdint.h:37: Error: Unrecognized opcode: `typedef' ../sysdeps/generic/stdint.h:38: Error: Unrecognized opcode: `typedef' ../sysdeps/generic/stdint.h:39: Error: Unrecognized opcode: `typedef' --- Signed-off-by: Tony Breeds --- arch/powerpc/include/asm/ptrace.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index 9e2d84c..441179a 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h @@ -27,7 +27,9 @@ #ifdef __KERNEL__ #include #else +#ifndef __ASSEMBLY__ #include +#endif /* __ASSEMBLY__ */ #endif #ifndef __ASSEMBLY__ -- 1.6.6.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev