From patchwork Fri Jan 7 03:02:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobuhiro Iwamatsu X-Patchwork-Id: 462291 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p072wCI8031069 for ; Fri, 7 Jan 2011 02:58:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755492Ab1AGC6M (ORCPT ); Thu, 6 Jan 2011 21:58:12 -0500 Received: from mail-pv0-f174.google.com ([74.125.83.174]:34234 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755366Ab1AGC6L (ORCPT ); Thu, 6 Jan 2011 21:58:11 -0500 Received: by pva4 with SMTP id 4so2995904pva.19 for ; Thu, 06 Jan 2011 18:58:11 -0800 (PST) Received: by 10.143.11.9 with SMTP id o9mr1339665wfi.134.1294369090703; Thu, 06 Jan 2011 18:58:10 -0800 (PST) Received: from chimagu (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id w22sm1974512wfd.7.2011.01.06.18.58.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 06 Jan 2011 18:58:10 -0800 (PST) Received: from iwamatsu by chimagu with local (Exim 4.72) (envelope-from ) id 1Pb2am-000143-Jm; Fri, 07 Jan 2011 12:02:16 +0900 From: Nobuhiro Iwamatsu To: linux-sh@vger.kernel.org Cc: Nobuhiro Iwamatsu Subject: [PATCH 1/5] sh: pci: Add pci_fixup_pcic to pci of landisk Date: Fri, 7 Jan 2011 12:02:11 +0900 Message-Id: <1294369335-4064-1-git-send-email-iwamatsu@nigauri.org> X-Mailer: git-send-email 1.7.2.3 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 07 Jan 2011 02:58:13 +0000 (UTC) diff --git a/arch/sh/drivers/pci/fixups-landisk.c b/arch/sh/drivers/pci/fixups-landisk.c index bb1a6bb..95c6e2d 100644 --- a/arch/sh/drivers/pci/fixups-landisk.c +++ b/arch/sh/drivers/pci/fixups-landisk.c @@ -1,9 +1,10 @@ /* - * arch/sh/drivers/pci/ops-landisk.c + * arch/sh/drivers/pci/fixups-landisk.c * * PCI initialization for the I-O DATA Device, Inc. LANDISK board * * Copyright (C) 2006 kogiidena + * Copyright (C) 2010 Nobuhiro Iwamatsu * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information. @@ -15,6 +16,9 @@ #include #include "pci-sh4.h" +#define PCIMCR_MRSET_OFF 0xBFFFFFFF +#define PCIMCR_RFSH_OFF 0xFFFFFFFB + int pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) { /* @@ -26,9 +30,29 @@ int pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) int irq = ((slot + pin - 1) & 0x3) + 5; if ((slot | (pin - 1)) > 0x3) { - printk("PCI: Bad IRQ mapping request for slot %d pin %c\n", + printk(KERN_WARNING "PCI: Bad IRQ mapping request for slot %d pin %c\n", slot, pin - 1 + 'A'); return -1; } return irq; } + +int pci_fixup_pcic(struct pci_channel *chan) +{ + unsigned long bcr1, mcr; + + bcr1 = __raw_readl(SH7751_BCR1); + bcr1 |= 0x40080000; /* Enable Bit 19 BREQEN, set PCIC to slave */ + pci_write_reg(chan, bcr1, SH4_PCIBCR1); + + mcr = __raw_readl(SH7751_MCR); + mcr = (mcr & PCIMCR_MRSET_OFF) & PCIMCR_RFSH_OFF; + pci_write_reg(chan, mcr, SH4_PCIMCR); + + pci_write_reg(chan, 0x0c000000, SH7751_PCICONF5); + pci_write_reg(chan, 0xd0000000, SH7751_PCICONF6); + pci_write_reg(chan, 0x0c000000, SH4_PCILAR0); + pci_write_reg(chan, 0x00000000, SH4_PCILAR1); + + return 0; +}