Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
On Thursday 16 February 2012 10:00 PM, Cousson, Benoit wrote: Hi Aneesh, [...] +struct emif_data { + u8 duplicate; + u8 temperature_level; + u32 irq; + spinlock_t lock; /* lock to prevent races */ Nit: That comment is useless, since you already have the kerneldoc comment before. Now I remember why I did that. Without that comment checkpatch gives this check. CHECK: spinlock_t definition without comment #124: FILE: drivers/misc/emif.c:54: + spinlock_t lock; br, Aneesh -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
On 2/24/2012 12:10 PM, Aneesh V wrote: On Thursday 16 February 2012 10:00 PM, Cousson, Benoit wrote: Hi Aneesh, [...] +struct emif_data { + u8 duplicate; + u8 temperature_level; + u32 irq; + spinlock_t lock; /* lock to prevent races */ Nit: That comment is useless, since you already have the kerneldoc comment before. Now I remember why I did that. Without that comment checkpatch gives this check. CHECK: spinlock_t definition without comment #124: FILE: drivers/misc/emif.c:54: + spinlock_t lock; That's a pretty interesting comment :-) I guess checkpatch should be able to check for a potential kerneldoc as well. You might want to report that to the checkpatch maintainer. Thanks, Benoit -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
Hi Benoit, On Thursday 16 February 2012 10:00 PM, Cousson, Benoit wrote: Hi Aneesh, On 2/4/2012 1:16 PM, Aneesh V wrote: EMIF is an SDRAM controller used in various Texas Instruments SoCs. EMIF supports, based on its revision, one or more of LPDDR2/DDR2/DDR3 protocols. Add the basic infrastructure for EMIF driver that includes driver registration, probe, parsing of platform data etc. Signed-off-by: Aneesh Vane...@ti.com --- drivers/misc/Kconfig | 12 ++ drivers/misc/Makefile |1 + drivers/misc/emif.c | 300 + include/linux/emif.h | 160 ++ 4 files changed, 473 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/emif.c create mode 100644 include/linux/emif.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 8337bf6..d68184a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -459,6 +459,18 @@ config DDR information. This data is useful for drivers handling DDR SDRAM controllers. +config EMIF + tristate Texas Instruments EMIF driver + select DDR + help + This driver is for the EMIF module available in Texas Instruments + SoCs. EMIF is an SDRAM controller that, based on its revision, + supports one or more of DDR2, DDR3, and LPDDR2 SDRAM protocols. + This driver takes care of only LPDDR2 memories presently. The + functions of the driver includes re-configuring AC timing + parameters and other settings during frequency, voltage and + temperature changes + config ARM_CHARLCD bool ARM Ltd. Character LCD Driver depends on PLAT_VERSATILE diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 4759166..076db0f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_C2PORT) += c2port/ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ obj-$(CONFIG_HMC6352)+= hmc6352.o obj-$(CONFIG_DDR)+= jedec_ddr_data.o +obj-$(CONFIG_EMIF) += emif.o obj-y+= eeprom/ obj-y+= cb710/ obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o diff --git a/drivers/misc/emif.c b/drivers/misc/emif.c new file mode 100644 index 000..ba1e3f9 --- /dev/null +++ b/drivers/misc/emif.c @@ -0,0 +1,300 @@ +/* + * EMIF driver + * + * Copyright (C) 2010 Texas Instruments, Inc. Nit: 2012? Will fix it. + * + * Aneesh Vane...@ti.com + * Santosh Shilimkarsantosh.shilim...@ti.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. + */ +#includelinux/kernel.h +#includelinux/reboot.h +#includelinux/emif.h +#includelinux/io.h +#includelinux/device.h +#includelinux/platform_device.h +#includelinux/interrupt.h +#includelinux/slab.h +#includelinux/seq_file.h +#includelinux/module.h +#includelinux/spinlock.h +#include emif_regs.h + +/** + * struct emif_data - Per device static data for driver's use + * @duplicate: Whether the DDR devices attached to this EMIF + * instance are exactly same as that on EMIF1. In + * this case we can save some memory and processing + * @temperature_level: Maximum temperature of LPDDR2 devices attached + * to this EMIF - read from MR4 register. If there + * are two devices attached to this EMIF, this + * value is the maximum of the two temperature + * levels. + * @irq: IRQ number Do you really need to store the IRQ number? Yes, I need it right now because setup_interrupts() is called later, after the first frequency notification, because that's when I have the registers to be programmed on a temperature event. But I am re-thinking on this strategy. I will move it back to probe() because other interrupts can/should be enabled at probe() time. When I do that I won't have to store it anymore and I will remove it. + * @lock: lock for protecting temperature_level and + * associated actions from race conditions + * @base: base address of memory-mapped IO registers. + * @dev: device pointer. + * @addressing table with addressing information from the spec + * @regs_cache:An array of 'struct emif_regs' that stores + * calculated register values for different + * frequencies, to avoid re-calculating them on + * each DVFS transition. + * @curr_regs: The set of register values used in the last + *
Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
Hi Aneesh, On 2/17/2012 2:26 PM, Aneesh V wrote: On Thursday 16 February 2012 10:00 PM, Cousson, Benoit wrote: On 2/4/2012 1:16 PM, Aneesh V wrote: [...] +/** + * struct emif_data - Per device static data for driver's use + * @duplicate: Whether the DDR devices attached to this EMIF + * instance are exactly same as that on EMIF1. In + * this case we can save some memory and processing + * @temperature_level: Maximum temperature of LPDDR2 devices attached + * to this EMIF - read from MR4 register. If there + * are two devices attached to this EMIF, this + * value is the maximum of the two temperature + * levels. + * @irq: IRQ number Do you really need to store the IRQ number? Yes, I need it right now because setup_interrupts() is called later, after the first frequency notification, because that's when I have the registers to be programmed on a temperature event. But I am re-thinking on this strategy. I will move it back to probe() because other interrupts can/should be enabled at probe() time. When I do that I won't have to store it anymore and I will remove it. Yes, I saw the code in a later patch. But in that case you should have introduced that attribute in the patch that will use it and not before. But I do agree, that requesting the interrupt in the probe is probably better. [...] + emif = kzalloc(sizeof(struct emif_data), GFP_KERNEL); You should use the devm_* version of this API to get the simplify the error handling / removal. Please note that most of my allocations are happening through kmemdup(). kmemdup() doesn't have a devm_* equivalent. So, I have a cleanup() function and in the interest of uniformity decided to avoid devm_* variants altogether. I think it still worth using devm_kzalloc + memcopy here instead of kmemdup to avoid the cleanup() and simplify as well the error handling. You might even propose a new devm_kmemdup API if you want. Regards, Benoit -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
On Friday 17 February 2012 07:14 PM, Cousson, Benoit wrote: Hi Aneesh, [...] + emif = kzalloc(sizeof(struct emif_data), GFP_KERNEL); You should use the devm_* version of this API to get the simplify the error handling / removal. Please note that most of my allocations are happening through kmemdup(). kmemdup() doesn't have a devm_* equivalent. So, I have a cleanup() function and in the interest of uniformity decided to avoid devm_* variants altogether. I think it still worth using devm_kzalloc + memcopy here instead of kmemdup to avoid the cleanup() and simplify as well the error handling. I will do that. You might even propose a new devm_kmemdup API if you want. Ok. I will attempt that, maybe both devm_kmalloc() and devm_kmemdup(). But I would like to de-couple that from this series. That is, I will do the patch separately and if that gets up-streamed I will update EMIF driver to use them. Until then I will go with what you suggested above. br, Aneesh -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
On Saturday 04 February 2012 05:46 PM, Aneesh V wrote: EMIF is an SDRAM controller used in various Texas Instruments SoCs. EMIF supports, based on its revision, one or more of LPDDR2/DDR2/DDR3 protocols. Add the basic infrastructure for EMIF driver that includes driver registration, probe, parsing of platform data etc. Signed-off-by: Aneesh V ane...@ti.com --- drivers/misc/Kconfig | 12 ++ drivers/misc/Makefile |1 + drivers/misc/emif.c | 300 + include/linux/emif.h | 160 ++ 4 files changed, 473 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/emif.c create mode 100644 include/linux/emif.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 8337bf6..d68184a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -459,6 +459,18 @@ config DDR information. This data is useful for drivers handling DDR SDRAM controllers. +config EMIF Add TI prefix here since it's TI IP and not a generic one. + tristate Texas Instruments EMIF driver + select DDR + help + This driver is for the EMIF module available in Texas Instruments + SoCs. EMIF is an SDRAM controller that, based on its revision, + supports one or more of DDR2, DDR3, and LPDDR2 SDRAM protocols. + This driver takes care of only LPDDR2 memories presently. The + functions of the driver includes re-configuring AC timing + parameters and other settings during frequency, voltage and + temperature changes + config ARM_CHARLCD bool ARM Ltd. Character LCD Driver depends on PLAT_VERSATILE diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 4759166..076db0f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_C2PORT)+= c2port/ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ obj-$(CONFIG_HMC6352)+= hmc6352.o obj-$(CONFIG_DDR)+= jedec_ddr_data.o +obj-$(CONFIG_EMIF) += emif.o obj-y+= eeprom/ obj-y+= cb710/ obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o diff --git a/drivers/misc/emif.c b/drivers/misc/emif.c new file mode 100644 index 000..ba1e3f9 --- /dev/null +++ b/drivers/misc/emif.c @@ -0,0 +1,300 @@ +/* + * EMIF driver + * + * Copyright (C) 2010 Texas Instruments, Inc. Fix year. 2012 + * + * Aneesh V ane...@ti.com + * Santosh Shilimkar santosh.shilim...@ti.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. + */ +#include linux/kernel.h +#include linux/reboot.h +#include linux/emif.h +#include linux/io.h +#include linux/device.h +#include linux/platform_device.h +#include linux/interrupt.h +#include linux/slab.h +#include linux/seq_file.h +#include linux/module.h +#include linux/spinlock.h +#include emif_regs.h + +/** + * struct emif_data - Per device static data for driver's use + * @duplicate: Whether the DDR devices attached to this EMIF + * instance are exactly same as that on EMIF1. In + * this case we can save some memory and processing + * @temperature_level: Maximum temperature of LPDDR2 devices attached + * to this EMIF - read from MR4 register. If there + * are two devices attached to this EMIF, this + * value is the maximum of the two temperature + * levels. + * @irq: IRQ number + * @lock:lock for protecting temperature_level and + * associated actions from race conditions + * @base:base address of memory-mapped IO registers. + * @dev: device pointer. + * @addressing table with addressing information from the spec + * @regs_cache: An array of 'struct emif_regs' that stores + * calculated register values for different + * frequencies, to avoid re-calculating them on + * each DVFS transition. + * @curr_regs: The set of register values used in the last + * frequency change (i.e. corresponding to the + * frequency in effect at the moment) + * @plat_data: Pointer to saved platform data. + */ +struct emif_data { + u8 duplicate; + u8 temperature_level; + u32 irq; + spinlock_t
Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
On Thursday 16 February 2012 04:03 PM, Santosh Shilimkar wrote: On Saturday 04 February 2012 05:46 PM, Aneesh V wrote: EMIF is an SDRAM controller used in various Texas Instruments SoCs. EMIF supports, based on its revision, one or more of LPDDR2/DDR2/DDR3 protocols. Add the basic infrastructure for EMIF driver that includes driver registration, probe, parsing of platform data etc. Signed-off-by: Aneesh Vane...@ti.com --- drivers/misc/Kconfig | 12 ++ drivers/misc/Makefile |1 + drivers/misc/emif.c | 300 + include/linux/emif.h | 160 ++ 4 files changed, 473 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/emif.c create mode 100644 include/linux/emif.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 8337bf6..d68184a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -459,6 +459,18 @@ config DDR information. This data is useful for drivers handling DDR SDRAM controllers. +config EMIF Add TI prefix here since it's TI IP and not a generic one. Ok. + tristate Texas Instruments EMIF driver + select DDR + help + This driver is for the EMIF module available in Texas Instruments + SoCs. EMIF is an SDRAM controller that, based on its revision, + supports one or more of DDR2, DDR3, and LPDDR2 SDRAM protocols. + This driver takes care of only LPDDR2 memories presently. The + functions of the driver includes re-configuring AC timing + parameters and other settings during frequency, voltage and + temperature changes + config ARM_CHARLCD bool ARM Ltd. Character LCD Driver depends on PLAT_VERSATILE diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 4759166..076db0f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_C2PORT) += c2port/ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ obj-$(CONFIG_HMC6352) += hmc6352.o obj-$(CONFIG_DDR) += jedec_ddr_data.o +obj-$(CONFIG_EMIF) += emif.o obj-y += eeprom/ obj-y += cb710/ obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o diff --git a/drivers/misc/emif.c b/drivers/misc/emif.c new file mode 100644 index 000..ba1e3f9 --- /dev/null +++ b/drivers/misc/emif.c @@ -0,0 +1,300 @@ +/* + * EMIF driver + * + * Copyright (C) 2010 Texas Instruments, Inc. Fix year. 2012 + * + * Aneesh Vane...@ti.com + * Santosh Shilimkarsantosh.shilim...@ti.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. + */ +#includelinux/kernel.h +#includelinux/reboot.h +#includelinux/emif.h +#includelinux/io.h +#includelinux/device.h +#includelinux/platform_device.h +#includelinux/interrupt.h +#includelinux/slab.h +#includelinux/seq_file.h +#includelinux/module.h +#includelinux/spinlock.h +#include emif_regs.h + +/** + * struct emif_data - Per device static data for driver's use + * @duplicate: Whether the DDR devices attached to this EMIF + * instance are exactly same as that on EMIF1. In + * this case we can save some memory and processing + * @temperature_level: Maximum temperature of LPDDR2 devices attached + * to this EMIF - read from MR4 register. If there + * are two devices attached to this EMIF, this + * value is the maximum of the two temperature + * levels. + * @irq: IRQ number + * @lock: lock for protecting temperature_level and + * associated actions from race conditions + * @base: base address of memory-mapped IO registers. + * @dev: device pointer. + * @addressing table with addressing information from the spec + * @regs_cache:An array of 'struct emif_regs' that stores + * calculated register values for different + * frequencies, to avoid re-calculating them on + * each DVFS transition. + * @curr_regs: The set of register values used in the last + * frequency change (i.e. corresponding to the + * frequency in effect at the moment) + * @plat_data: Pointer to saved platform data. + */ +struct emif_data { + u8 duplicate; + u8 temperature_level; + u32 irq; + spinlock_t lock; /* lock to prevent
Re: [RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
Hi Aneesh, On 2/4/2012 1:16 PM, Aneesh V wrote: EMIF is an SDRAM controller used in various Texas Instruments SoCs. EMIF supports, based on its revision, one or more of LPDDR2/DDR2/DDR3 protocols. Add the basic infrastructure for EMIF driver that includes driver registration, probe, parsing of platform data etc. Signed-off-by: Aneesh Vane...@ti.com --- drivers/misc/Kconfig | 12 ++ drivers/misc/Makefile |1 + drivers/misc/emif.c | 300 + include/linux/emif.h | 160 ++ 4 files changed, 473 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/emif.c create mode 100644 include/linux/emif.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 8337bf6..d68184a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -459,6 +459,18 @@ config DDR information. This data is useful for drivers handling DDR SDRAM controllers. +config EMIF + tristate Texas Instruments EMIF driver + select DDR + help + This driver is for the EMIF module available in Texas Instruments + SoCs. EMIF is an SDRAM controller that, based on its revision, + supports one or more of DDR2, DDR3, and LPDDR2 SDRAM protocols. + This driver takes care of only LPDDR2 memories presently. The + functions of the driver includes re-configuring AC timing + parameters and other settings during frequency, voltage and + temperature changes + config ARM_CHARLCD bool ARM Ltd. Character LCD Driver depends on PLAT_VERSATILE diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 4759166..076db0f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_C2PORT)+= c2port/ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ obj-$(CONFIG_HMC6352) += hmc6352.o obj-$(CONFIG_DDR) += jedec_ddr_data.o +obj-$(CONFIG_EMIF) += emif.o obj-y += eeprom/ obj-y += cb710/ obj-$(CONFIG_SPEAR13XX_PCIE_GADGET) += spear13xx_pcie_gadget.o diff --git a/drivers/misc/emif.c b/drivers/misc/emif.c new file mode 100644 index 000..ba1e3f9 --- /dev/null +++ b/drivers/misc/emif.c @@ -0,0 +1,300 @@ +/* + * EMIF driver + * + * Copyright (C) 2010 Texas Instruments, Inc. Nit: 2012? + * + * Aneesh Vane...@ti.com + * Santosh Shilimkarsantosh.shilim...@ti.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. + */ +#includelinux/kernel.h +#includelinux/reboot.h +#includelinux/emif.h +#includelinux/io.h +#includelinux/device.h +#includelinux/platform_device.h +#includelinux/interrupt.h +#includelinux/slab.h +#includelinux/seq_file.h +#includelinux/module.h +#includelinux/spinlock.h +#include emif_regs.h + +/** + * struct emif_data - Per device static data for driver's use + * @duplicate: Whether the DDR devices attached to this EMIF + * instance are exactly same as that on EMIF1. In + * this case we can save some memory and processing + * @temperature_level: Maximum temperature of LPDDR2 devices attached + * to this EMIF - read from MR4 register. If there + * are two devices attached to this EMIF, this + * value is the maximum of the two temperature + * levels. + * @irq: IRQ number Do you really need to store the IRQ number? + * @lock:lock for protecting temperature_level and + * associated actions from race conditions + * @base:base address of memory-mapped IO registers. + * @dev: device pointer. + * @addressing table with addressing information from the spec + * @regs_cache: An array of 'struct emif_regs' that stores + * calculated register values for different + * frequencies, to avoid re-calculating them on + * each DVFS transition. + * @curr_regs: The set of register values used in the last + * frequency change (i.e. corresponding to the + * frequency in effect at the moment) + * @plat_data: Pointer to saved platform data. + */ +struct emif_data { + u8 duplicate; + u8 temperature_level; + u32 irq; + spinlock_t lock; /* lock to prevent
[RFC PATCH 4/8] misc: emif: add basic infrastructure for EMIF driver
EMIF is an SDRAM controller used in various Texas Instruments SoCs. EMIF supports, based on its revision, one or more of LPDDR2/DDR2/DDR3 protocols. Add the basic infrastructure for EMIF driver that includes driver registration, probe, parsing of platform data etc. Signed-off-by: Aneesh V ane...@ti.com --- drivers/misc/Kconfig | 12 ++ drivers/misc/Makefile |1 + drivers/misc/emif.c | 300 + include/linux/emif.h | 160 ++ 4 files changed, 473 insertions(+), 0 deletions(-) create mode 100644 drivers/misc/emif.c create mode 100644 include/linux/emif.h diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 8337bf6..d68184a 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -459,6 +459,18 @@ config DDR information. This data is useful for drivers handling DDR SDRAM controllers. +config EMIF + tristate Texas Instruments EMIF driver + select DDR + help + This driver is for the EMIF module available in Texas Instruments + SoCs. EMIF is an SDRAM controller that, based on its revision, + supports one or more of DDR2, DDR3, and LPDDR2 SDRAM protocols. + This driver takes care of only LPDDR2 memories presently. The + functions of the driver includes re-configuring AC timing + parameters and other settings during frequency, voltage and + temperature changes + config ARM_CHARLCD bool ARM Ltd. Character LCD Driver depends on PLAT_VERSATILE diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 4759166..076db0f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_C2PORT) += c2port/ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ obj-$(CONFIG_HMC6352) += hmc6352.o obj-$(CONFIG_DDR) += jedec_ddr_data.o +obj-$(CONFIG_EMIF) += emif.o obj-y += eeprom/ obj-y += cb710/ obj-$(CONFIG_SPEAR13XX_PCIE_GADGET)+= spear13xx_pcie_gadget.o diff --git a/drivers/misc/emif.c b/drivers/misc/emif.c new file mode 100644 index 000..ba1e3f9 --- /dev/null +++ b/drivers/misc/emif.c @@ -0,0 +1,300 @@ +/* + * EMIF driver + * + * Copyright (C) 2010 Texas Instruments, Inc. + * + * Aneesh V ane...@ti.com + * Santosh Shilimkar santosh.shilim...@ti.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. + */ +#include linux/kernel.h +#include linux/reboot.h +#include linux/emif.h +#include linux/io.h +#include linux/device.h +#include linux/platform_device.h +#include linux/interrupt.h +#include linux/slab.h +#include linux/seq_file.h +#include linux/module.h +#include linux/spinlock.h +#include emif_regs.h + +/** + * struct emif_data - Per device static data for driver's use + * @duplicate: Whether the DDR devices attached to this EMIF + * instance are exactly same as that on EMIF1. In + * this case we can save some memory and processing + * @temperature_level: Maximum temperature of LPDDR2 devices attached + * to this EMIF - read from MR4 register. If there + * are two devices attached to this EMIF, this + * value is the maximum of the two temperature + * levels. + * @irq: IRQ number + * @lock: lock for protecting temperature_level and + * associated actions from race conditions + * @base: base address of memory-mapped IO registers. + * @dev: device pointer. + * @addressing table with addressing information from the spec + * @regs_cache:An array of 'struct emif_regs' that stores + * calculated register values for different + * frequencies, to avoid re-calculating them on + * each DVFS transition. + * @curr_regs: The set of register values used in the last + * frequency change (i.e. corresponding to the + * frequency in effect at the moment) + * @plat_data: Pointer to saved platform data. + */ +struct emif_data { + u8 duplicate; + u8 temperature_level; + u32 irq; + spinlock_t lock; /* lock to prevent races */ + void __iomem*base; + struct device *dev; + const struct lpddr2_addressing *addressing; + struct emif_regs