Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 2/7] drivers: cpuidle: implement DT based idle states infrastructure
From: Ashwin Chaugule @ 2014-07-23 19:08 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140723173204.GB21746@e102568-lin.cambridge.arm.com>

Hi Lorenzo,

On 23 July 2014 13:32, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
>> > +/**
>> > + * dt_init_idle_driver() - Parse the DT idle states and initialize the
>> > + *                        idle driver states array
>> > + *
>> > + * @drv:         Pointer to CPU idle driver to be initialized
>> > + * @start_idx:    First idle state index to be initialized
>> > + *
>> > + * On success the states array in the cpuidle driver contains
>> > + * initialized entries in the states array, starting from index start_idx.
>> > + *
>> > + * Return:
>> > + *     0 on success
>> > + *     <0 on failure
>> > + */
>> > +int dt_init_idle_driver(struct cpuidle_driver *drv, unsigned int start_idx)
>> > +{
>> > +       unsigned int i, state_idx = start_idx;
>> > +       struct cpuidle_state *idle_state;
>> > +       struct device_node *state_node, *cpu_node;
>> > +
>> > +
>> > +       if (state_idx >= CPUIDLE_STATE_MAX)
>> > +               return -EINVAL;
>> > +       /*
>> > +        * We get the idle states for the first logical cpu in the
>> > +        * driver mask. The kernel does not check idle states on all
>> > +        * cpus in the driver mask, they are assumed to be the same
>> > +        * by default.
>> > +        */
>> > +       cpu_node = of_cpu_device_node_get(cpumask_first(drv->cpumask));
>>
>> Is this an assumption for the short term? My understanding from the
>> corresponding ACPI discussions is that the order of idle states may
>> not necessarily be same for all CPUs, even for big.Little?
>
> Well, it is more of a problem of the CPUidle infrastructure than related
> to this specific patchset. The idle states for a specific cpumask (ie CPUidle
> driver) are expected to be all the same, same order same data.
>
> Current driver can be used on homegeneous ARM64 SMP systems, but I am fairly
> confident we can extend it for big.LITTLE and also other funky SMP
> configurations, the parsing code only expects all cpus in the mask
> to have the same set of idle states (and so does the CPUidle core), if that's
> not the case, the cpus belong in different CPUidle drivers (ie a CPUidle
> driver is a set of states valid on a cpumask).
>
> So my answer is yes, it is a proper assumption and not only for the
> short term, but in general.
>
> HTH,
> Lorenzo

Ok. Thanks for the explanation. I just had a look at
drivers/cpuidle/cpuidle-big_little.c. So, you'll need another call to
cpuidle_register() should there be another cpumask with a different
set of idle states.

Cheers,
Ashwin

^ permalink raw reply

* [PATCH v4 2/2] platform: Make platform_bus device a platform device
From: Olof Johansson @ 2014-07-23 18:53 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1406135239-17550-2-git-send-email-pawel.moll@arm.com>

On Wed, Jul 23, 2014 at 06:07:19PM +0100, Pawel Moll wrote:
> ... describing the root of the device tree, so one can write
> a platform driver initializing the platform.
> 
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>

Ran it through the boot farm. Results at:

http://arm-soc.lixom.net/bootlogs/misc/v3.16-rc6-772-g7926904/

Tested-by: Olof Johansson <olof@lixom.net>

For when Greg is happy with this:

Acked-by: Olof Johansson <olof@lixom.net>


-Olof

^ permalink raw reply

* [PATCH 3/3] crypto: Add Allwinner Security System crypto accelerator
From: Corentin LABBE @ 2014-07-23 18:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <201407231751.02050.marex@denx.de>

Le 23/07/2014 17:51, Marek Vasut a ?crit :
> On Wednesday, July 23, 2014 at 04:13:09 PM, Herbert Xu wrote:
>> On Wed, Jul 23, 2014 at 04:07:20PM +0200, Marek Vasut wrote:
>>> On Wednesday, July 23, 2014 at 03:57:35 PM, Herbert Xu wrote:
>>>> On Sat, May 24, 2014 at 02:00:03PM +0200, Marek Vasut wrote:
>>>>>> +	}
>>>>>> +#endif
>>>>>> +
>>>>>> +#ifdef CONFIG_CRYPTO_DEV_SUNXI_SS_MD5
>>>>>> +	err = crypto_register_shash(&sunxi_md5_alg);
>>>>>
>>>>> Do not use shash for such device. This is clearly and ahash (and
>>>>> async in general) device. The rule of a thumb here is that you use
>>>>> sync algos only for devices which have dedicated instructions for
>>>>> computing the transformation. For devices which are attached to some
>>>>> kind of bus, you use async algos (ahash etc).
>>>>
>>>> I'm sorry that I didn't catch this earlier but there is no such
>>>> rule.
>>>>
>>>> Unless you need the async interface you should stick to the sync
>>>> interfaces for the sake of simplicity.
>>>>
>>>> We have a number of existing drivers that are synchronous but
>>>> using the async interface.  They should either be converted
>>>> over to the sync interface or made interrupt-driven if possible.
>>>
>>> Sure, but this device is interrupt driven and uses DMA to feed the crypto
>>> engine, therefore async, right ?
>>
>> If it's interrupt-driven, then yes it would certainly make sense to
>> be async.  But all I see is polling in the latest posting, was the
>> first version different?
> 
> I stand corrected then, sorry.
> 
> Is it possible to use DMA to feed the crypto accelerator, Corentin?
> 
> Best regards,
> Marek Vasut
> 

Yes, DMA is possible and will be implemented soon.
So if I have well understood, I keep using async interface.

^ permalink raw reply

* [RFC PATCH 09/10] arm64/efi: enable minimal UEFI Runtime Services for big endian
From: Ard Biesheuvel @ 2014-07-23 17:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAKv+Gu8DgAAoxb58K9dtQAKyt0zfRV5naAzMTi=7OLYD-ZZd9g@mail.gmail.com>

On 07/23/2014 12:59 PM, Ard Biesheuvel wrote:
> On 23 July 2014 11:34, Mark Rutland <mark.rutland@arm.com> wrote:
>> Hi Ard,
>>
>> This is certainly a neat feature, and I definitely want to be able to
>> boot BE kernels via UEFI.
>>
> 
> Good!
> 
>> However, I'm wary of calling EFI in a physical (i.e. idmap with dcaches
>> off) context. I'm not sure anyone else does that, and I'm not sure
>> whether that's going to work (both because of the cache maintenance
>> requirements and the expectations of a given UEFI implementation w.r.t.
>> memory cacheability).
>>
> 
> I have developed an alternate version in the mean time that switches
> to a LE idmap (so with D-cache enabled), but this is an imperfect
> solution as well, as (like in the MMU off case), the vector base
> virtual address cannot be resolved when the EE bit is cleared (as
> TTBR1 points to a BE page table) so any exception taken locks the
> machine hard. I am not sure if this can be solved in any way other
> than changing exception levels. Or install an alternate vector table
> for the duration of the runtime services call that flips the EE bit
> back, restores VBAR to its original address, and jumps into it. None
> of this is very sexy, though ...
> 
>> I'd hoped we'd be able to use a LE EL0 context to call the runtime
>> services in, but I'm not sure that's possible by the spec :(
>>
> 
> Nope, they should be called at the exception level UEFI was started in
> (as Leif tells me)
> 
>> As I understand it, we shouldn't need these runtime services to simply
>> boot a BE kernel.
>>
> 
> Well, the significance of the variable store related Runtime Services
> is that they are used by an installer (through efibootmgr) to program
> the kernel command line. Hence the choice for just these services in
> the minimal implementation.
> 

The below patch is an alternate approach with a LE id mapping in
efi_pg_dir. (Patch that sets it up omitted).

This dodges all the concerns related to caching, hopefully, as the LE id
mapping and the BE id mapping in idmap_pg_dir should agree on the memory
attributes of all common mappings.

This also addresses the FIQ and exception concerns, although I fully
realise that this is likely too controversial. Suggestions for less
controversial approaches are highly appreciated. As said, booting a BE
kernel is useful by itself, but without being able to use efibootmgr it
is a bit crippled.

-- 
Ard.


diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index a34fd3b12e2b..2eeae5ae55b2 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -44,4 +44,6 @@ extern void efi_idmap_init(void);

 #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)

+extern int efi_be_runtime_setup(void);
+
 #endif /* _ASM_EFI_H */
diff --git a/arch/arm64/kernel/efi-be-call.S
b/arch/arm64/kernel/efi-be-call.S
new file mode 100644
index 000000000000..8da53a225fab
--- /dev/null
+++ b/arch/arm64/kernel/efi-be-call.S
@@ -0,0 +1,129 @@
+
+#include <linux/linkage.h>
+
+	.macro	flush_tlb_all
+	dsb	ishst
+	tlbi	vmalle1is
+	dsb	ish
+	isb
+	.endm
+
+	.text
+	/*
+	 * Alternate vector table so we can trap exceptions while in LE mode
+	 * and make the world sane again before letting the kernel handle the
+	 * exception as usual. Clobbers x30.
+	 */
+	.align	12
+.Lvectors:
+	.irpc	i, 0123456789abcdef
+	.align	7
+	/* switch back to BE and temporarily disable MMU */
+	mrs	x30, sctlr_el1
+	bic	x30, x30, #1 << 0	// clear SCTLR.M
+	orr	x30, x30, #1 << 25	// set SCTLR.EE
+	msr	sctlr_el1, x30
+	isb
+
+	/* needed as TLBs are permitted to cache the EE bit */
+	flush_tlb_all
+
+	/* re-install BE idmap */
+	adrp	x30, idmap_pg_dir
+	msr	ttbr0_el1, x30
+	mrs	x30, sctlr_el1
+	orr	x30, x30, #1 << 0	// set SCTLR.M
+	msr	sctlr_el1, x30		// re-enable MMU
+	isb
+
+	/*
+	 * Use the virtual and physical addresses of 'vectors' to restore the
+	 * virtual offset of sp.
+	 */
+	adrp	x30, vectors
+	add	x30, x30, #:lo12:vectors
+	sub	sp, sp, x30
+	ldr	x30, =vectors
+	add	sp, sp, x30
+
+	/* reinstall vector table */
+	msr	vbar_el1, x30		// restore VBAR to 'vectors'
+	isb
+
+	add	x30, x30, #(0x\i * 0x80) // jump to real vector
+	ret
+	.endr
+
+ENTRY(efi_be_phys_call)
+	/*
+	 * Entered@physical address with 1:1 mapping enabled and interrupts
+	 * disabled.
+	 */
+	stp	x29, x30, [sp, #-48]!
+	mov	x29, sp
+	stp	x25, x26, [sp, #16]
+	stp	x27, x28, [sp, #32]
+
+	ldr	x8, =efi_be_phys_call	// virt address of this function
+	adr	x9, efi_be_phys_call	// phys address of this function
+	sub	x9, x8, x9		// calculate virt to phys offset in x9
+
+	/* get phys address of stack */
+	sub	sp, sp, x9
+
+	/* mask FIQs */
+	mrs	x25, daif
+	msr	daifset, #8
+
+	/* install alternate vector table */
+	mrs	x28, vbar_el1
+	adrp	x8, .Lvectors
+	msr	vbar_el1, x8
+
+	/* switch to LE and temporarily disable MMU */
+	mrs	x27, sctlr_el1
+	bic	x8, x27, #1 << 25	// clear SCTLR.EE
+	bic	x9, x8, #1 << 0		// clear SCTLR.M
+	msr	sctlr_el1, x9
+	isb
+
+	/* needed as TLBs are permitted to cache the EE bit */
+	flush_tlb_all
+
+	/* install LE idmap */
+	adrp	x9, efi_pg_dir
+	msr	ttbr0_el1, x9
+	msr	sctlr_el1, x8		// re-enable MMU
+	isb
+
+	/* restore inputs but rotated by 1 register */
+	mov	x6, x0
+	mov	x0, x1
+	mov	x1, x2
+	mov	x2, x3
+	mov	x3, x4
+	mov	x4, x5
+	blr	x6
+
+	/* switch back to BE and temporarily disable MMU */
+	bic	x9, x27, #1 << 0	// clear SCTLR.M
+	msr	sctlr_el1, x9
+	isb
+
+	/* needed as TLBs are permitted to cache the EE bit */
+	flush_tlb_all
+
+	/* re-install BE idmap */
+	adrp	x8, idmap_pg_dir
+	msr	ttbr0_el1, x8
+	msr	sctlr_el1, x27		// re-enable MMU
+	msr	vbar_el1, x28		// restore VBAR
+	msr	daif, x25
+	isb
+
+	mov	sp, x29
+	ldp	x25, x26, [sp, #16]
+	ldp	x27, x28, [sp, #32]
+	ldp	x29, x30, [sp], #48
+	ret
+ENDPROC(efi_be_phys_call)
diff --git a/arch/arm64/kernel/efi-be-runtime.c
b/arch/arm64/kernel/efi-be-runtime.c
new file mode 100644
index 000000000000..abcc275481bd
--- /dev/null
+++ b/arch/arm64/kernel/efi-be-runtime.c
@@ -0,0 +1,105 @@
+
+#include <linux/efi.h>
+#include <linux/spinlock.h>
+#include <asm/efi.h>
+#include <asm/neon.h>
+#include <asm/tlbflush.h>
+
+static efi_runtime_services_t *runtime;
+static efi_status_t (*efi_be_call)(phys_addr_t func, ...);
+
+static DEFINE_SPINLOCK(efi_be_rt_lock);
+
+static unsigned long efi_be_call_pre(void)
+{
+	unsigned long flags;
+
+	kernel_neon_begin();
+	spin_lock_irqsave(&efi_be_rt_lock, flags);
+	cpu_switch_mm(idmap_pg_dir, &init_mm);
+	flush_tlb_all();
+	return flags;
+}
+
+static void efi_be_call_post(unsigned long flags)
+{
+	cpu_switch_mm(current, current->active_mm);
+	flush_tlb_all();
+	spin_unlock_irqrestore(&efi_be_rt_lock, flags);
+	kernel_neon_end();
+}
+
+static efi_status_t efi_be_get_variable(efi_char16_t *name,
+					efi_guid_t *vendor,
+					u32 *attr,
+					unsigned long *data_size,
+					void *data)
+{
+	unsigned long flags;
+	efi_status_t status;
+
+	*data_size = cpu_to_le64(*data_size);
+	flags = efi_be_call_pre();
+	status = efi_be_call(le64_to_cpu(runtime->get_variable),
+			     virt_to_phys(name), virt_to_phys(vendor),
+			     virt_to_phys(attr), virt_to_phys(data_size),
+			     virt_to_phys(data));
+	efi_be_call_post(flags);
+	*attr = le32_to_cpu(*attr);
+	*data_size = le64_to_cpu(*data_size);
+	return status;
+}
+
+static efi_status_t efi_be_get_next_variable(unsigned long *name_size,
+					     efi_char16_t *name,
+					     efi_guid_t *vendor)
+{
+	unsigned long flags;
+	efi_status_t status;
+
+	*name_size = cpu_to_le64(*name_size);
+	flags = efi_be_call_pre();
+	status = efi_be_call(le64_to_cpu(runtime->get_next_variable),
+			     virt_to_phys(name_size), virt_to_phys(name),
+			     virt_to_phys(vendor));
+	efi_be_call_post(flags);
+	*name_size = le64_to_cpu(*name_size);
+	return status;
+}
+
+static efi_status_t efi_be_set_variable(efi_char16_t *name,
+					efi_guid_t *vendor,
+					u32 attr,
+					unsigned long data_size,
+					void *data)
+{
+	unsigned long flags;
+	efi_status_t status;
+
+	flags = efi_be_call_pre();
+	status = efi_be_call(le64_to_cpu(runtime->set_variable),
+			     virt_to_phys(name), virt_to_phys(vendor),
+			     attr, data_size, virt_to_phys(data));
+	efi_be_call_post(flags);
+	return status;
+}
+
+int efi_be_runtime_setup(void)
+{
+	extern u8 efi_be_phys_call[];
+
+	runtime = ioremap_cache(le64_to_cpu(efi.systab->runtime),
+				sizeof(efi_runtime_services_t));
+	if (!runtime) {
+		pr_err("Failed to set up BE wrappers for UEFI Runtime Services!\n");
+		return -EFAULT;
+	}
+
+	efi_be_call = (void *)virt_to_phys(efi_be_phys_call);
+
+	efi.get_variable = efi_be_get_variable;
+	efi.get_next_variable = efi_be_get_next_variable;
+	efi.set_variable = efi_be_set_variable;
+
+	return 0;
+}
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index c65c6a50395d..3f28854e96a9 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -426,6 +426,20 @@ static int __init arm64_enter_virtual_mode(void)

 	efi.memmap = &memmap;

+	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) {
+		efi.systab = ioremap_cache(efi_system_table,
+					   sizeof(efi_system_table_t));
+		if (!efi.systab) {
+			pr_err("Failed to remap EFI system table!\n");
+			return -1;
+		}
+		free_boot_services();
+		set_bit(EFI_SYSTEM_TABLES, &efi.flags);
+		if (efi_be_runtime_setup() == 0)
+			set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
+		return 0;
+	}
+
 	/* Map the runtime regions */
 	virtmap = kmalloc(mapsize, GFP_KERNEL);
 	if (!virtmap) {

^ permalink raw reply related

* [PATCH v4 1/2] platform: Remove most references to platform_bus device
From: Olof Johansson @ 2014-07-23 17:49 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140723174137.GC16664@kroah.com>

On Wed, Jul 23, 2014 at 10:41 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Wed, Jul 23, 2014 at 06:07:18PM +0100, Pawel Moll wrote:
>> A number of board files in arch/arm and arch/unicore32
>> explicitly reference platform_bus device as a parent
>> for new platform devices.
>>
>> This is unnecessary, as platform device API guarantees
>> that devices with NULL parent are going to by adopted
>> by the mentioned "root" device.
>>
>> This patch removes or replaces with NULL such references.
>>
>> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
>> ---
>>  arch/arm/mach-bcm/board_bcm21664.c      |  3 +--
>>  arch/arm/mach-bcm/board_bcm281xx.c      |  3 +--
>>  arch/arm/mach-clps711x/board-edb7211.c  |  6 +++---
>>  arch/arm/mach-clps711x/board-p720t.c    |  6 +++---
>>  arch/arm/mach-imx/mach-mx27ads.c        |  2 +-
>>  arch/arm/mach-shmobile/board-ape6evm.c  | 14 +++++++-------
>>  arch/arm/mach-shmobile/board-bockw.c    | 19 ++++++++----------
>>  arch/arm/mach-shmobile/board-genmai.c   |  5 ++---
>>  arch/arm/mach-shmobile/board-koelsch.c  | 26 ++++++++++++-------------
>>  arch/arm/mach-shmobile/board-lager.c    | 34 ++++++++++++++-------------------
>>  arch/arm/mach-shmobile/board-marzen.c   |  1 -
>>  arch/arm/mach-shmobile/setup-r7s72100.c |  2 +-
>>  arch/arm/mach-shmobile/setup-r8a73a4.c  |  8 ++++----
>>  arch/arm/mach-shmobile/setup-r8a7778.c  | 13 ++++++-------
>>  arch/arm/mach-shmobile/setup-r8a7779.c  |  6 +++---
>>  arch/arm/mach-shmobile/setup-r8a7790.c  | 10 +++++-----
>>  arch/arm/mach-shmobile/setup-r8a7791.c  |  8 ++++----
>>  arch/unicore32/kernel/puv3-core.c       |  2 +-
>>  arch/unicore32/kernel/puv3-nb0916.c     |  6 +++---
>>  19 files changed, 79 insertions(+), 95 deletions(-)
>
> Looks good, if there are no objections, I'll take this through my
> driver-core tree, so that your follow-on patches that change things will
> still apply.

Acked-by: Olof Johansson <olof@lixom.net>

Just in case we end up having dependent patches and/or lots of
conflicts, can you stick these on a short topic branch that we can
also pull in?

Thanks,

-Olof

^ permalink raw reply

* [PATCH v7 4/5] PCI: add PCI controller for keystone PCIe h/w
From: Jason Gunthorpe @ 2014-07-23 17:42 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140722235200.GC27965@google.com>

On Tue, Jul 22, 2014 at 05:52:00PM -0600, Bjorn Helgaas wrote:
> If there is a hardware defect, a PCI quirk is a reasonable way to work
> around it, since that's the main purpose of quirks.  fixup_mpss_256()
> is an example of something that sounds superficially similar.

It was my suggestion to engage the PCI-E tuning code. By my
understanding the HW bug is that read response segmentation at the
host bridge does not work - so all read requests from any downstream
device must have responses that fit within a single packet.

This is completely against how the spec envisions things working,
segmentation is a mandatory function. As you point out there is no
parameter bounding the maximum read request size that a completer will
accept.

So, the only fix is that every downstream device must always have a
MRSS set to less than the MPS of the host bridge.

Which means the tuning code must be involved somehow, as that code
controls the MRSS of unrelated devices...

Regards,
Jason

^ permalink raw reply

* [PATCH v4 1/2] platform: Remove most references to platform_bus device
From: Greg Kroah-Hartman @ 2014-07-23 17:41 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1406135239-17550-1-git-send-email-pawel.moll@arm.com>

On Wed, Jul 23, 2014 at 06:07:18PM +0100, Pawel Moll wrote:
> A number of board files in arch/arm and arch/unicore32
> explicitly reference platform_bus device as a parent
> for new platform devices.
> 
> This is unnecessary, as platform device API guarantees
> that devices with NULL parent are going to by adopted
> by the mentioned "root" device.
> 
> This patch removes or replaces with NULL such references.
> 
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> ---
>  arch/arm/mach-bcm/board_bcm21664.c      |  3 +--
>  arch/arm/mach-bcm/board_bcm281xx.c      |  3 +--
>  arch/arm/mach-clps711x/board-edb7211.c  |  6 +++---
>  arch/arm/mach-clps711x/board-p720t.c    |  6 +++---
>  arch/arm/mach-imx/mach-mx27ads.c        |  2 +-
>  arch/arm/mach-shmobile/board-ape6evm.c  | 14 +++++++-------
>  arch/arm/mach-shmobile/board-bockw.c    | 19 ++++++++----------
>  arch/arm/mach-shmobile/board-genmai.c   |  5 ++---
>  arch/arm/mach-shmobile/board-koelsch.c  | 26 ++++++++++++-------------
>  arch/arm/mach-shmobile/board-lager.c    | 34 ++++++++++++++-------------------
>  arch/arm/mach-shmobile/board-marzen.c   |  1 -
>  arch/arm/mach-shmobile/setup-r7s72100.c |  2 +-
>  arch/arm/mach-shmobile/setup-r8a73a4.c  |  8 ++++----
>  arch/arm/mach-shmobile/setup-r8a7778.c  | 13 ++++++-------
>  arch/arm/mach-shmobile/setup-r8a7779.c  |  6 +++---
>  arch/arm/mach-shmobile/setup-r8a7790.c  | 10 +++++-----
>  arch/arm/mach-shmobile/setup-r8a7791.c  |  8 ++++----
>  arch/unicore32/kernel/puv3-core.c       |  2 +-
>  arch/unicore32/kernel/puv3-nb0916.c     |  6 +++---
>  19 files changed, 79 insertions(+), 95 deletions(-)

Looks good, if there are no objections, I'll take this through my
driver-core tree, so that your follow-on patches that change things will
still apply.

thanks,

greg k-h

^ permalink raw reply

* [PATCH v4 2/2] platform: Make platform_bus device a platform device
From: Greg Kroah-Hartman @ 2014-07-23 17:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1406135239-17550-2-git-send-email-pawel.moll@arm.com>

On Wed, Jul 23, 2014 at 06:07:19PM +0100, Pawel Moll wrote:
> ... describing the root of the device tree, so one can write
> a platform driver initializing the platform.
> 
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> ---
> Changes since v3:
> 
> * split the platform_bus->NULL changes into a separate patch
> * added #ifdef CONFIG_OF around of_allnodes
> 
> Changes since v2:
> 
> * replaced references to platform_bus.dev with NULL
>   in places where it shouldn't make any difference
> 
> Changes since v1:
> 
> * rebased on top of v3.16-rc6
> * fixed up all new explicit references to platform_bus,
>   with majority in mach-shmobile; 99% of them seem completely
>   useless and I was *very* tempted to replace them with
>   NULL - all reasons for and against this are welcomed
> 
> 
>  arch/arm/mach-imx/devices/devices.c |  4 ++--
>  drivers/base/platform.c             | 20 ++++++++++++++------
>  drivers/char/tile-srom.c            |  2 +-
>  drivers/mmc/host/sdhci-pltfm.c      |  2 +-
>  drivers/scsi/hosts.c                |  2 +-
>  include/linux/platform_device.h     |  2 +-
>  6 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
> index 1b4366a..48c3817 100644
> --- a/arch/arm/mach-imx/devices/devices.c
> +++ b/arch/arm/mach-imx/devices/devices.c
> @@ -24,12 +24,12 @@
>  
>  struct device mxc_aips_bus = {
>  	.init_name	= "mxc_aips",
> -	.parent		= &platform_bus,
> +	.parent		= &platform_bus.dev,
>  };
>  
>  struct device mxc_ahb_bus = {
>  	.init_name	= "mxc_ahb",
> -	.parent		= &platform_bus,
> +	.parent		= &platform_bus.dev,
>  };
>  

Again, not ok, these are real busses, don't hang them off the platform
bus, have them be at the root of the device tree so they aren't
"hidden".

> diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c
> index bd37747..4e4b7a2 100644
> --- a/drivers/char/tile-srom.c
> +++ b/drivers/char/tile-srom.c
> @@ -350,7 +350,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index)
>  		       SROM_PAGE_SIZE_OFF, sizeof(srom->page_size)) < 0)
>  		return -EIO;
>  
> -	dev = device_create(srom_class, &platform_bus,
> +	dev = device_create(srom_class, &platform_bus.dev,
>  			    MKDEV(srom_major, index), srom, "%d", index);
>  	return PTR_ERR_OR_ZERO(dev);
>  }

Why isn't this just NULL?  It's pretending to be a platform device by
doing this, which isn't ok.


> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index 7e834fb..9a2b0d0 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -137,7 +137,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
>  		dev_err(&pdev->dev, "Invalid iomem size!\n");
>  
>  	/* Some PCI-based MFD need the parent here */
> -	if (pdev->dev.parent != &platform_bus && !np)
> +	if (pdev->dev.parent != &platform_bus.dev && !np)
>  		host = sdhci_alloc_host(pdev->dev.parent,
>  			sizeof(struct sdhci_pltfm_host) + priv_size);
>  	else

Again, this isn't ok, check the type of the device if you really want to
"know" what it is, don't assume that it is going to be at one level deep
in the platform device hierarchy.

> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index 3cbb57a..c14c36f 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -218,7 +218,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
>  		goto fail;
>  
>  	if (!shost->shost_gendev.parent)
> -		shost->shost_gendev.parent = dev ? dev : &platform_bus;
> +		shost->shost_gendev.parent = dev ? dev : &platform_bus.dev;
>  	if (!dma_dev)
>  		dma_dev = shost->shost_gendev.parent;
>  

Again, no "pretending" to be a platform device if it really isn't.

> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> index 16f6654..a99032a 100644
> --- a/include/linux/platform_device.h
> +++ b/include/linux/platform_device.h
> @@ -44,7 +44,7 @@ extern int platform_device_register(struct platform_device *);
>  extern void platform_device_unregister(struct platform_device *);
>  
>  extern struct bus_type platform_bus_type;
> -extern struct device platform_bus;
> +extern struct platform_device platform_bus;

My end-goal is to just remove this external reference entirely, no one
outside of the platform file should be referencing it, just like all
other busses.

thanks,

greg k-h

^ permalink raw reply

* [PATCH v6 2/7] drivers: cpuidle: implement DT based idle states infrastructure
From: Lorenzo Pieralisi @ 2014-07-23 17:32 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAJ5Y-eY9YACzk_8LpZ9mnaj4stqOF_uWWt1+tL7nexqZj-ZFyQ@mail.gmail.com>

Hi Ashwin,

On Wed, Jul 23, 2014 at 05:34:16PM +0100, Ashwin Chaugule wrote:
> Hi Lorenzo,
> 
> On 21 July 2014 12:06, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> > +/**
> > + * dt_init_idle_driver() - Parse the DT idle states and initialize the
> > + *                        idle driver states array
> > + *
> > + * @drv:         Pointer to CPU idle driver to be initialized
> > + * @start_idx:    First idle state index to be initialized
> > + *
> > + * On success the states array in the cpuidle driver contains
> > + * initialized entries in the states array, starting from index start_idx.
> > + *
> > + * Return:
> > + *     0 on success
> > + *     <0 on failure
> > + */
> > +int dt_init_idle_driver(struct cpuidle_driver *drv, unsigned int start_idx)
> > +{
> > +       unsigned int i, state_idx = start_idx;
> > +       struct cpuidle_state *idle_state;
> > +       struct device_node *state_node, *cpu_node;
> > +
> > +
> > +       if (state_idx >= CPUIDLE_STATE_MAX)
> > +               return -EINVAL;
> > +       /*
> > +        * We get the idle states for the first logical cpu in the
> > +        * driver mask. The kernel does not check idle states on all
> > +        * cpus in the driver mask, they are assumed to be the same
> > +        * by default.
> > +        */
> > +       cpu_node = of_cpu_device_node_get(cpumask_first(drv->cpumask));
> 
> Is this an assumption for the short term? My understanding from the
> corresponding ACPI discussions is that the order of idle states may
> not necessarily be same for all CPUs, even for big.Little?

Well, it is more of a problem of the CPUidle infrastructure than related
to this specific patchset. The idle states for a specific cpumask (ie CPUidle
driver) are expected to be all the same, same order same data.

Current driver can be used on homegeneous ARM64 SMP systems, but I am fairly
confident we can extend it for big.LITTLE and also other funky SMP
configurations, the parsing code only expects all cpus in the mask
to have the same set of idle states (and so does the CPUidle core), if that's
not the case, the cpus belong in different CPUidle drivers (ie a CPUidle
driver is a set of states valid on a cpumask).

So my answer is yes, it is a proper assumption and not only for the
short term, but in general.

HTH,
Lorenzo

^ permalink raw reply

* [PATCH] ARM: dts: imx6qdl-sabresd: add always on pcie regulator
From: Lucas Stach @ 2014-07-23 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

Everything in the PCI specification assumes devices to be
enumerable on startup. This is only possible if they have
power available.

A future improvement may allow this regulator to be switched
off for D3hot and D3cold power states, but there is a lot
of work to do the pcie host controller side for this to work.
To keep things simple always enable the regulator for now.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
v2: - rename to MPCIE_3V3
    - add proper pinctrl
---
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 40ea36534643..f35c06102969 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -54,6 +54,19 @@
 			gpio = <&gpio4 10 0>;
 			enable-active-high;
 		};
+
+		reg_pcie: regulator at 3 {
+			compatible = "regulator-fixed";
+			reg = <3>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_pcie_reg>;
+			regulator-name = "MPCIE_3V3";
+			regulator-min-microvolt = <3300000>;
+			regulator-max-microvolt = <3300000>;
+			gpio = <&gpio3 19 0>;
+			regulator-always-on;
+			enable-active-high;
+		};
 	};
 
 	gpio-keys {
@@ -399,6 +412,12 @@
 			>;
 		};
 
+		pinctrl_pcie_reg: pciereggrp {
+			fsl,pins = <
+				MX6QDL_PAD_EIM_D19__GPIO3_IO19	0x1b0b0
+			>;
+		};
+
 		pinctrl_pwm1: pwm1grp {
 			fsl,pins = <
 				MX6QDL_PAD_SD1_DAT3__PWM1_OUT		0x1b0b1
-- 
2.0.1

^ permalink raw reply related

* [PATCH 2/2] Adding lenovo in vendor
From: Jason Cooper @ 2014-07-23 17:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140723151033.GF2856@lunn.ch>

On Wed, Jul 23, 2014 at 05:10:33PM +0200, Andrew Lunn wrote:
> > > +lenovo	LENOVO
> > 
> > is this their official, registered company name?
> 
> http://www.lenovo.com/ww/lenovo/FAQs.html says
> 
> 1. What is Lenovo?s stock symbol (ticker)?
> HKSE: 992.hk
> ADR (Level I): LNVGY
> 
> So i think lenovo is probably the more understandable vendor prefix,
> even if it is not the official stock ticker.
> 
> However there official registered company name appears to be
> Lenovo Group Limited.

Agreed, Benoit, please do 'lenovo  Lenovo Group Limited'

thx,

Jason.

^ permalink raw reply

* [PATCH v6 2/7] drivers: cpuidle: implement DT based idle states infrastructure
From: Lorenzo Pieralisi @ 2014-07-23 17:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <53CFDDD1.5030002@linaro.org>

On Wed, Jul 23, 2014 at 05:07:45PM +0100, Daniel Lezcano wrote:
> On 07/21/2014 06:06 PM, Lorenzo Pieralisi wrote:
> > On most common ARM systems, the low-power states a CPU can be put into are
> > not discoverable in HW and require device tree bindings to describe
> > power down suspend operations and idle states parameters.
> >
> > In order to enable DT based idle states and configure idle drivers, this
> > patch implements the bulk infrastructure required to parse the device tree
> > idle states bindings and initialize the corresponding CPUidle driver states
> > data.
> >
> > The parsing API accepts a start index that defines the first idle state
> > that should be initialized by the parsing code in order to give new and
> > legacy driver flexibility over which states should be parsed using the
> > new DT mechanism.
> >
> > The idle states list is obtained from the first cpu in the driver
> > cpumask, which implicitly means the parsing code expects idle states
> > (and related list of phandles) to be the same for all CPUs in the
> > CPUidle driver mask. The kernel does not check this assumption, it must
> > be enforced by the bootloader to ensure correct system behaviour.
> >
> > Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> 
> This patch looks good for me but I have a couple of questions below.
> 
> > ---
> >   drivers/cpuidle/Kconfig          |   8 +++
> >   drivers/cpuidle/Makefile         |   1 +
> >   drivers/cpuidle/dt_idle_states.c | 138 +++++++++++++++++++++++++++++++++++++++
> >   drivers/cpuidle/dt_idle_states.h |   5 ++
> >   4 files changed, 152 insertions(+)
> >   create mode 100644 drivers/cpuidle/dt_idle_states.c
> >   create mode 100644 drivers/cpuidle/dt_idle_states.h
> >
> > diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> > index 1b96fb9..414e7a96 100644
> > --- a/drivers/cpuidle/Kconfig
> > +++ b/drivers/cpuidle/Kconfig
> > @@ -30,6 +30,14 @@ config CPU_IDLE_GOV_MENU
> >   	bool "Menu governor (for tickless system)"
> >   	default y
> >
> > +config DT_IDLE_STATES
> > +        bool "Idle states DT support"
> > +	depends on ARM || ARM64
> > +	help
> > +	 Allows the CPU idle framework to initialize CPU idle drivers
> > +	 state data by using DT provided nodes compliant with idle states
> > +	 device tree bindings.
> > +
> 
> Wouldn't make sense to make this as an hidden option and let the 
> different drivers to set DT_IDLE_STATES if they depend on it ?

Yes, it would :)

[...]

> > +/**
> > + * dt_init_idle_driver() - Parse the DT idle states and initialize the
> > + *			   idle driver states array
> > + *
> > + * @drv:	  Pointer to CPU idle driver to be initialized
> > + * @start_idx:    First idle state index to be initialized
> > + *
> > + * On success the states array in the cpuidle driver contains
> > + * initialized entries in the states array, starting from index start_idx.
> > + *
> > + * Return:
> > + *	0 on success
> > + *	<0 on failure
> > + */
> > +int dt_init_idle_driver(struct cpuidle_driver *drv, unsigned int start_idx)
> > +{
> > +	unsigned int i, state_idx = start_idx;
> > +	struct cpuidle_state *idle_state;
> > +	struct device_node *state_node, *cpu_node;
> > +
> > +
> > +	if (state_idx >= CPUIDLE_STATE_MAX)
> > +		return -EINVAL;
> > +	/*
> > +	 * We get the idle states for the first logical cpu in the
> > +	 * driver mask. The kernel does not check idle states on all
> > +	 * cpus in the driver mask, they are assumed to be the same
> > +	 * by default.
> > +	 */
> > +	cpu_node = of_cpu_device_node_get(cpumask_first(drv->cpumask));
> > +
> > +	for (i = 0; ; i++) {
> > +		int err;
> > +
> > +		state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i);
> > +		if (!state_node)
> > +			break;
> > +
> > +		if (state_idx == CPUIDLE_STATE_MAX) {
> > +			pr_warn("State index reached static CPU idle driver states array size\n");
> > +			break;
> > +		}
> > +
> > +		idle_state = &drv->states[state_idx++];
> > +		err = init_state_node(idle_state, state_node);
> > +		if (err)
> 
> As the init_state_node error traces are in pr_debug level, a pr_err 
> would help here IMO.

I think I agree, since at this point we have an idle state phandle and
we verified that the node it points at contains invalid bindings, so it is
fair to flag this up.

I will add it.

Thanks !
Lorenzo

^ permalink raw reply

* [PATCH v3] platform: Make platform_bus device a platform device
From: Pawel Moll @ 2014-07-23 17:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140722181505.GA9898@kroah.com>

On Tue, 2014-07-22 at 19:15 +0100, Greg Kroah-Hartman wrote:
> > > diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
> > > index 1b4366a..48c3817 100644
> > > --- a/arch/arm/mach-imx/devices/devices.c
> > > +++ b/arch/arm/mach-imx/devices/devices.c
> > > @@ -24,12 +24,12 @@
> > > 
> > >  struct device mxc_aips_bus = {
> > >         .init_name      = "mxc_aips",
> > > -       .parent         = &platform_bus,
> > > +       .parent         = &platform_bus.dev,
> > >  };
> > > 
> > >  struct device mxc_ahb_bus = {
> > >         .init_name      = "mxc_ahb",
> > > -       .parent         = &platform_bus,
> > > +       .parent         = &platform_bus.dev,
> > >  };
> > > 
> > >  int __init mxc_device_init(void)
> > 
> > Seems that the author meant to have those two bus devices hanging from
> > the platform_bus in device hierarchy. Seems fair enough to me.
> 
> No, not at all, this is a different bus, put the root bus at the root of
> the sysfs tree, not at some "arbritrary" point on a platform device.

I think the author considers platform bus is understood as a
representation of the MMIO space (and he's not alone). So then he wants
to represent the physical hierarchy of the interconnect to get it in
separate places in the /sys/devices/* tree.

Whether it's a good thing to do or not, have no strong opinion, but can
understand his approach. I don't think it's a big deal either way.

> > > diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c
> > > index bd37747..4e4b7a2 100644
> > > --- a/drivers/char/tile-srom.c
> > > +++ b/drivers/char/tile-srom.c
> > > @@ -350,7 +350,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index)
> > >                        SROM_PAGE_SIZE_OFF, sizeof(srom->page_size)) < 0)
> > >                 return -EIO;
> > > 
> > > -       dev = device_create(srom_class, &platform_bus,
> > > +       dev = device_create(srom_class, &platform_bus.dev,
> > >                             MKDEV(srom_major, index), srom, "%d", index);
> > >         return PTR_ERR_OR_ZERO(dev);
> > >  }
> > 
> > Again, non-platform device placed in the hierarchy.
> 
> Again, not ok.  If it's a platform device, it's a platform device, and
> make it one.  If it isn't, like this one, make it a virtual device and
> pass NULL here.

Yeah, I can't disagree here.

> > > diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> > > index 7e834fb..9a2b0d0 100644
> > > --- a/drivers/mmc/host/sdhci-pltfm.c
> > > +++ b/drivers/mmc/host/sdhci-pltfm.c
> > > @@ -137,7 +137,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
> > >                 dev_err(&pdev->dev, "Invalid iomem size!\n");
> > > 
> > >         /* Some PCI-based MFD need the parent here */
> > > -       if (pdev->dev.parent != &platform_bus && !np)
> > > +       if (pdev->dev.parent != &platform_bus.dev && !np)
> > >                 host = sdhci_alloc_host(pdev->dev.parent,
> > >                         sizeof(struct sdhci_pltfm_host) + priv_size);
> > >         else
> > 
> > Special treatment for non-platform devices.
> 
> Ugh, why should you care?  I don't understand the logic here.

Neither do I, but maybe there is' some :-) I definitely wouldn't like to
change the behaviour without checking with the maintainers.

> > > diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> > > index 3cbb57a..c14c36f 100644
> > > --- a/drivers/scsi/hosts.c
> > > +++ b/drivers/scsi/hosts.c
> > > @@ -218,7 +218,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
> > >                 goto fail;
> > > 
> > >         if (!shost->shost_gendev.parent)
> > > -               shost->shost_gendev.parent = dev ? dev : &platform_bus;
> > > +               shost->shost_gendev.parent = dev ? dev : &platform_bus.dev;
> > >         if (!dma_dev)
> > >                 dma_dev = shost->shost_gendev.parent;
> > > 
> > 
> > shost_gendev is a generic (as in struct device, non-platform one)
> > device, that is being explicitly placed in the hierarchy.
> 
> Then make it a virtual device, as that's what it is, replace this with
> NULL.

Makes sense to me, I just wonder what the author meant.

> > So it makes it 4, not 3 ;-) places where referencing platform_bus
> > *maybe* makes some sense.
> 
> Nope, see above :)

Let me just point out that I'm just playing the devil's advocate
here :-)

Pawel

^ permalink raw reply

* [PATCH v4 2/2] platform: Make platform_bus device a platform device
From: Pawel Moll @ 2014-07-23 17:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1406135239-17550-1-git-send-email-pawel.moll@arm.com>

... describing the root of the device tree, so one can write
a platform driver initializing the platform.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
Changes since v3:

* split the platform_bus->NULL changes into a separate patch
* added #ifdef CONFIG_OF around of_allnodes

Changes since v2:

* replaced references to platform_bus.dev with NULL
  in places where it shouldn't make any difference

Changes since v1:

* rebased on top of v3.16-rc6
* fixed up all new explicit references to platform_bus,
  with majority in mach-shmobile; 99% of them seem completely
  useless and I was *very* tempted to replace them with
  NULL - all reasons for and against this are welcomed


 arch/arm/mach-imx/devices/devices.c |  4 ++--
 drivers/base/platform.c             | 20 ++++++++++++++------
 drivers/char/tile-srom.c            |  2 +-
 drivers/mmc/host/sdhci-pltfm.c      |  2 +-
 drivers/scsi/hosts.c                |  2 +-
 include/linux/platform_device.h     |  2 +-
 6 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
index 1b4366a..48c3817 100644
--- a/arch/arm/mach-imx/devices/devices.c
+++ b/arch/arm/mach-imx/devices/devices.c
@@ -24,12 +24,12 @@
 
 struct device mxc_aips_bus = {
 	.init_name	= "mxc_aips",
-	.parent		= &platform_bus,
+	.parent		= &platform_bus.dev,
 };
 
 struct device mxc_ahb_bus = {
 	.init_name	= "mxc_ahb",
-	.parent		= &platform_bus,
+	.parent		= &platform_bus.dev,
 };
 
 int __init mxc_device_init(void)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index eee48c4..9caffa7 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -30,8 +30,8 @@
 /* For automatically allocated device IDs */
 static DEFINE_IDA(platform_devid_ida);
 
-struct device platform_bus = {
-	.init_name	= "platform",
+struct platform_device platform_bus = {
+	.name	= "platform",
 };
 EXPORT_SYMBOL_GPL(platform_bus);
 
@@ -300,7 +300,7 @@ int platform_device_add(struct platform_device *pdev)
 		return -EINVAL;
 
 	if (!pdev->dev.parent)
-		pdev->dev.parent = &platform_bus;
+		pdev->dev.parent = &platform_bus.dev;
 
 	pdev->dev.bus = &platform_bus_type;
 
@@ -946,12 +946,20 @@ int __init platform_bus_init(void)
 
 	early_platform_cleanup();
 
-	error = device_register(&platform_bus);
+	dev_set_name(&platform_bus.dev, "%s", platform_bus.name);
+	error = device_register(&platform_bus.dev);
 	if (error)
 		return error;
 	error =  bus_register(&platform_bus_type);
-	if (error)
-		device_unregister(&platform_bus);
+	if (!error) {
+#ifdef CONFIG_OF
+		platform_bus.dev.of_node = of_allnodes;
+#endif
+		platform_bus.dev.bus = &platform_bus_type;
+		bus_add_device(&platform_bus.dev);
+	} else {
+		device_unregister(&platform_bus.dev);
+	}
 	return error;
 }
 
diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c
index bd37747..4e4b7a2 100644
--- a/drivers/char/tile-srom.c
+++ b/drivers/char/tile-srom.c
@@ -350,7 +350,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index)
 		       SROM_PAGE_SIZE_OFF, sizeof(srom->page_size)) < 0)
 		return -EIO;
 
-	dev = device_create(srom_class, &platform_bus,
+	dev = device_create(srom_class, &platform_bus.dev,
 			    MKDEV(srom_major, index), srom, "%d", index);
 	return PTR_ERR_OR_ZERO(dev);
 }
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 7e834fb..9a2b0d0 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -137,7 +137,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 		dev_err(&pdev->dev, "Invalid iomem size!\n");
 
 	/* Some PCI-based MFD need the parent here */
-	if (pdev->dev.parent != &platform_bus && !np)
+	if (pdev->dev.parent != &platform_bus.dev && !np)
 		host = sdhci_alloc_host(pdev->dev.parent,
 			sizeof(struct sdhci_pltfm_host) + priv_size);
 	else
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 3cbb57a..c14c36f 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -218,7 +218,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 		goto fail;
 
 	if (!shost->shost_gendev.parent)
-		shost->shost_gendev.parent = dev ? dev : &platform_bus;
+		shost->shost_gendev.parent = dev ? dev : &platform_bus.dev;
 	if (!dma_dev)
 		dma_dev = shost->shost_gendev.parent;
 
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 16f6654..a99032a 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -44,7 +44,7 @@ extern int platform_device_register(struct platform_device *);
 extern void platform_device_unregister(struct platform_device *);
 
 extern struct bus_type platform_bus_type;
-extern struct device platform_bus;
+extern struct platform_device platform_bus;
 
 extern void arch_setup_pdev_archdata(struct platform_device *);
 extern struct resource *platform_get_resource(struct platform_device *,
-- 
1.9.1

^ permalink raw reply related

* [PATCH v4 1/2] platform: Remove most references to platform_bus device
From: Pawel Moll @ 2014-07-23 17:07 UTC (permalink / raw)
  To: linux-arm-kernel

A number of board files in arch/arm and arch/unicore32
explicitly reference platform_bus device as a parent
for new platform devices.

This is unnecessary, as platform device API guarantees
that devices with NULL parent are going to by adopted
by the mentioned "root" device.

This patch removes or replaces with NULL such references.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
---
 arch/arm/mach-bcm/board_bcm21664.c      |  3 +--
 arch/arm/mach-bcm/board_bcm281xx.c      |  3 +--
 arch/arm/mach-clps711x/board-edb7211.c  |  6 +++---
 arch/arm/mach-clps711x/board-p720t.c    |  6 +++---
 arch/arm/mach-imx/mach-mx27ads.c        |  2 +-
 arch/arm/mach-shmobile/board-ape6evm.c  | 14 +++++++-------
 arch/arm/mach-shmobile/board-bockw.c    | 19 ++++++++----------
 arch/arm/mach-shmobile/board-genmai.c   |  5 ++---
 arch/arm/mach-shmobile/board-koelsch.c  | 26 ++++++++++++-------------
 arch/arm/mach-shmobile/board-lager.c    | 34 ++++++++++++++-------------------
 arch/arm/mach-shmobile/board-marzen.c   |  1 -
 arch/arm/mach-shmobile/setup-r7s72100.c |  2 +-
 arch/arm/mach-shmobile/setup-r8a73a4.c  |  8 ++++----
 arch/arm/mach-shmobile/setup-r8a7778.c  | 13 ++++++-------
 arch/arm/mach-shmobile/setup-r8a7779.c  |  6 +++---
 arch/arm/mach-shmobile/setup-r8a7790.c  | 10 +++++-----
 arch/arm/mach-shmobile/setup-r8a7791.c  |  8 ++++----
 arch/unicore32/kernel/puv3-core.c       |  2 +-
 arch/unicore32/kernel/puv3-nb0916.c     |  6 +++---
 19 files changed, 79 insertions(+), 95 deletions(-)

diff --git a/arch/arm/mach-bcm/board_bcm21664.c b/arch/arm/mach-bcm/board_bcm21664.c
index f0521cc..82ad568 100644
--- a/arch/arm/mach-bcm/board_bcm21664.c
+++ b/arch/arm/mach-bcm/board_bcm21664.c
@@ -60,8 +60,7 @@ static void bcm21664_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init bcm21664_init(void)
 {
-	of_platform_populate(NULL, of_default_bus_match_table, NULL,
-		&platform_bus);
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 	kona_l2_cache_init();
 }
 
diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c
index 1ac59fc..2e367bd 100644
--- a/arch/arm/mach-bcm/board_bcm281xx.c
+++ b/arch/arm/mach-bcm/board_bcm281xx.c
@@ -58,8 +58,7 @@ static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init bcm281xx_init(void)
 {
-	of_platform_populate(NULL, of_default_bus_match_table, NULL,
-		&platform_bus);
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 	kona_l2_cache_init();
 }
 
diff --git a/arch/arm/mach-clps711x/board-edb7211.c b/arch/arm/mach-clps711x/board-edb7211.c
index f9828f8..6144fb5 100644
--- a/arch/arm/mach-clps711x/board-edb7211.c
+++ b/arch/arm/mach-clps711x/board-edb7211.c
@@ -158,16 +158,16 @@ static void __init edb7211_init_late(void)
 	gpio_request_array(edb7211_gpios, ARRAY_SIZE(edb7211_gpios));
 
 	platform_device_register(&edb7211_flash_pdev);
-	platform_device_register_data(&platform_bus, "platform-lcd", 0,
+	platform_device_register_data(NULL, "platform-lcd", 0,
 				      &edb7211_lcd_power_pdata,
 				      sizeof(edb7211_lcd_power_pdata));
-	platform_device_register_data(&platform_bus, "generic-bl", 0,
+	platform_device_register_data(NULL, "generic-bl", 0,
 				      &edb7211_lcd_backlight_pdata,
 				      sizeof(edb7211_lcd_backlight_pdata));
 	platform_device_register_simple("video-clps711x", 0, NULL, 0);
 	platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource,
 					ARRAY_SIZE(edb7211_cs8900_resource));
-	platform_device_register_data(&platform_bus, "i2c-gpio", 0,
+	platform_device_register_data(NULL, "i2c-gpio", 0,
 				      &edb7211_i2c_pdata,
 				      sizeof(edb7211_i2c_pdata));
 }
diff --git a/arch/arm/mach-clps711x/board-p720t.c b/arch/arm/mach-clps711x/board-p720t.c
index 0cf0e51..96bcc76 100644
--- a/arch/arm/mach-clps711x/board-p720t.c
+++ b/arch/arm/mach-clps711x/board-p720t.c
@@ -348,14 +348,14 @@ static void __init p720t_init_late(void)
 {
 	WARN_ON(gpio_request_array(p720t_gpios, ARRAY_SIZE(p720t_gpios)));
 
-	platform_device_register_data(&platform_bus, "platform-lcd", 0,
+	platform_device_register_data(NULL, "platform-lcd", 0,
 				      &p720t_lcd_power_pdata,
 				      sizeof(p720t_lcd_power_pdata));
-	platform_device_register_data(&platform_bus, "generic-bl", 0,
+	platform_device_register_data(NULL, "generic-bl", 0,
 				      &p720t_lcd_backlight_pdata,
 				      sizeof(p720t_lcd_backlight_pdata));
 	platform_device_register_simple("video-clps711x", 0, NULL, 0);
-	platform_device_register_data(&platform_bus, "leds-gpio", 0,
+	platform_device_register_data(NULL, "leds-gpio", 0,
 				      &p720t_gpio_led_pdata,
 				      sizeof(p720t_gpio_led_pdata));
 }
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 2f834ce..eb1c347 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -245,7 +245,7 @@ static void __init mx27ads_regulator_init(void)
 	vchip->set		= vgpio_set;
 	gpiochip_add(vchip);
 
-	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
+	platform_device_register_data(NULL, "reg-fixed-voltage",
 				      PLATFORM_DEVID_AUTO,
 				      &mx27ads_lcd_regulator_pdata,
 				      sizeof(mx27ads_lcd_regulator_pdata));
diff --git a/arch/arm/mach-shmobile/board-ape6evm.c b/arch/arm/mach-shmobile/board-ape6evm.c
index fe071a9..7ab99a4 100644
--- a/arch/arm/mach-shmobile/board-ape6evm.c
+++ b/arch/arm/mach-shmobile/board-ape6evm.c
@@ -248,29 +248,29 @@ static void __init ape6evm_add_standard_devices(void)
 
 	regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
 
-	platform_device_register_resndata(&platform_bus, "smsc911x", -1,
+	platform_device_register_resndata(NULL, "smsc911x", -1,
 					  lan9220_res, ARRAY_SIZE(lan9220_res),
 					  &lan9220_data, sizeof(lan9220_data));
 
 	regulator_register_always_on(1, "MMC0 Vcc", vcc_mmc0_consumers,
 				     ARRAY_SIZE(vcc_mmc0_consumers), 2800000);
-	platform_device_register_resndata(&platform_bus, "sh_mmcif", 0,
+	platform_device_register_resndata(NULL, "sh_mmcif", 0,
 					  mmcif0_resources, ARRAY_SIZE(mmcif0_resources),
 					  &mmcif0_pdata, sizeof(mmcif0_pdata));
-	platform_device_register_data(&platform_bus, "reg-fixed-voltage", 2,
+	platform_device_register_data(NULL, "reg-fixed-voltage", 2,
 				      &vcc_sdhi0_info, sizeof(vcc_sdhi0_info));
-	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+	platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0,
 					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
 					  &sdhi0_pdata, sizeof(sdhi0_pdata));
 	regulator_register_always_on(3, "SDHI1 Vcc", vcc_sdhi1_consumers,
 				     ARRAY_SIZE(vcc_sdhi1_consumers), 3300000);
-	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1,
+	platform_device_register_resndata(NULL, "sh_mobile_sdhi", 1,
 					  sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
 					  &sdhi1_pdata, sizeof(sdhi1_pdata));
-	platform_device_register_data(&platform_bus, "gpio-keys", -1,
+	platform_device_register_data(NULL, "gpio-keys", -1,
 				      &ape6evm_keys_pdata,
 				      sizeof(ape6evm_keys_pdata));
-	platform_device_register_data(&platform_bus, "leds-gpio", -1,
+	platform_device_register_data(NULL, "leds-gpio", -1,
 				      &ape6evm_leds_pdata,
 				      sizeof(ape6evm_leds_pdata));
 }
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index f444be2..3ec82a4 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -177,7 +177,7 @@ static struct renesas_usbhs_platform_info usbhs_info __initdata = {
 #define USB1_DEVICE	"renesas_usbhs"
 #define ADD_USB_FUNC_DEVICE_IF_POSSIBLE()			\
 	platform_device_register_resndata(			\
-		&platform_bus, "renesas_usbhs", -1,		\
+		NULL, "renesas_usbhs", -1,			\
 		usbhsf_resources,				\
 		ARRAY_SIZE(usbhsf_resources),			\
 		&usbhs_info, sizeof(struct renesas_usbhs_platform_info))
@@ -236,7 +236,6 @@ static struct sh_eth_plat_data ether_platform_data __initdata = {
 };
 
 static struct platform_device_info ether_info __initdata = {
-	.parent		= &platform_bus,
 	.name		= "r8a777x-ether",
 	.id		= -1,
 	.res		= ether_resources,
@@ -322,7 +321,6 @@ static struct resource vin##idx##_resources[] __initdata = {		\
 };									\
 									\
 static struct platform_device_info vin##idx##_info __initdata = {	\
-	.parent		= &platform_bus,				\
 	.name		= "r8a7778-vin",				\
 	.id		= idx,						\
 	.res		= vin##idx##_resources,				\
@@ -621,10 +619,10 @@ static void __init bockw_init(void)
 	/* VIN1 has a pin conflict with Ether */
 	if (!IS_ENABLED(CONFIG_SH_ETH))
 		platform_device_register_full(&vin1_info);
-	platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0,
+	platform_device_register_data(NULL, "soc-camera-pdrv", 0,
 				      &iclink0_ml86v7667,
 				      sizeof(iclink0_ml86v7667));
-	platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1,
+	platform_device_register_data(NULL, "soc-camera-pdrv", 1,
 				      &iclink1_ml86v7667,
 				      sizeof(iclink1_ml86v7667));
 
@@ -637,12 +635,12 @@ static void __init bockw_init(void)
 	r8a7778_pinmux_init();
 
 	platform_device_register_resndata(
-		&platform_bus, "sh_mmcif", -1,
+		NULL, "sh_mmcif", -1,
 		mmc_resources, ARRAY_SIZE(mmc_resources),
 		&sh_mmcif_plat, sizeof(struct sh_mmcif_plat_data));
 
 	platform_device_register_resndata(
-		&platform_bus, "rcar_usb_phy", -1,
+		NULL, "rcar_usb_phy", -1,
 		usb_phy_resources,
 		ARRAY_SIZE(usb_phy_resources),
 		&usb_phy_platform_data,
@@ -668,7 +666,7 @@ static void __init bockw_init(void)
 		iowrite16(val, fpga + IRQ0MR);
 
 		platform_device_register_resndata(
-			&platform_bus, "smsc911x", -1,
+			NULL, "smsc911x", -1,
 			smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
 			&smsc911x_data, sizeof(smsc911x_data));
 	}
@@ -685,7 +683,7 @@ static void __init bockw_init(void)
 		iounmap(base);
 
 		platform_device_register_resndata(
-			&platform_bus, "sh_mobile_sdhi", 0,
+			NULL, "sh_mobile_sdhi", 0,
 			sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
 			&sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
 	}
@@ -700,7 +698,7 @@ static void __init bockw_init(void)
 		"ak4554-adc-dac", 1, NULL, 0);
 
 	pdev = platform_device_register_resndata(
-		&platform_bus, "rcar_sound", -1,
+		NULL, "rcar_sound", -1,
 		rsnd_resources, ARRAY_SIZE(rsnd_resources),
 		&rsnd_info, sizeof(rsnd_info));
 
@@ -710,7 +708,6 @@ static void __init bockw_init(void)
 
 	for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) {
 		struct platform_device_info cardinfo = {
-			.parent         = &platform_bus,
 			.name           = "asoc-simple-card",
 			.id             = i,
 			.data           = &rsnd_card_info[i],
diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
index c94201e..37184ff 100644
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -46,7 +46,6 @@ static const struct resource ether_resources[] __initconst = {
 };
 
 static const struct platform_device_info ether_info __initconst = {
-	.parent		= &platform_bus,
 	.name		= "r7s72100-ether",
 	.id		= -1,
 	.res		= ether_resources,
@@ -76,7 +75,7 @@ static const struct rspi_plat_data rspi_pdata __initconst = {
 };
 
 #define r7s72100_register_rspi(idx)					   \
-	platform_device_register_resndata(&platform_bus, "rspi-rz", idx,   \
+	platform_device_register_resndata(NULL, "rspi-rz", idx,            \
 					rspi##idx##_resources,		   \
 					ARRAY_SIZE(rspi##idx##_resources), \
 					&rspi_pdata, sizeof(rspi_pdata))
@@ -118,7 +117,7 @@ R7S72100_SCIF(6, 0xe800a000, gic_iid(245));
 R7S72100_SCIF(7, 0xe800a800, gic_iid(249));
 
 #define r7s72100_register_scif(index)					       \
-	platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+	platform_device_register_resndata(NULL, "sh-sci", index,               \
 					  scif##index##_resources,	       \
 					  ARRAY_SIZE(scif##index##_resources), \
 					  &scif##index##_platform_data,	       \
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index c6c6889..d3aa6ae 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -118,7 +118,6 @@ static const struct resource ether_resources[] __initconst = {
 };
 
 static const struct platform_device_info ether_info __initconst = {
-	.parent		= &platform_bus,
 	.name		= "r8a7791-ether",
 	.id		= -1,
 	.res		= ether_resources,
@@ -230,7 +229,6 @@ static const struct resource sata0_resources[] __initconst = {
 };
 
 static const struct platform_device_info sata0_info __initconst = {
-	.parent		= &platform_bus,
 	.name		= "sata-r8a7791",
 	.id		= 0,
 	.res		= sata0_resources,
@@ -439,13 +437,13 @@ static void __init koelsch_add_standard_devices(void)
 	r8a7791_pinmux_init();
 	r8a7791_add_standard_devices();
 	platform_device_register_full(&ether_info);
-	platform_device_register_data(&platform_bus, "leds-gpio", -1,
+	platform_device_register_data(NULL, "leds-gpio", -1,
 				      &koelsch_leds_pdata,
 				      sizeof(koelsch_leds_pdata));
-	platform_device_register_data(&platform_bus, "gpio-keys", -1,
+	platform_device_register_data(NULL, "gpio-keys", -1,
 				      &koelsch_keys_pdata,
 				      sizeof(koelsch_keys_pdata));
-	platform_device_register_resndata(&platform_bus, "qspi", 0,
+	platform_device_register_resndata(NULL, "qspi", 0,
 					  qspi_resources,
 					  ARRAY_SIZE(qspi_resources),
 					  &qspi_pdata, sizeof(qspi_pdata));
@@ -460,28 +458,28 @@ static void __init koelsch_add_standard_devices(void)
 	koelsch_add_i2c(4);
 	koelsch_add_i2c(5);
 
-	platform_device_register_data(&platform_bus, "reg-fixed-voltage", 0,
+	platform_device_register_data(NULL, "reg-fixed-voltage", 0,
 				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
-	platform_device_register_data(&platform_bus, "reg-fixed-voltage", 1,
+	platform_device_register_data(NULL, "reg-fixed-voltage", 1,
 				      &vcc_sdhi1_info, sizeof(struct fixed_voltage_config));
-	platform_device_register_data(&platform_bus, "reg-fixed-voltage", 2,
+	platform_device_register_data(NULL, "reg-fixed-voltage", 2,
 				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
-	platform_device_register_data(&platform_bus, "gpio-regulator", 0,
+	platform_device_register_data(NULL, "gpio-regulator", 0,
 				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
-	platform_device_register_data(&platform_bus, "gpio-regulator", 1,
+	platform_device_register_data(NULL, "gpio-regulator", 1,
 				      &vccq_sdhi1_info, sizeof(struct gpio_regulator_config));
-	platform_device_register_data(&platform_bus, "gpio-regulator", 2,
+	platform_device_register_data(NULL, "gpio-regulator", 2,
 				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
 
-	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+	platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0,
 					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
 					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
 
-	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 1,
+	platform_device_register_resndata(NULL, "sh_mobile_sdhi", 1,
 					  sdhi1_resources, ARRAY_SIZE(sdhi1_resources),
 					  &sdhi1_info, sizeof(struct sh_mobile_sdhi_info));
 
-	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
+	platform_device_register_resndata(NULL, "sh_mobile_sdhi", 2,
 					  sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
 					  &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
 
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index f8b1e05..d182961 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -277,7 +277,6 @@ static const struct resource ether_resources[] __initconst = {
 };
 
 static const struct platform_device_info ether_info __initconst = {
-	.parent		= &platform_bus,
 	.name		= "r8a7790-ether",
 	.id		= -1,
 	.res		= ether_resources,
@@ -354,7 +353,6 @@ static void __init lager_add_vin_device(unsigned idx,
 					struct rcar_vin_platform_data *pdata)
 {
 	struct platform_device_info vin_info = {
-		.parent		= &platform_bus,
 		.name		= "r8a7790-vin",
 		.id		= idx,
 		.res		= &vin_resources[idx * 2],
@@ -391,7 +389,7 @@ LAGER_CAMERA(1, "adv7180", 0x20, NULL, RCAR_VIN_BT656);
 
 static void __init lager_add_camera1_device(void)
 {
-	platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1,
+	platform_device_register_data(NULL, "soc-camera-pdrv", 1,
 				      &cam1_link, sizeof(cam1_link));
 	lager_add_vin_device(1, &vin1_pdata);
 }
@@ -403,7 +401,6 @@ static const struct resource sata1_resources[] __initconst = {
 };
 
 static const struct platform_device_info sata1_info __initconst = {
-	.parent		= &platform_bus,
 	.name		= "sata-r8a7790",
 	.id		= 1,
 	.res		= sata1_resources,
@@ -533,7 +530,7 @@ static struct usbhs_private usbhs_priv __initdata = {
 static void __init lager_register_usbhs(void)
 {
 	usb_bind_phy("renesas_usbhs", 0, "usb_phy_rcar_gen2");
-	platform_device_register_resndata(&platform_bus,
+	platform_device_register_resndata(NULL,
 					  "renesas_usbhs", -1,
 					  usbhs_resources,
 					  ARRAY_SIZE(usbhs_resources),
@@ -608,7 +605,6 @@ static struct asoc_simple_card_info rsnd_card_info = {
 static void __init lager_add_rsnd_device(void)
 {
 	struct platform_device_info cardinfo = {
-		.parent         = &platform_bus,
 		.name           = "asoc-simple-card",
 		.id             = -1,
 		.data           = &rsnd_card_info,
@@ -620,7 +616,7 @@ static void __init lager_add_rsnd_device(void)
 				ARRAY_SIZE(i2c2_devices));
 
 	platform_device_register_resndata(
-		&platform_bus, "rcar_sound", -1,
+		NULL, "rcar_sound", -1,
 		rsnd_resources, ARRAY_SIZE(rsnd_resources),
 		&rsnd_info, sizeof(rsnd_info));
 
@@ -663,7 +659,6 @@ static const struct resource pci1_resources[] __initconst = {
 };
 
 static const struct platform_device_info pci1_info __initconst = {
-	.parent		= &platform_bus,
 	.name		= "pci-rcar-gen2",
 	.id		= 1,
 	.res		= pci1_resources,
@@ -684,7 +679,6 @@ static const struct resource pci2_resources[] __initconst = {
 };
 
 static const struct platform_device_info pci2_info __initconst = {
-	.parent		= &platform_bus,
 	.name		= "pci-rcar-gen2",
 	.id		= 2,
 	.res		= pci2_resources,
@@ -795,16 +789,16 @@ static void __init lager_add_standard_devices(void)
 	r8a7790_pinmux_init();
 
 	r8a7790_add_standard_devices();
-	platform_device_register_data(&platform_bus, "leds-gpio", -1,
+	platform_device_register_data(NULL, "leds-gpio", -1,
 				      &lager_leds_pdata,
 				      sizeof(lager_leds_pdata));
-	platform_device_register_data(&platform_bus, "gpio-keys", -1,
+	platform_device_register_data(NULL, "gpio-keys", -1,
 				      &lager_keys_pdata,
 				      sizeof(lager_keys_pdata));
 	regulator_register_always_on(fixed_regulator_idx++,
 				     "fixed-3.3V", fixed3v3_power_consumers,
 				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
-	platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
+	platform_device_register_resndata(NULL, "sh_mmcif", 1,
 					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
 					  &mmcif1_pdata, sizeof(mmcif1_pdata));
 
@@ -812,27 +806,27 @@ static void __init lager_add_standard_devices(void)
 
 	lager_add_du_device();
 
-	platform_device_register_resndata(&platform_bus, "qspi", 0,
+	platform_device_register_resndata(NULL, "qspi", 0,
 					  qspi_resources,
 					  ARRAY_SIZE(qspi_resources),
 					  &qspi_pdata, sizeof(qspi_pdata));
 	spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
 
-	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+	platform_device_register_data(NULL, "reg-fixed-voltage", fixed_regulator_idx++,
 				      &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
-	platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
+	platform_device_register_data(NULL, "reg-fixed-voltage", fixed_regulator_idx++,
 				      &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
 
-	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+	platform_device_register_data(NULL, "gpio-regulator", gpio_regulator_idx++,
 				      &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
-	platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
+	platform_device_register_data(NULL, "gpio-regulator", gpio_regulator_idx++,
 				      &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
 
 	lager_add_camera1_device();
 
 	platform_device_register_full(&sata1_info);
 
-	platform_device_register_resndata(&platform_bus, "usb_phy_rcar_gen2",
+	platform_device_register_resndata(NULL, "usb_phy_rcar_gen2",
 					  -1, usbhs_phy_resources,
 					  ARRAY_SIZE(usbhs_phy_resources),
 					  &usbhs_phy_pdata,
@@ -843,10 +837,10 @@ static void __init lager_add_standard_devices(void)
 
 	lager_add_rsnd_device();
 
-	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 0,
+	platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0,
 					  sdhi0_resources, ARRAY_SIZE(sdhi0_resources),
 					  &sdhi0_info, sizeof(struct sh_mobile_sdhi_info));
-	platform_device_register_resndata(&platform_bus, "sh_mobile_sdhi", 2,
+	platform_device_register_resndata(NULL, "sh_mobile_sdhi", 2,
 					  sdhi2_resources, ARRAY_SIZE(sdhi2_resources),
 					  &sdhi2_info, sizeof(struct sh_mobile_sdhi_info));
 }
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index d832a44..6ed324c 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -272,7 +272,6 @@ static struct resource vin##idx##_resources[] __initdata = {	\
 };								\
 								\
 static struct platform_device_info vin##idx##_info __initdata = { \
-	.parent		= &platform_bus,			\
 	.name		= "r8a7779-vin",			\
 	.id		= idx,					\
 	.res		= vin##idx##_resources,			\
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
index 412e179..3885a59 100644
--- a/arch/arm/mach-shmobile/setup-r7s72100.c
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -33,7 +33,7 @@ static struct resource mtu2_resources[] __initdata = {
 };
 
 #define r7s72100_register_mtu2()					\
-	platform_device_register_resndata(&platform_bus, "sh-mtu2",	\
+	platform_device_register_resndata(NULL, "sh-mtu2",		\
 					  -1, mtu2_resources,		\
 					  ARRAY_SIZE(mtu2_resources),	\
 					  NULL, 0)
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 9333770..aaaaf6e 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -68,7 +68,7 @@ R8A73A4_SCIFB(4, 0xe6ce0000, gic_spi(150)); /* SCIFB2 */
 R8A73A4_SCIFB(5, 0xe6cf0000, gic_spi(151)); /* SCIFB3 */
 
 #define r8a73a4_register_scif(index)					       \
-	platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+	platform_device_register_resndata(NULL, "sh-sci", index,	       \
 					  scif##index##_resources,	       \
 					  ARRAY_SIZE(scif##index##_resources), \
 					  &scif##index##_platform_data,	       \
@@ -149,7 +149,7 @@ static const struct resource irqc1_resources[] = {
 };
 
 #define r8a73a4_register_irqc(idx)					\
-	platform_device_register_resndata(&platform_bus, "renesas_irqc", \
+	platform_device_register_resndata(NULL, "renesas_irqc", 	\
 					  idx, irqc##idx##_resources,	\
 					  ARRAY_SIZE(irqc##idx##_resources), \
 					  &irqc##idx##_data,		\
@@ -179,7 +179,7 @@ static struct resource cmt1_resources[] = {
 };
 
 #define r8a7790_register_cmt(idx)					\
-	platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \
+	platform_device_register_resndata(NULL, "sh-cmt-48-gen2",	\
 					  idx, cmt##idx##_resources,	\
 					  ARRAY_SIZE(cmt##idx##_resources), \
 					  &cmt##idx##_platform_data,	\
@@ -280,7 +280,7 @@ static struct resource dma_resources[] = {
 };
 
 #define r8a73a4_register_dmac()							\
-	platform_device_register_resndata(&platform_bus, "sh-dma-engine", 0,	\
+	platform_device_register_resndata(NULL, "sh-dma-engine", 0,		\
 				dma_resources, ARRAY_SIZE(dma_resources),	\
 				&dma_pdata, sizeof(dma_pdata))
 
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index d311ef9..5de7b33 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -64,7 +64,7 @@ R8A7778_SCIF(4, 0xffe44000, gic_iid(0x6a));
 R8A7778_SCIF(5, 0xffe45000, gic_iid(0x6b));
 
 #define r8a7778_register_scif(index)					       \
-	platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+	platform_device_register_resndata(NULL, "sh-sci", index,	       \
 					  scif##index##_resources,	       \
 					  ARRAY_SIZE(scif##index##_resources), \
 					  &scif##index##_platform_data,	       \
@@ -84,7 +84,7 @@ static struct resource sh_tmu0_resources[] = {
 
 #define r8a7778_register_tmu(idx)			\
 	platform_device_register_resndata(		\
-		&platform_bus, "sh-tmu", idx,		\
+		NULL, "sh-tmu", idx,			\
 		sh_tmu##idx##_resources,		\
 		ARRAY_SIZE(sh_tmu##idx##_resources),	\
 		&sh_tmu##idx##_platform_data,		\
@@ -173,7 +173,6 @@ static struct resource ohci_resources[] __initdata = {
 
 #define USB_PLATFORM_INFO(hci)					\
 static struct platform_device_info hci##_info __initdata = {	\
-	.parent		= &platform_bus,			\
 	.name		= #hci "-platform",			\
 	.id		= -1,					\
 	.res		= hci##_resources,			\
@@ -212,7 +211,7 @@ R8A7778_GPIO(4);
 
 #define r8a7778_register_gpio(idx)				\
 	platform_device_register_resndata(			\
-		&platform_bus, "gpio_rcar", idx,		\
+		NULL, "gpio_rcar", idx,				\
 		r8a7778_gpio##idx##_resources,			\
 		ARRAY_SIZE(r8a7778_gpio##idx##_resources),	\
 		&r8a7778_gpio##idx##_platform_data,		\
@@ -496,8 +495,8 @@ static struct resource hpb_dmae_resources[] __initdata = {
 
 static void __init r8a7778_register_hpb_dmae(void)
 {
-	platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
-					  hpb_dmae_resources,
+	platform_device_register_resndata(NULL, "hpb-dma-engine",
+					  -1, hpb_dmae_resources,
 					  ARRAY_SIZE(hpb_dmae_resources),
 					  &dma_platform_data,
 					  sizeof(dma_platform_data));
@@ -565,7 +564,7 @@ void __init r8a7778_init_irq_extpin(int irlm)
 	r8a7778_init_irq_extpin_dt(irlm);
 	if (irlm)
 		platform_device_register_resndata(
-			&platform_bus, "renesas_intc_irqpin", -1,
+			NULL, "renesas_intc_irqpin", -1,
 			irqpin_resources, ARRAY_SIZE(irqpin_resources),
 			&irqpin_platform_data, sizeof(irqpin_platform_data));
 }
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index aba4ed6..9c79182 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -123,7 +123,7 @@ void __init r8a7779_init_irq_extpin(int irlm)
 	r8a7779_init_irq_extpin_dt(irlm);
 	if (irlm)
 		platform_device_register_resndata(
-			&platform_bus, "renesas_intc_irqpin", -1,
+			NULL, "renesas_intc_irqpin", -1,
 			irqpin0_resources, ARRAY_SIZE(irqpin0_resources),
 			&irqpin0_platform_data, sizeof(irqpin0_platform_data));
 }
@@ -632,8 +632,8 @@ static struct resource hpb_dmae_resources[] __initdata = {
 
 static void __init r8a7779_register_hpb_dmae(void)
 {
-	platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
-					  hpb_dmae_resources,
+	platform_device_register_resndata(NULL, "hpb-dma-engine",
+					  -1, hpb_dmae_resources,
 					  ARRAY_SIZE(hpb_dmae_resources),
 					  &dma_platform_data,
 					  sizeof(dma_platform_data));
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index 6bd08b1..10e6768 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -113,7 +113,7 @@ static struct resource r8a7790_audio_dmac_resources[] = {
 
 #define r8a7790_register_audio_dmac(id)				\
 	platform_device_register_resndata(			\
-		&platform_bus, "sh-dma-engine", id,		\
+		NULL, "sh-dma-engine", id,			\
 		&r8a7790_audio_dmac_resources[id * 3],	3,	\
 		&r8a7790_audio_dmac_platform_data,		\
 		sizeof(r8a7790_audio_dmac_platform_data))
@@ -149,7 +149,7 @@ R8A7790_GPIO(4);
 R8A7790_GPIO(5);
 
 #define r8a7790_register_gpio(idx)					\
-	platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \
+	platform_device_register_resndata(NULL, "gpio_rcar", idx,	\
 		r8a7790_gpio##idx##_resources,				\
 		ARRAY_SIZE(r8a7790_gpio##idx##_resources),		\
 		&r8a7790_gpio##idx##_platform_data,			\
@@ -227,7 +227,7 @@ R8A7790_HSCIF(8, 0xe62c0000, gic_spi(154)); /* HSCIF0 */
 R8A7790_HSCIF(9, 0xe62c8000, gic_spi(155)); /* HSCIF1 */
 
 #define r8a7790_register_scif(index)					       \
-	platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+	platform_device_register_resndata(NULL, "sh-sci", index,  	       \
 					  scif##index##_resources,	       \
 					  ARRAY_SIZE(scif##index##_resources), \
 					  &scif##index##_platform_data,	       \
@@ -246,7 +246,7 @@ static const struct resource irqc0_resources[] __initconst = {
 };
 
 #define r8a7790_register_irqc(idx)					\
-	platform_device_register_resndata(&platform_bus, "renesas_irqc", \
+	platform_device_register_resndata(NULL, "renesas_irqc",		\
 					  idx, irqc##idx##_resources,	\
 					  ARRAY_SIZE(irqc##idx##_resources), \
 					  &irqc##idx##_data,		\
@@ -273,7 +273,7 @@ static struct resource cmt0_resources[] = {
 };
 
 #define r8a7790_register_cmt(idx)					\
-	platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \
+	platform_device_register_resndata(NULL, "sh-cmt-48-gen2",	\
 					  idx, cmt##idx##_resources,	\
 					  ARRAY_SIZE(cmt##idx##_resources), \
 					  &cmt##idx##_platform_data,	\
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index 04a96dd..fd54437 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -65,7 +65,7 @@ R8A7791_GPIO(6, 0xe6055400, 32);
 R8A7791_GPIO(7, 0xe6055800, 26);
 
 #define r8a7791_register_gpio(idx)					\
-	platform_device_register_resndata(&platform_bus, "gpio_rcar", idx, \
+	platform_device_register_resndata(NULL, "gpio_rcar", idx,	\
 		r8a7791_gpio##idx##_resources,				\
 		ARRAY_SIZE(r8a7791_gpio##idx##_resources),		\
 		&r8a7791_gpio##idx##_platform_data,			\
@@ -122,7 +122,7 @@ R8A7791_SCIFA(13, 0xe6c78000, gic_spi(30)); /* SCIFA4 */
 R8A7791_SCIFA(14, 0xe6c80000, gic_spi(31)); /* SCIFA5 */
 
 #define r8a7791_register_scif(index)					       \
-	platform_device_register_resndata(&platform_bus, "sh-sci", index,      \
+	platform_device_register_resndata(NULL, "sh-sci", index,  	       \
 					  scif##index##_resources,	       \
 					  ARRAY_SIZE(scif##index##_resources), \
 					  &scif##index##_platform_data,	       \
@@ -138,7 +138,7 @@ static struct resource cmt0_resources[] = {
 };
 
 #define r8a7791_register_cmt(idx)					\
-	platform_device_register_resndata(&platform_bus, "sh-cmt-48-gen2", \
+	platform_device_register_resndata(NULL, "sh-cmt-48-gen2",	\
 					  idx, cmt##idx##_resources,	\
 					  ARRAY_SIZE(cmt##idx##_resources), \
 					  &cmt##idx##_platform_data,	\
@@ -163,7 +163,7 @@ static struct resource irqc0_resources[] = {
 };
 
 #define r8a7791_register_irqc(idx)					\
-	platform_device_register_resndata(&platform_bus, "renesas_irqc", \
+	platform_device_register_resndata(NULL, "renesas_irqc",		\
 					  idx, irqc##idx##_resources,	\
 					  ARRAY_SIZE(irqc##idx##_resources), \
 					  &irqc##idx##_data,		\
diff --git a/arch/unicore32/kernel/puv3-core.c b/arch/unicore32/kernel/puv3-core.c
index 254adee..438dd2e 100644
--- a/arch/unicore32/kernel/puv3-core.c
+++ b/arch/unicore32/kernel/puv3-core.c
@@ -272,7 +272,7 @@ void __init puv3_core_init(void)
 	platform_device_register_simple("PKUnity-v3-UART", 1,
 			puv3_uart1_resources, ARRAY_SIZE(puv3_uart1_resources));
 	platform_device_register_simple("PKUnity-v3-AC97", -1, NULL, 0);
-	platform_device_register_resndata(&platform_bus, "musb_hdrc", -1,
+	platform_device_register_resndata(NULL, "musb_hdrc", -1,
 			puv3_usb_resources, ARRAY_SIZE(puv3_usb_resources),
 			&puv3_usb_plat, sizeof(puv3_usb_plat));
 }
diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c
index 0c6618e..46ebfdc 100644
--- a/arch/unicore32/kernel/puv3-nb0916.c
+++ b/arch/unicore32/kernel/puv3-nb0916.c
@@ -112,13 +112,13 @@ int __init mach_nb0916_init(void)
 	platform_device_register_simple("PKUnity-v3-I2C", -1,
 			puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources));
 
-	platform_device_register_data(&platform_bus, "pwm-backlight", -1,
+	platform_device_register_data(NULL, "pwm-backlight", -1,
 			&nb0916_backlight_data, sizeof(nb0916_backlight_data));
 
-	platform_device_register_data(&platform_bus, "gpio-keys", -1,
+	platform_device_register_data(NULL, "gpio-keys", -1,
 			&nb0916_gpio_button_data, sizeof(nb0916_gpio_button_data));
 
-	platform_device_register_resndata(&platform_bus, "physmap-flash", -1,
+	platform_device_register_resndata(NULL, "physmap-flash", -1,
 			&physmap_flash_resource, 1,
 			&physmap_flash_data, sizeof(physmap_flash_data));
 
-- 
1.9.1

^ permalink raw reply related

* [PATCH v7 0/5] Add Keystone PCIe controller driver
From: Murali Karicheri @ 2014-07-23 16:56 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAErSpo6gEVP7XbiPZ90MP4zn5mrjaJLZTW0_sdjg9Q6HjnnkFg@mail.gmail.com>

On 07/23/2014 12:43 PM, Bjorn Helgaas wrote:
> On Wed, Jul 23, 2014 at 9:27 AM, Murali Karicheri<m-karicheri2@ti.com>  wrote:
>>
>> Bjorn,
>>
>>
>> On 07/22/2014 06:57 PM, Bjorn Helgaas wrote:
>>>
>>> On Mon, Jul 21, 2014 at 12:58:40PM -0400, Murali Karicheri wrote:
>>
>>
>>>> Murali Karicheri (5):
>>>>     PCI: designware: add rd[wr]_other_conf API
>>>>     PCI: designware: refactor MSI code to work with v3.65 dw hardware
>>>
>>>
>>> I applied the above two to my pci/host-designware branch.  The rest didn't
>>> apply cleanly because I applied Kishon's DRA7xx changes first, and there
>>> are several conflicts.  Can you rebase the rest of them on top of
>>> pci/host-designware?
>>
>>
>> Thanks for applying 1 and 2.
>>
>> I will fix up 3 based on your branch and send you updated patch 3 and 4
>> today.  Hope you can apply this updated patch so that I don't have to
>> address any rebase issues. Regarding the MRSS comment, I will discuss it on
>> that thread and send you a fix for removing the bootargs depedency based on
>> what comes out of that discussion. Is that fine?
>
> Yep, sounds reasonable.  I'm about to leave for vacation, so I won't
> be able to apply these until mid-August, but I think we can still get
> them into v3.17 since it's new hardware that shouldn't affect anything
> else.
>
Ok Thanks
> For MRSS, I'll probably open a bugzilla and reference it in the
> changelog just so we don't forget about it.
Not done it before. Will check and do this.

Regards,

Murali

>
>>>>     PCI: designware: enhance dw_pcie_host_init() to support v3.65 DW
>>>>       hardware
>>>>     PCI: add PCI controller for keystone PCIe h/w
>>>>     PCI: keystone: Update maintainer information
>>>
>>>
>>> You can squash the MAINTAINERS update into the driver addition.  They're
>>> logically part of the same change.
>>>
>>> Bjorn
>>>
>>>>    .../devicetree/bindings/pci/pci-keystone.txt       |   68 +++
>>>>    MAINTAINERS                                        |    7 +
>>>>    drivers/pci/host/Kconfig                           |    5 +
>>>>    drivers/pci/host/Makefile                          |    1 +
>>>>    drivers/pci/host/pci-keystone-dw.c                 |  521
>>>> ++++++++++++++++++++
>>>>    drivers/pci/host/pci-keystone.c                    |  386
>>>> +++++++++++++++
>>>>    drivers/pci/host/pci-keystone.h                    |   58 +++
>>>>    drivers/pci/host/pcie-designware.c                 |  116 +++--
>>>>    drivers/pci/host/pcie-designware.h                 |    9 +
>>>>    9 files changed, 1135 insertions(+), 36 deletions(-)
>>>>    create mode 100644
>>>> Documentation/devicetree/bindings/pci/pci-keystone.txt
>>>>    create mode 100644 drivers/pci/host/pci-keystone-dw.c
>>>>    create mode 100644 drivers/pci/host/pci-keystone.c
>>>>    create mode 100644 drivers/pci/host/pci-keystone.h
>>>>
>>>> --
>>>> 1.7.9.5
>>>>
>>

^ permalink raw reply

* [PATCH v5 1/2] i2c: add DMA support for freescale i2c driver
From: Marek Vasut @ 2014-07-23 16:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140723141502.2d726afe@ipc1.ka-ro>

On Wednesday, July 23, 2014 at 02:15:02 PM, Lothar Wa?mann wrote:
> Hi,
> 
> Varka Bhadram wrote:
> > On 07/23/2014 04:41 PM, Yao Yuan wrote:
> > > Hi,
> > > 
> > > Thanks for your review.
> > > 
> > > Lothar Wa?mann wrote:
> > >> Yuan Yao wrote:
> > >>> Add dma support for i2c. This function depend on DMA driver.
> > >>> You can turn on it by write both the dmas and dma-name properties in
> > >>> dts node.
> > >>> 
> > >>> Signed-off-by: Yuan Yao <yao.yuan@freescale.com>
> > >>> ---
> > >>> 
> > >>>   drivers/i2c/busses/i2c-imx.c | 377
> > > 
> > > [...]
> > > 
> > >>> +
> > >>> +fail_rx:
> > >>> +	dma_release_channel(dma->chan_rx);
> > >>> +fail_tx:
> > >>> +	dma_release_channel(dma->chan_tx);
> > >>> +fail_al:
> > >>> +	devm_kfree(dev, dma);
> > >> 
> > >> No need for this one (that's the whole point of using devm_kzalloc())!
> > > 
> > > When DMA request failed, I2C will switch to PIO mode. So if the failed
> > > reason is just like DMA channel request failed. At this time the DMA
> > > should free by devm_kfree(). Is it?
> > 
> > If probe failed the memory will be freed automatically because
> > we are using devm_kzalloc()...
> > 
> > If we use devm_kzalloc() ,no need to free manually on fail...
> 
> Yes, but as Yuan Yao stated, the driver will still work
> without DMA but carry around the unecessary allocated imx_i2c_dma
> struct.
> The devm_kfree() is not in the failure path of the driver's probe()
> function, but in the function that tries to initialize the optional DMA
> support.

If the DMA fails, I'd just make the entire probe fail. In case you cannot probe 
DMA for your hardware, which is exected to be DMA capable, it means something is 
wrong anyway.

Best regards,
Marek Vasut

^ permalink raw reply

* [PATCHv3 0/7] cpufreq support for Marvell Armada XP
From: Viresh Kumar @ 2014-07-23 16:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140723131930.46dcbc2e@free-electrons.com>

On 23 July 2014 16:49, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> So, what do we do with this patch series, which depends on the
> cpufreq-generic driver? Has there been any solution found for 3.17 ?

I have been trying hard, nothing conclusive yet :(

^ permalink raw reply

* [PATCH v2 14/16] cpufreq: Add cpufreq driver for Tegra124
From: Viresh Kumar @ 2014-07-23 16:50 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <53CFA33F.6030307@nvidia.com>

On 23 July 2014 17:27, Tuomas Tynkkynen <ttynkkynen@nvidia.com> wrote:
> The platform device is required for the deferred probe that can happen if the
> DFLL driver hasn't initialized yet, and module_init() callbacks don't seem to
> respect -EPROBE_DEFER.

Oh, which call in this file will return EPROBE_DEFER? I couldn't make out
which one will depend on DFLL driver.

^ permalink raw reply

* [PATCH 1/2] Added dts defintion for Lenovo ix4-300d nas
From: Andrew Lunn @ 2014-07-23 16:49 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <47823826-CDE8-47D2-B1B6-B688118CF985@perenite.com>

> Well actually the PHY need to be initialized (at least 1 mII reg
> written), which from marvel LSP driver always occurs, while it
> doesn't with mainline PHY driver (drivers/net/phy/marvell.c), so the
> only simple way I found to have at least one PHY reg on both
> interface written is to have both eth up at OS config level.

Thanks for the information. This sounds like a wake on LAN feature.
I've seen other Marvell hardware connect a PHY LED output pin to the
circuit controlling the main power supply. When the PHY detects the
magic wake-up packet, it 'blinks' the LED so turning the power back
on.

My guess is, the register write to the PHY is configuring the LED. Do
you have the datasheet for the PHY? Can you check this?

> Probably the best option would be to have a reg-init = <reg offset
> value> on both phy dts definition but the current armada mii doesn't
> support this dts config...

Once we understand what is going on here, we can consider adding
support for this.

	Andrew

^ permalink raw reply

* [PATCH 2/3] ARM: smp_scu: enable SCU standby support
From: Catalin Marinas @ 2014-07-23 16:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140723045055.GA5615@dragon>

On Wed, Jul 23, 2014 at 05:50:57AM +0100, Shawn Guo wrote:
> On Tue, Jul 22, 2014 at 05:13:31PM +0100, Catalin Marinas wrote:
> > And we don't know the behaviour of setting this bit on such A9 early
> > revisions. So we can try to (1) find out if there are any in the field,
> > (2) read the RTL to see if anything happens or (3) add a check in Linux
> > for such revisions. I think (3) should be the case but you need to figure
> > out which revisions these are.
> 
> Can I ask the favor from you ARM folks on that, since I cannot figure
> it out from any public information?

Looking through some of the older A9 TRMs, it seems that this bit was
added in r2p0. Whether it works as advertised on the relevant SoCs I
can't tell.

-- 
Catalin

^ permalink raw reply

* [PATCH v7 0/5] Add Keystone PCIe controller driver
From: Bjorn Helgaas @ 2014-07-23 16:43 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <53CFD444.4010700@ti.com>

On Wed, Jul 23, 2014 at 9:27 AM, Murali Karicheri <m-karicheri2@ti.com> wrote:
>
> Bjorn,
>
>
> On 07/22/2014 06:57 PM, Bjorn Helgaas wrote:
>>
>> On Mon, Jul 21, 2014 at 12:58:40PM -0400, Murali Karicheri wrote:
>
>
>>> Murali Karicheri (5):
>>>    PCI: designware: add rd[wr]_other_conf API
>>>    PCI: designware: refactor MSI code to work with v3.65 dw hardware
>>
>>
>> I applied the above two to my pci/host-designware branch.  The rest didn't
>> apply cleanly because I applied Kishon's DRA7xx changes first, and there
>> are several conflicts.  Can you rebase the rest of them on top of
>> pci/host-designware?
>
>
> Thanks for applying 1 and 2.
>
> I will fix up 3 based on your branch and send you updated patch 3 and 4
> today.  Hope you can apply this updated patch so that I don't have to
> address any rebase issues. Regarding the MRSS comment, I will discuss it on
> that thread and send you a fix for removing the bootargs depedency based on
> what comes out of that discussion. Is that fine?

Yep, sounds reasonable.  I'm about to leave for vacation, so I won't
be able to apply these until mid-August, but I think we can still get
them into v3.17 since it's new hardware that shouldn't affect anything
else.

For MRSS, I'll probably open a bugzilla and reference it in the
changelog just so we don't forget about it.

>>>    PCI: designware: enhance dw_pcie_host_init() to support v3.65 DW
>>>      hardware
>>>    PCI: add PCI controller for keystone PCIe h/w
>>>    PCI: keystone: Update maintainer information
>>
>>
>> You can squash the MAINTAINERS update into the driver addition.  They're
>> logically part of the same change.
>>
>> Bjorn
>>
>>>   .../devicetree/bindings/pci/pci-keystone.txt       |   68 +++
>>>   MAINTAINERS                                        |    7 +
>>>   drivers/pci/host/Kconfig                           |    5 +
>>>   drivers/pci/host/Makefile                          |    1 +
>>>   drivers/pci/host/pci-keystone-dw.c                 |  521
>>> ++++++++++++++++++++
>>>   drivers/pci/host/pci-keystone.c                    |  386
>>> +++++++++++++++
>>>   drivers/pci/host/pci-keystone.h                    |   58 +++
>>>   drivers/pci/host/pcie-designware.c                 |  116 +++--
>>>   drivers/pci/host/pcie-designware.h                 |    9 +
>>>   9 files changed, 1135 insertions(+), 36 deletions(-)
>>>   create mode 100644
>>> Documentation/devicetree/bindings/pci/pci-keystone.txt
>>>   create mode 100644 drivers/pci/host/pci-keystone-dw.c
>>>   create mode 100644 drivers/pci/host/pci-keystone.c
>>>   create mode 100644 drivers/pci/host/pci-keystone.h
>>>
>>> --
>>> 1.7.9.5
>>>
>

^ permalink raw reply

* [GIT PULL] arm64 fix for 3.16
From: Catalin Marinas @ 2014-07-23 16:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Linus,

Please pull the arm64 patch below. Thanks.


The following changes since commit fa2ec3ea10bd377f9d55772b1dab65178425a1a2:

  arm64: implement TASK_SIZE_OF (2014-07-08 17:30:59 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux tags/arm64-fixes

for you to fetch changes up to d50314a6b0702c630c35b88148c1acb76d2e4ede:

  arm64: Create non-empty ZONE_DMA when DRAM starts above 4GB (2014-07-23 11:23:58 +0100)

----------------------------------------------------------------
Fix arm64 regression introduced by limiting the CMA buffer to ZONE_DMA
on platforms where RAM starts above 4GB (and ZONE_DMA becoming 0).

----------------------------------------------------------------
Catalin Marinas (1):
      arm64: Create non-empty ZONE_DMA when DRAM starts above 4GB

 arch/arm64/mm/init.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

^ permalink raw reply

* [PATCH v6 5/7] drivers: cpuidle: CPU idle ARM64 driver
From: Ashwin Chaugule @ 2014-07-23 16:34 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1405958786-17243-6-git-send-email-lorenzo.pieralisi@arm.com>

On 21 July 2014 12:06, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> This patch implements a generic CPU idle driver for ARM64 machines.
>
> It relies on the DT idle states infrastructure to initialize idle
> states count and respective parameters. Current code assumes the driver
> is managing idle states on all possible CPUs but can be easily
> generalized to support heterogenous systems and build cpumasks at
> runtime using MIDRs or DT cpu nodes compatible properties.
>
> The driver relies on the arm64 CPU operations to call the idle
> initialization hook used to parse and save suspend back-end specific
> idle states information upon probing.
>
> Idle state index 0 is always initialized as a simple wfi state, ie always
> considered present and functional on all ARM64 platforms.
>
> Idle state indices higher than 0 trigger idle state entry by calling
> the cpu_suspend function, that does save the CPU context and executes
> the CPU operations suspend back-end hook. cpu_suspend passes the idle
> state index as a parameter so that the CPU operations suspend back-end
> can retrieve the required idle state data by using the idle state
> index to execute a look-up on its internal data structures.
>
> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> ---
>  drivers/cpuidle/Kconfig         |   5 ++
>  drivers/cpuidle/Kconfig.arm64   |  14 +++++
>  drivers/cpuidle/Makefile        |   4 ++
>  drivers/cpuidle/cpuidle-arm64.c | 128 ++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 151 insertions(+)
>  create mode 100644 drivers/cpuidle/Kconfig.arm64
>  create mode 100644 drivers/cpuidle/cpuidle-arm64.c
>
> diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
> index 414e7a96..ebf0c2e 100644
> --- a/drivers/cpuidle/Kconfig
> +++ b/drivers/cpuidle/Kconfig
> @@ -43,6 +43,11 @@ depends on ARM
>  source "drivers/cpuidle/Kconfig.arm"
>  endmenu
>
> +menu "ARM64 CPU Idle Drivers"
> +depends on ARM64
> +source "drivers/cpuidle/Kconfig.arm64"
> +endmenu
> +
>  menu "MIPS CPU Idle Drivers"
>  depends on MIPS
>  source "drivers/cpuidle/Kconfig.mips"
> diff --git a/drivers/cpuidle/Kconfig.arm64 b/drivers/cpuidle/Kconfig.arm64
> new file mode 100644
> index 0000000..d0a08ed
> --- /dev/null
> +++ b/drivers/cpuidle/Kconfig.arm64
> @@ -0,0 +1,14 @@
> +#
> +# ARM64 CPU Idle drivers
> +#
> +
> +config ARM64_CPUIDLE
> +       bool "Generic ARM64 CPU idle Driver"
> +       select ARM64_CPU_SUSPEND
> +       select DT_IDLE_STATES
> +       help
> +         Select this to enable generic cpuidle driver for ARM64.
> +         It provides a generic idle driver whose idle states are configured
> +         at run-time through DT nodes. The CPUidle suspend backend is
> +         initialized by calling the CPU operations init idle hook
> +         provided by architecture code.
> diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> index b27a062..706cb7f 100644
> --- a/drivers/cpuidle/Makefile
> +++ b/drivers/cpuidle/Makefile
> @@ -23,6 +23,10 @@ obj-$(CONFIG_ARM_EXYNOS_CPUIDLE)        += cpuidle-exynos.o
>  obj-$(CONFIG_MIPS_CPS_CPUIDLE)         += cpuidle-cps.o
>
>  ###############################################################################
> +# ARM64 drivers
> +obj-$(CONFIG_ARM64_CPUIDLE)            += cpuidle-arm64.o
> +
> +###############################################################################
>  # POWERPC drivers
>  obj-$(CONFIG_PSERIES_CPUIDLE)          += cpuidle-pseries.o
>  obj-$(CONFIG_POWERNV_CPUIDLE)          += cpuidle-powernv.o
> diff --git a/drivers/cpuidle/cpuidle-arm64.c b/drivers/cpuidle/cpuidle-arm64.c
> new file mode 100644
> index 0000000..1aeb426
> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-arm64.c
> @@ -0,0 +1,128 @@
> +/*
> + * ARM64 generic CPU idle driver.
> + *
> + * Copyright (C) 2014 ARM Ltd.
> + * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.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.
> + */
> +
> +#define pr_fmt(fmt) "CPUidle arm64: " fmt
> +
> +#include <linux/cpuidle.h>
> +#include <linux/cpumask.h>
> +#include <linux/cpu_pm.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/slab.h>
> +
> +#include <asm/cpuidle.h>
> +#include <asm/suspend.h>
> +
> +#include "dt_idle_states.h"
> +
> +/*
> + * arm_enter_idle_state - Programs CPU to enter the specified state
> + *
> + * dev: cpuidle device
> + * drv: cpuidle driver
> + * idx: state index
> + *
> + * Called from the CPUidle framework to program the device to the
> + * specified target state selected by the governor.
> + */
> +static int arm_enter_idle_state(struct cpuidle_device *dev,
> +                               struct cpuidle_driver *drv, int idx)
> +{
> +       int ret;
> +
> +       if (!idx) {
> +               cpu_do_idle();
> +               return idx;
> +       }
> +
> +       ret = cpu_pm_enter();
> +       if (!ret) {
> +               /*
> +                * Pass idle state index to cpu_suspend which in turn will
> +                * call the CPU ops suspend protocol with idle index as a
> +                * parameter.
> +                */
> +               ret = cpu_suspend(idx);
> +
> +               cpu_pm_exit();
> +       }
> +
> +       return ret ? -1 : idx;
> +}
> +
> +struct cpuidle_driver arm64_idle_driver = {
> +       .name = "arm64_idle",
> +       .owner = THIS_MODULE,
> +       /*
> +        * State at index 0 is standby wfi and considered standard
> +        * on all ARM platforms. If in some platforms simple wfi
> +        * can't be used as "state 0", DT bindings must be implemented
> +        * to work around this issue and allow installing a special
> +        * handler for idle state index 0.
> +        */
> +       .states[0] = {
> +               .enter                  = arm_enter_idle_state,
> +               .exit_latency           = 1,
> +               .target_residency       = 1,
> +               .power_usage            = UINT_MAX,
> +               .flags                  = CPUIDLE_FLAG_TIME_VALID,
> +               .name                   = "WFI",
> +               .desc                   = "ARM64 WFI",
> +       }
> +};
> +
> +/*
> + * arm64_idle_init
> + *
> + * Registers the arm64 specific cpuidle driver with the cpuidle
> + * framework. It relies on core code to parse the idle states
> + * and initialize them using driver data structures accordingly.
> + */
> +static int __init arm64_idle_init(void)
> +{
> +       int i, ret;
> +       struct cpuidle_driver *drv = &arm64_idle_driver;
> +
> +       drv->cpumask = kzalloc(cpumask_size(), GFP_KERNEL);
> +       if (!drv->cpumask)
> +               return -ENOMEM;
> +
> +       cpumask_copy(drv->cpumask, cpu_possible_mask);
> +       /*
> +        * Start at index 1, request idle state nodes to be filled
> +        */
> +       ret = dt_init_idle_driver(drv, 1);
> +       if (ret)
> +               goto free_mem;
> +       /*
> +        * Call arch CPU operations in order to initialize
> +        * idle states suspend back-end specific data
> +        */
> +       for_each_cpu(i, drv->cpumask) {
> +               ret = cpu_init_idle(i);
> +               if (ret)
> +                       goto free_mem;
> +       }
> +
> +       for (i = 1; i < drv->state_count; i++)
> +               drv->states[i].enter = arm_enter_idle_state;
> +
> +       ret = cpuidle_register(drv, NULL);
> +       if (ret)
> +               goto free_mem;
> +
> +       return 0;
> +free_mem:
> +       kfree(drv->cpumask);
> +       return ret;
> +}
> +device_initcall(arm64_idle_init);
> --
> 1.9.1
>
>
>

Reviewed-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>

> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v6 2/7] drivers: cpuidle: implement DT based idle states infrastructure
From: Ashwin Chaugule @ 2014-07-23 16:34 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1405958786-17243-3-git-send-email-lorenzo.pieralisi@arm.com>

Hi Lorenzo,

On 21 July 2014 12:06, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> +/**
> + * dt_init_idle_driver() - Parse the DT idle states and initialize the
> + *                        idle driver states array
> + *
> + * @drv:         Pointer to CPU idle driver to be initialized
> + * @start_idx:    First idle state index to be initialized
> + *
> + * On success the states array in the cpuidle driver contains
> + * initialized entries in the states array, starting from index start_idx.
> + *
> + * Return:
> + *     0 on success
> + *     <0 on failure
> + */
> +int dt_init_idle_driver(struct cpuidle_driver *drv, unsigned int start_idx)
> +{
> +       unsigned int i, state_idx = start_idx;
> +       struct cpuidle_state *idle_state;
> +       struct device_node *state_node, *cpu_node;
> +
> +
> +       if (state_idx >= CPUIDLE_STATE_MAX)
> +               return -EINVAL;
> +       /*
> +        * We get the idle states for the first logical cpu in the
> +        * driver mask. The kernel does not check idle states on all
> +        * cpus in the driver mask, they are assumed to be the same
> +        * by default.
> +        */
> +       cpu_node = of_cpu_device_node_get(cpumask_first(drv->cpumask));

Is this an assumption for the short term? My understanding from the
corresponding ACPI discussions is that the order of idle states may
not necessarily be same for all CPUs, even for big.Little?

Cheers,
Ashwin

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox