linux-mips
[Top] [All Lists]

Re: [PATCH 1/5] MIPS: pci-ar724x: convert into a platform driver

To: John Crispin <john@phrozen.org>
Subject: Re: [PATCH 1/5] MIPS: pci-ar724x: convert into a platform driver
From: Gabor Juhos <juhosg@openwrt.org>
Date: Sat, 02 Feb 2013 15:27:34 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <510D2012.8070408@phrozen.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1359808846-23083-1-git-send-email-juhosg@openwrt.org> <510D2012.8070408@phrozen.org>
Sender: linux-mips-bounce@linux-mips.org
2013.02.02. 15:17 keltezéssel, John Crispin írta:
> On 02/02/13 13:40, Gabor Juhos wrote:
>> +static int ar724x_pci_probe(struct platform_device *pdev)
>> +{
>> +    struct resource *res;
>> +    int irq;
>> +
>> +    res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl_base");
>> +    if (!res)
>> +        return -EINVAL;
>> +
>> +    ar724x_pci_ctrl_base = devm_request_and_ioremap(&pdev->dev, res);
>> +    if (ar724x_pci_ctrl_base == NULL)
>> +        return -EBUSY;
>> +
>> +    res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg_base");
>> +    if (!res)
>> +        return -EINVAL;
> 
> 
> Hi,
> 
> maybe better use platform_get_resource(pdev, IORESOURCE_MEM, 0/1) ... you will
> otherwise have to patch this again when you convert to OF

I will not have to convert that. The node can have a reg-names property like 
this:

>       pci0: pcie@180f0000 {
>               #address-cells = <3>;
>               #size-cells = <2>;
>               #interrupt-cells = <1>;
>               device_type = "pci";
>               interrupt-controller;
>               compatible = "qca,qca9558-pcie", "qca,ar7240-pcie";
>               bus-range = <0 255>;
>               ranges = <0x02000000 0 0x00000000 0x10000000 0 0x02000000   /* 
> pci memory */
>                               0x01000000 0 0x00000000 0x00000000 0 
> 0x00000001>; /* io space */
>               reg = <0x180f0000 0x0100        /* controller base */
>                       0x14000000 0x1000       /* config space */
>                       0x180c0000 0x1000>;     /* CRP base */
>               reg-names = "ctrl_base", "cfg_base", "crp_base";
> 
>               interrupt-map-mask = <0xf800 0 0 7>;
>               interrupt-map = <0 0 0 1 &pci0 0
>                                       0 0 0 2 &pci0 0
>                                       0 0 0 3 &pci0 0
>                                       0 0 0 4 &pci0 0>;
> 
>               interrupt-parent = <&EINTC>;
>               interrupts = <0>;
>       };



-Gabor

<Prev in Thread] Current Thread [Next in Thread>