Subject: [RFC PATCH 02/12] pci: host: pcie-dra7xx: add support for pcie-dra7xx controller

From: [email-masked] (Kishon Vijay Abraham I)
Date: Thu, 27 Mar 2014 10:56:02 +0530

On Thursday 27 March 2014 09:13 AM, Jingoo Han wrote:
> On Wednesday, March 26, 2014 10:58 PM, Kishon Vijay Abraham I wrote:
>>
>> Added support for pcie controller in dra7xx. This driver re-uses
>> the designware core code that is already present in kernel.
>>
>> Signed-off-by: Kishon Vijay Abraham I <[email-masked]>
> 
> Hi Kishon,
> Long time no see! I added trivial comments.

yeah, these were in my TODO for a long time. Sorry for it though.
> 
>> ---
>>  Documentation/devicetree/bindings/pci/ti-pci.txt |   35 ++
>>  drivers/pci/host/Kconfig                         |   10 +
>>  drivers/pci/host/Makefile                        |    1 +
>>  drivers/pci/host/pcie-dra7xx.c                   |  411 ++++++++++++++++++++++
> 
> How about using 'pci-' prefix?
> As it was discussed earlier, 'pci-' prefix is more proper.
> 
>>  4 files changed, 457 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/pci/ti-pci.txt
>>  create mode 100644 drivers/pci/host/pcie-dra7xx.c
> 
> [.....]
> 
>> --- /dev/null
>> +++ b/drivers/pci/host/pcie-dra7xx.c
> 
> [.....]
> 
>> +#define	PCIECTRL_TI_CONF_IRQSTATUS_MAIN		0x0024
>> +#define	PCIECTRL_TI_CONF_IRQENABLE_SET_MAIN	0x0028
> 
> I don't think that it's good to add vendor names such as TI
> to SFR names.
> 
> How about adding 'DRA7XX' or just removing 'TI'?
> 
> 1. PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN

ok.
> 
> 2. PCIECTRL_CONF_IRQSTATUS_MAIN
> 
> [.....]
> 
>> +enum dra7xx_pcie_device_type {
>> +	DRA7XX_PCIE_UNKNOWN_TYPE,
>> +	DRA7XX_PCIE_EP_TYPE,
>> +	DRA7XX_PCIE_LEG_EP_TYPE,
>> +	DRA7XX_PCIE_RC_TYPE,
>> +};
> 
> This driver can support only RC mode, so, these enum can be removed.
> 
> [.....]
> 
>> +	of_property_read_u32(node, "ti,device-type", &device_type);
>> +	switch (device_type) {
>> +	case DRA7XX_PCIE_RC_TYPE:
>> +		dra7xx_pcie_writel(dra7xx->base,
>> +			PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_RC);
>> +		break;
>> +	case DRA7XX_PCIE_EP_TYPE:
>> +		dra7xx_pcie_writel(dra7xx->base,
>> +			PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_EP);
>> +		break;
>> +	case DRA7XX_PCIE_LEG_EP_TYPE:
>> +		dra7xx_pcie_writel(dra7xx->base,
>> +			PCIECTRL_TI_CONF_DEVICE_TYPE, DEVICE_TYPE_LEG_EP);
>> +		break;
>> +	default:
>> +		dev_dbg(dev, "UNKNOWN device type %d\n", device_type);
>> +	}
> 
> Thus, this switch can be removed.

sure.

Thanks
Kishon