[PATCH 2/2] powerpc, 5200: add defconfig for charon board

2010-12-04 Thread Heiko Schocher
Signed-off-by: Heiko Schocher h...@denx.de
---
based against 2.6.37-rc4

./scripts/checkpatch.pl 0002-powerpc-5200-add-defconfig-for-charon-board.patch 
lems and is ready for
total: 0 errors, 0 warnings, 1529 lines checked

0002-powerpc-5200-add-defconfig-for-charon-board.patch has no obvious style 
problems and is ready for submission.

 arch/powerpc/configs/52xx/charon_defconfig | 1529 
 1 files changed, 1529 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/52xx/charon_defconfig

diff --git a/arch/powerpc/configs/52xx/charon_defconfig 
b/arch/powerpc/configs/52xx/charon_defconfig
new file mode 100644
index 000..edf3d40
--- /dev/null
+++ b/arch/powerpc/configs/52xx/charon_defconfig
@@ -0,0 +1,1529 @@
+#
+# Automatically generated make config: don't edit
+# Linux/powerpc 2.6.37-rc4 Kernel Configuration
+# Tue Nov 30 12:24:32 2010
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_PPC_BOOK3S_32=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_BOOK3S=y
+CONFIG_6xx=y
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_PPC_HAVE_PMU_SUPPORT=y
+# CONFIG_SMP is not set
+CONFIG_PPC32=y
+CONFIG_32BIT=y
+CONFIG_WORD_SIZE=32
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
+CONFIG_IRQ_PER_CPU=y
+CONFIG_NR_IRQS=512
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+# CONFIG_PPC_UDBG_16550 is not set
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFAULT_UIMAGE=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
+CONFIG_CONSTRUCTORS=y
+CONFIG_HAVE_IRQ_WORK=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_CROSS_COMPILE=
+CONFIG_LOCALVERSION=
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_HAVE_GENERIC_HARDIRQS is not set
+CONFIG_SPARSE_IRQ=y
+
+#
+# RCU Subsystem
+#
+CONFIG_TINY_RCU=y
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+# CONFIG_NAMESPACES is not set
+# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_RD_LZO is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EMBEDDED=y
+# CONFIG_SYSCTL_SYSCALL is not set
+# CONFIG_KALLSYMS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+# CONFIG_EPOLL is not set
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+# CONFIG_PERF_EVENTS is not set
+# CONFIG_PERF_COUNTERS is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+CONFIG_COMPAT_BRK=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_CLK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# 

[PATCH 2/2] powerpc, video: add SM501 support for charon board.

2010-12-04 Thread Heiko Schocher
Signed-off-by: Heiko Schocher h...@denx.de
cc: linux-fb...@vger.kernel.org
---
based against 2.6.37-rc4

./scripts/checkpatch.pl 
0004-powerpc-video-add-SM501-support-for-charon-board.patch lems and is ready 
for
total: 0 errors, 0 warnings, 249 lines checked

0004-powerpc-video-add-SM501-support-for-charon-board.patch has no obvious 
style problems and is ready for submission.

 arch/powerpc/boot/dts/charon.dts   |9 ++
 arch/powerpc/configs/52xx/charon_defconfig |  176 +++-
 2 files changed, 179 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/boot/dts/charon.dts b/arch/powerpc/boot/dts/charon.dts
index 768f0cc..b2353b3 100644
--- a/arch/powerpc/boot/dts/charon.dts
+++ b/arch/powerpc/boot/dts/charon.dts
@@ -186,6 +186,7 @@
#address-cells = 2;
#size-cells = 1;
ranges =   0 0 0xfc00 0x0200
+   1 0 0xe000 0x0400 // CS1 range, SM501
3 0 0xe800 0x0008;
 
fl...@0,0 {
@@ -197,6 +198,14 @@
#address-cells = 1;
};
 
+   disp...@1,0 {
+   compatible = smi,sm501;
+   reg = 1 0x 0x0080
+  1 0x03e0 0x0020;
+   mode = 640x480...@60;
+   interrupts = 1 1 3;
+   };
+
mr...@3,0 {
compatible = mtd-ram;
reg = 3 0x0 0x8;
diff --git a/arch/powerpc/configs/52xx/charon_defconfig 
b/arch/powerpc/configs/52xx/charon_defconfig
index edf3d40..05a46cf 100644
--- a/arch/powerpc/configs/52xx/charon_defconfig
+++ b/arch/powerpc/configs/52xx/charon_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux/powerpc 2.6.37-rc4 Kernel Configuration
-# Tue Nov 30 12:24:32 2010
+# Tue Nov 30 12:32:58 2010
 #
 # CONFIG_PPC64 is not set
 
@@ -719,18 +719,78 @@ CONFIG_WLAN=y
 #
 # Input device support
 #
-# CONFIG_INPUT is not set
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+# CONFIG_INPUT_SPARSEKMAP is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_TCA6416 is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_MCS is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_SENTELIC is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-# CONFIG_SERIO is not set
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_SERIO_ALTERA_PS2 is not set
+# CONFIG_SERIO_PS2MULT is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
 CONFIG_DEVKMEM=y
 # CONFIG_SERIAL_NONSTANDARD is not set
 # CONFIG_N_GSM is not set
@@ -885,6 +945,7 @@ CONFIG_SENSORS_LM80=y
 # CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3_I2C is not set
 # CONFIG_THERMAL is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
@@ -908,7 +969,7 @@ CONFIG_SSB_POSSIBLE=y
 CONFIG_MFD_SUPPORT=y
 # CONFIG_MFD_CORE is not set
 # CONFIG_MFD_88PM860X is not set
-# CONFIG_MFD_SM501 is not set
+CONFIG_MFD_SM501=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_TPS6507X is not set
 # CONFIG_TWL4030_CORE is not set
@@ -934,14 +995,116 @@ CONFIG_MFD_SUPPORT=y
 # CONFIG_DRM is not set
 # CONFIG_VGASTATE is not set
 # CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
+CONFIG_FB=y
+CONFIG_FIRMWARE_EDID=y
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is 

[PATCH 1/2] video, sm501: add OF binding to support SM501

2010-12-04 Thread Heiko Schocher
- add binding to OF, compatible name smi,sm501

- add read/write functions for using this driver
  also on powerpc plattforms

- add commandline options:
  sm501.fb_mode:
Specify resolution as xresxyres[-bpp][@refresh]
  sm501.bpp:
Specify bit-per-pixel if not specified mode

- Add support for encoding display mode information
  in the device tree using verbatim EDID block.

  If the edid entry in the smi,sm501 node is present,
  the driver will build mode database using EDID data
  and allow setting the display modes from this database.

Signed-off-by: Heiko Schocher h...@denx.de
cc: linux-fb...@vger.kernel.org
cc: devicetree-disc...@ozlabs.org
---
based against 2.6.37-rc4

./scripts/checkpatch.pl 0003-video-sm501-add-OF-binding-to-support-SM501.patch 
lems and is ready for
total: 0 errors, 0 warnings, 1067 lines checked

0003-video-sm501-add-OF-binding-to-support-SM501.patch has no obvious style 
problems and is ready for submission.

 Documentation/kernel-parameters.txt  |7 +
 Documentation/powerpc/dts-bindings/sm501.txt |   30 +++
 drivers/mfd/sm501.c  |  141 --
 drivers/video/sm501fb.c  |  264 +-
 include/linux/sm501.h|8 +
 5 files changed, 299 insertions(+), 151 deletions(-)
 create mode 100644 Documentation/powerpc/dts-bindings/sm501.txt

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index cdd2a6e..6341541 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2301,6 +2301,13 @@ and is between 256 and 4096 characters. It is defined in 
the file
merging on their own.
For more information see Documentation/vm/slub.txt.
 
+   sm501.bpp=  SM501 Display driver:
+   Specify bit-per-pixel if not specified mode
+
+   sm501fb.mode=   SM501 Display driver:
+   Specify resolution as
+   xresxyres[-bpp][@refresh]
+
smart2= [HW]
Format: io1[,io2[,...,io8]]
 
diff --git a/Documentation/powerpc/dts-bindings/sm501.txt 
b/Documentation/powerpc/dts-bindings/sm501.txt
new file mode 100644
index 000..9905dd9
--- /dev/null
+++ b/Documentation/powerpc/dts-bindings/sm501.txt
@@ -0,0 +1,30 @@
+* SM SM501
+
+The SM SM501 is a LCD controller, with proper hardware, it can also
+drive DVI monitors.
+
+Required properties:
+- compatible : should be smi,sm501.
+- reg : contain two entries:
+- First entry: System Configuration register
+- Second entry: IO space (Display Controller register)
+- interrupts : SMI interrupt to the cpu should be described here.
+- interrupt-parent : the phandle for the interrupt controller that
+  services interrupts for this device.
+
+Optional properties:
+- mode : select a video mode:
+xresxyres[-bpp][@refresh]
+- edid : verbatim EDID data block describing attached display.
+  Data from the detailed timing descriptor will be used to
+  program the display controller.
+
+Example for MPC5200:
+   disp...@1,0 {
+   compatible = smi,sm501;
+   reg = 1 0x 0x0080
+  1 0x03e0 0x0020;
+   interrupts = 1 1 3;
+   mode = 640x480...@60;
+   edid = [edid-data];
+   };
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index bc9275c..d1f952c 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -133,10 +133,10 @@ static unsigned long decode_div(unsigned long pll2, 
unsigned long val,
 
 static void sm501_dump_clk(struct sm501_devdata *sm)
 {
-   unsigned long misct = readl(sm-regs + SM501_MISC_TIMING);
-   unsigned long pm0 = readl(sm-regs + SM501_POWER_MODE_0_CLOCK);
-   unsigned long pm1 = readl(sm-regs + SM501_POWER_MODE_1_CLOCK);
-   unsigned long pmc = readl(sm-regs + SM501_POWER_MODE_CONTROL);
+   unsigned long misct = smc501_readl(sm-regs + SM501_MISC_TIMING);
+   unsigned long pm0 = smc501_readl(sm-regs + SM501_POWER_MODE_0_CLOCK);
+   unsigned long pm1 = smc501_readl(sm-regs + SM501_POWER_MODE_1_CLOCK);
+   unsigned long pmc = smc501_readl(sm-regs + SM501_POWER_MODE_CONTROL);
unsigned long sdclk0, sdclk1;
unsigned long pll2 = 0;
 
@@ -193,29 +193,29 @@ static void sm501_dump_regs(struct sm501_devdata *sm)
void __iomem *regs = sm-regs;
 
dev_info(sm-dev, System Control   %08x\n,
-   readl(regs + SM501_SYSTEM_CONTROL));
+   smc501_readl(regs + SM501_SYSTEM_CONTROL));
dev_info(sm-dev, Misc Control %08x\n,
-   readl(regs + SM501_MISC_CONTROL));
+   smc501_readl(regs + SM501_MISC_CONTROL));
dev_info(sm-dev, GPIO Control Low %08x\n,
-   readl(regs + SM501_GPIO31_0_CONTROL));
+   smc501_readl(regs + 

Re: [PATCH v3] PPC4xx: Adding PCI(E) MSI support

2010-12-04 Thread Philipp Ittershagen
Hi,

a few nitpicks here. I don't have any clue about MSI, but I have seen
some code-style related issues.

On 12/04/2010 02:33 AM, tma...@apm.com wrote:
 +static int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 +{
 + int err = 0;
 + int int_no = -ENOMEM;
 + unsigned int virq;
 + struct msi_msg msg;
 + struct msi_desc *entry;
 + struct ppc4xx_msi *msi_data = ppc4xx_msi;
 +
 + list_for_each_entry(entry, dev-msi_list, list) {
 + int_no = msi_bitmap_alloc_hwirqs(msi_data-bitmap, 1);
 + if(int_no = 0)
 + break;
 + if(int_no  0) {
 +

Empty line here not needed.

 + err = int_no;
 + pr_debug(%s: fail allocating msi interrupt\n,
 + __func__);
 + }
 + virq = irq_of_parse_and_map(msi_data-msi_dev, int_no);
 + if (virq == NO_IRQ) {
 + dev_err(dev-dev, %s: fail mapping irq\n, __func__);
 + msi_bitmap_free_hwirqs(msi_data-bitmap, int_no, 1);
 + err = -ENOSPC;
 + goto out_free;
 + }
 + msi_data-msi_virqs[int_no] = virq;
 + set_irq_data(virq, (void *)int_no);
 + dev_dbg(dev-dev, %s: virq = %d \n, __func__, virq);
 +
 + /* Setup msi address space */
 + msg.address_hi = msi_data-msi_addr_hi;
 + msg.address_lo = msi_data-msi_addr_lo;
 +
 + set_irq_msi(virq, entry);
 + msg.data = int_no;
 + write_msi_msg(virq, msg);
 + }
 +
 +out_free:
 + return err;
 +}

You don't really need the goto-style here, because you have nothing to
clean up when returning. You could instead return directly and save some
lines, because you don't have to assign err and then use goto all the time.


 +
 +void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
 +{
 + struct msi_desc *entry;
 + struct ppc4xx_msi *msi_data = ppc4xx_msi;
 +
 + dev_dbg(dev-dev, PCIE-MSI: tearing down msi irqs\n);
 +
 + list_for_each_entry(entry, dev-msi_list, list) {
 + if (entry-irq == NO_IRQ)
 + continue;
 + set_irq_msi(entry-irq, NULL);
 + msi_bitmap_free_hwirqs(msi_data-bitmap,
 + virq_to_hw(entry-irq), 1);
 + irq_dispose_mapping(entry-irq);
 + }
 +
 + return;

This return is not needed.


 +static int ppc4xx_setup_pcieh_hw(struct platform_device *dev,
 +  struct resource res, struct ppc4xx_msi *msi)
 +{
 + const u32 *msi_data;
 + const u32 *msi_mask;
 + const u32 *sdr_addr;
 + int err = 0;
 + dma_addr_t msi_phys;
 + void *msi_virt;
 +
 + sdr_addr = of_get_property(dev-dev.of_node, sdr-base, NULL);
 + if (!sdr_addr)
 + return -1;
 +
 + SDR0_WRITE(sdr_addr, (u64)res.start  32);  /*HIGH addr */
 + SDR0_WRITE(sdr_addr + 1, res.start  0x); /* Low addr */
 +
 +
 + msi-msi_dev = of_find_node_by_name(NULL, ppc4xx-msi);
 + if (msi-msi_dev) {
 + err = -ENODEV;
 + goto error_out;
 + }
 + msi-msi_regs = of_iomap(msi-msi_dev, 0);
 + if (!msi-msi_regs) {
 + dev_err(dev-dev, of_iomap problem failed\n);
 + return -ENOMEM;
 + }

You directly return here and in all other bad cases this function
covers, you use the goto-style (which you don't really need here,
because there is no cleanup to do in case of a failure). Better use a
consistent way for returning.


 + msi_data = of_get_property(dev-dev.of_node, msi-data, NULL);
 + if (!msi_data) {
 + err = -1;
 + goto error_out;
 + }
 +
 + msi_mask = of_get_property(dev-dev.of_node, msi-mask, NULL);
 + if (!msi_mask) {
 + err = -1;
 + goto error_out;
 + }
 +
 + /* Program MSI Expected data and Mask bits */
 + out_be32(msi-msi_regs + PEIH_MSIED, *msi_data);
 + out_be32(msi-msi_regs + PEIH_MSIMK, *msi_mask);
 +
 + return err;
 +error_out:
 + return err;
 +}

This was already mentioned by Josh Boyer.

 +
 +static int ppc4xx_of_msi_remove(struct platform_device *dev)
 +{
 + struct ppc4xx_msi *msi = dev-dev.platform_data;
 + int i;
 + int virq;
 +
 + for(i = 0; i  NR_MSI_IRQS; i++) {
 + virq = msi-msi_virqs[i];
 + if (virq != NO_IRQ)
 + irq_dispose_mapping(virq);
 + }
 +
 + if (msi-bitmap.bitmap)
 + msi_bitmap_free(msi-bitmap);
 + iounmap(msi-msi_regs);
 + of_node_put(msi-msi_dev);
 + kfree(msi);
 +
 + return 0;
 +}
 +
 +static int __devinit ppc4xx_msi_probe(struct platform_device *dev,
 +   const struct of_device_id *match)
 +{
 + struct ppc4xx_msi *msi;
 + struct resource res;
 + int err = 0;
 +
 + msi = ppc4xx_msi;/*keep 

Re: Change in PCI behaviour

2010-12-04 Thread Gary Thomas

On 11/23/2010 07:44 AM, Gary Thomas wrote:

On 11/22/2010 01:26 PM, Benjamin Herrenschmidt wrote:

On Mon, 2010-11-22 at 03:01 -0700, Gary Thomas wrote:

I have a bit more information on this. I'm pretty sure that the failures
are only happening in my SCSI (SATA actually) code. My board (8347ea)
has
a PCI bus with a SIL SATA controller. This combo works perfectly in
2.6.28.
In 2.6.32, it will run for a while (possibly quite a while), then
timeout
trying to do a large block write - typically 256 blocks. Once this
timeout
happens, the SIL controller is stuck and accesses to it will eventually
cause the whole system to hang (as above).

Was there any major change in how PCI or DMA was handled between 2.6.28
and 2.6.32? Given the ephemeral nature of these failures (multiple runs
all eventually fail, but never the same twice), my only hope of
fixing it
will be to have some ideas what might have changed.


Maybe the changes you did to the PCI outbound windows are now breaking
DMA ? Make sure the outbound and inbound don't overlap for example and
that all RAM is reachable for inbound.


Here's what I did to work around this - in my DTS, I set up my PCI as
ranges = 0x0200 0x0 0xC400 0xC400 0x0 0x1C00
0x0100 0x0 0x 0xB800 0x0 0x0010;
Before, I had it as
ranges = 0x0200 0x0 0xC000 0xC000 0x0 0x2000
0x0100 0x0 0x 0xB800 0x0 0x0010;

I wasn't sure how to reserve the memory (based on your earlier suggestion),
so I just narrowed the window. Note that I did not change the PCI hardware
registers (maybe the FSL code does?), so the outbound window should still
be the whole 512MB.

If this isn't viable, perhaps you could explain a bit more how to reserve
such a chunk of memory so that the PCI mappings remain the same.


Any ideas on this?  I'm a bit lost as to how to reserve the memory like
you suggested and what I've tried so far has met little success.

Thanks again

--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Change in PCI behaviour

2010-12-04 Thread Benjamin Herrenschmidt
On Sat, 2010-12-04 at 05:49 -0700, Gary Thomas wrote:
 On 11/23/2010 07:44 AM, Gary Thomas wrote:
  On 11/22/2010 01:26 PM, Benjamin Herrenschmidt wrote:
  On Mon, 2010-11-22 at 03:01 -0700, Gary Thomas wrote:
  I have a bit more information on this. I'm pretty sure that the failures
  are only happening in my SCSI (SATA actually) code. My board (8347ea)
  has
  a PCI bus with a SIL SATA controller. This combo works perfectly in
  2.6.28.
  In 2.6.32, it will run for a while (possibly quite a while), then
  timeout
  trying to do a large block write - typically 256 blocks. Once this
  timeout
  happens, the SIL controller is stuck and accesses to it will eventually
  cause the whole system to hang (as above).
 
  Was there any major change in how PCI or DMA was handled between 2.6.28
  and 2.6.32? Given the ephemeral nature of these failures (multiple runs
  all eventually fail, but never the same twice), my only hope of
  fixing it
  will be to have some ideas what might have changed.
 
  Maybe the changes you did to the PCI outbound windows are now breaking
  DMA ? Make sure the outbound and inbound don't overlap for example and
  that all RAM is reachable for inbound.
 
  Here's what I did to work around this - in my DTS, I set up my PCI as
  ranges = 0x0200 0x0 0xC400 0xC400 0x0 0x1C00
  0x0100 0x0 0x 0xB800 0x0 0x0010;
  Before, I had it as
  ranges = 0x0200 0x0 0xC000 0xC000 0x0 0x2000
  0x0100 0x0 0x 0xB800 0x0 0x0010;
 
  I wasn't sure how to reserve the memory (based on your earlier suggestion),
  so I just narrowed the window. Note that I did not change the PCI hardware
  registers (maybe the FSL code does?), so the outbound window should still
  be the whole 512MB.
 
  If this isn't viable, perhaps you could explain a bit more how to reserve
  such a chunk of memory so that the PCI mappings remain the same.
 
 Any ideas on this?  I'm a bit lost as to how to reserve the memory like
 you suggested and what I've tried so far has met little success.
 
 Thanks again
 

Look at pcibios_reserve_legacy_regions() in
arch/powerpc/kernel/pci-common.c, it reserves the legacy IO and VGA
regions on host bridges. You can make it reserve whatever your
device is allergic too.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH 1/2] powerpc, 5200: add support for charon board

2010-12-04 Thread Wolfram Sang
On Sat, Dec 04, 2010 at 09:21:46AM +0100, Heiko Schocher wrote:
 - MPC5200
 - serielle console on PSC 1

serial

 - 128MiB RAM
 - 32MiB NOR Flash
 - FEC Ethernet
 - 2 I2C Busses
 - FPGA on CS3 accessed through mtd-ram
 - ATA

although I am not sure we need those details in the commit log

 
 Signed-off-by: Heiko Schocher h...@denx.de
 ---
 based against 2.6.37-rc4
 
 ./scripts/checkpatch.pl 0001-powerpc-5200-add-support-for-charon-board.patch
 total: 0 errors, 0 warnings, 233 lines checked
 
 0001-powerpc-5200-add-support-for-charon-board.patch has no obvious style 
 problems and is ready for submission.
 
  arch/powerpc/boot/dts/charon.dts |  226 
 ++
  arch/powerpc/platforms/52xx/mpc5200_simple.c |1 +
  2 files changed, 227 insertions(+), 0 deletions(-)
  create mode 100644 arch/powerpc/boot/dts/charon.dts
 
 diff --git a/arch/powerpc/boot/dts/charon.dts 
 b/arch/powerpc/boot/dts/charon.dts
 new file mode 100644
 index 000..768f0cc
 --- /dev/null
 +++ b/arch/powerpc/boot/dts/charon.dts
 @@ -0,0 +1,226 @@
 +/*
 + * TQM5200 board Device Tree Source

Ooops ;) Your board name here, maybe based on TQM

 + *
 + * Copyright (C) 2007 Semihalf
 + * Marian Balakowicz m...@semihalf.com
 + *
 + * Copyright (C) 2010 DENX Software Engineering GmbH
 + * Heiko Schocher h...@denx.de
 + *
 + * 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.
 + */
 +
 +/dts-v1/;
 +
 +/ {
 + model = anon,charon;
 + compatible = anon,charon;
 + #address-cells = 1;
 + #size-cells = 1;
 + interrupt-parent = mpc5200_pic;
 +
 + cpus {
 + #address-cells = 1;
 + #size-cells = 0;
 +
 + PowerPC,5...@0 {
 + device_type = cpu;
 + reg = 0;
 + d-cache-line-size = 32;
 + i-cache-line-size = 32;
 + d-cache-size = 0x4000;// L1, 16K
 + i-cache-size = 0x4000;// L1, 16K
 + timebase-frequency = 0;   // from bootloader
 + bus-frequency = 0;// from bootloader
 + clock-frequency = 0;  // from bootloader
 + };
 + };
 +
 + memory {
 + device_type = memory;
 + reg = 0x 0x0800;  // 128MB
 + };
 +
 + soc5...@f000 {
 + #address-cells = 1;
 + #size-cells = 1;
 + compatible = fsl,mpc5200-immr;
 + ranges = 0 0xf000 0xc000;
 + reg = 0xf000 0x0100;
 + bus-frequency = 0;// from bootloader
 + system-frequency = 0; // from bootloader
 +
 + c...@200 {
 + compatible = fsl,mpc5200-cdm;
 + reg = 0x200 0x38;
 + };
 +
 + mpc5200_pic: interrupt-control...@500 {
 + // 5200 interrupts are encoded into two levels;
 + interrupt-controller;
 + #interrupt-cells = 3;
 + compatible = fsl,mpc5200-pic;
 + reg = 0x500 0x80;
 + };
 +
 + ti...@600 { // General Purpose Timer
 + compatible = fsl,mpc5200-gpt;
 + reg = 0x600 0x10;
 + interrupts = 1 9 0;
 + fsl,has-wdt;
 + };
 +
 + c...@900 {
 + compatible = fsl,mpc5200-mscan;
 + interrupts = 2 17 0;
 + reg = 0x900 0x80;
 + };
 +
 + c...@980 {
 + compatible = fsl,mpc5200-mscan;
 + interrupts = 2 18 0;
 + reg = 0x980 0x80;
 + };
 +
 + gpio_simple: g...@b00 {
 + compatible = fsl,mpc5200-gpio;
 + reg = 0xb00 0x40;
 + interrupts = 1 7 0;
 + gpio-controller;
 + #gpio-cells = 2;
 + };
 +
 + u...@1000 {
 + compatible = fsl,mpc5200-ohci,ohci-be;
 + reg = 0x1000 0xff;
 + interrupts = 2 6 0;
 + };
 +
 + dma-control...@1200 {
 + device_type = dma-controller;
 + compatible = fsl,mpc5200-bestcomm;
 + reg = 0x1200 0x80;
 + interrupts = 3 0 0  3 1 0  3 2 0  3 3 0
 +   3 4 0  3 5 0  3 6 0  3 7 0
 +   3 8 0  3 9 0  3 10 0  3 11 0
 +   3 12 0  3 13 0  3 14 0  3 15 0;
 + };
 +
 + x...@1f00 {

Re: [PATCH 2/2] powerpc, 5200: add defconfig for charon board

2010-12-04 Thread Wolfram Sang
On Sat, Dec 04, 2010 at 09:21:54AM +0100, Heiko Schocher wrote:

There shall be only one mpc5200-defconfig. Does the genric one work with your
board?

-- 
Pengutronix e.K.   | Wolfram Sang|
Industrial Linux Solutions | http://www.pengutronix.de/  |


signature.asc
Description: Digital signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev