LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/5] of: Add support for linking device tree blobs into vmlinux
From: David Daney @ 2010-11-17 17:54 UTC (permalink / raw)
  To: Dirk Brandewie
  Cc: linuxppc-dev, devicetree-discuss, linux-kernel, sodaville,
	microblaze-uclinux, arjan
In-Reply-To: <4CE372A9.2050704@gmail.com>

On 11/16/2010 10:14 PM, Dirk Brandewie wrote:
> On 11/16/2010 06:58 PM, Grant Likely wrote:
>> On Tue, Nov 16, 2010 at 7:21 PM, Dirk Brandewie
>> <dirk.brandewie@gmail.com> wrote:
>>>
>>> On 11/16/2010 04:39 PM, David Daney wrote:
>>>>
>>>> Thanks for doing this. However I have a few comments...
>>>>
>>>> On 11/16/2010 02:41 PM, dirk.brandewie@gmail.com wrote:
>>>>>
>>>>> From: Dirk Brandewie<dirk.brandewie@gmail.com>
>>>>>
>>>>> /* .data section */
>>>>> #define DATA_DATA \
>>>>> *(.data) \
>>>>> @@ -468,7 +482,8 @@
>>>>> MCOUNT_REC() \
>>>>> DEV_DISCARD(init.rodata) \
>>>>> CPU_DISCARD(init.rodata) \
>>>>> - MEM_DISCARD(init.rodata)
>>>>> + MEM_DISCARD(init.rodata) \
>>>>> + KERNEL_DTB()
>>>>>
>>>>
>>>> I thought the init.rodata was only for data used by __init things.
>>>> Although the
>>>> current linker scripts do not put it in the section that gets
>>>> recycled as
>>>> usable
>>>> memory.
>>>>
>>>> IIRC the unflattened version of the device tree has pointers to the
>>>> flattened
>>>> data. Since the device tree nodes are live for the entire kernel
>>>> lifecycle,
>>>> shouldn't the device tree blobs be in non-init memory?
>>>>
>>>
>>> The contents of the blob get copied to allocated memory during
>>> unflatten_device_tree() so the blob that is linked in is no longer
>>> needed
>>> after init.
>>
>> Have you written a patch to add this behaviour? The current code
>> doesn't. :-)
>>
>
> I misspoke, my blob gets copied to allocated memory during
> unflatten_device_tree.
> my early_init_dt_alloc_memory_arch() returns the physical address of a
> kmalloc'd
> buffer.
>

Perhaps you should take a look at unflatten_dt_node(), especially the 
part where property names and values are assigned.  I could be mistaken, 
but it appears to me that the memory allocated by 
early_init_dt_alloc_memory_arch() is not used to hold the name and value 
strings.  It is possible that they might be referred to in their 
original location in the flattened blob.


> You would want copy the dtb that your platform is going to use to
> non-init memory.
>

... or you might want to locate the dtb somewhere where it would be 
unlikely to get clobbered if someone were to arrange for the init.rodata 
to be freed for reuse.

David Daney

^ permalink raw reply

* Re: [PATCH] kgdb, ppc: Corrected the address using of current->thread.evr register
From: Kumar Gala @ 2010-11-17 17:52 UTC (permalink / raw)
  To: Jason Wessel
  Cc: Deng, Dongdong, Sergei Shtylyov, kgdb-bugreport, miltonm,
	Hai, Shan, linuxppc-dev
In-Reply-To: <4CE40F00.7010407@windriver.com>


On Nov 17, 2010, at 11:21 AM, Jason Wessel wrote:

> On 11/17/2010 11:16 AM, Kumar Gala wrote:
>=20
>>> Thanks,
>>> Jason.
>>=20
>> Repost a version with the casts and I'll pick it up.
>>=20
>> - k
>=20
> I have the final version ready for a pull request that I was going to
> make in the next hour or two that is fully regression tested.
>=20
> If you would prefer to these changes in the PPC, let me know, or if
> you want to ack the patch, I'll add that before submitting the pull
> request.
>=20
> Thanks,
> Jason.
>=20
> --

If they'll get pulled in via another path that is fine.  I'm happy to =
ack a proper patch.

- k=

^ permalink raw reply

* Re: [PATCH] kgdb, ppc: Corrected the address using of current->thread.evr register
From: Jason Wessel @ 2010-11-17 17:21 UTC (permalink / raw)
  To: Kumar Gala
  Cc: Deng, Dongdong, Sergei Shtylyov, kgdb-bugreport, miltonm,
	Hai, Shan, linuxppc-dev
In-Reply-To: <983540C0-C0E6-44DB-9264-4A5B1E058043@kernel.crashing.org>

On 11/17/2010 11:16 AM, Kumar Gala wrote:

>> Thanks,
>> Jason.
> 
> Repost a version with the casts and I'll pick it up.
> 
> - k

I have the final version ready for a pull request that I was going to
make in the next hour or two that is fully regression tested.

If you would prefer to these changes in the PPC, let me know, or if
you want to ack the patch, I'll add that before submitting the pull
request.

Thanks,
Jason.

--
>From b47efa1d4fa4631ee0cc59f4fcd143464b910cdc Mon Sep 17 00:00:00 2001
From: Dongdong Deng <dongdong.deng@windriver.com>
Date: Tue, 16 Nov 2010 16:02:00 -0600
Subject: [PATCH 4/4] kgdb: Fix regression in evr register handling

Commit ff10b88b5a05c8f1646dd15fb9f6093c1384ff6d (kgdb,ppc: Individual
register get/set for ppc) introduced a problem where memcpy was used
incorrectly to read and write the evr registers with a kernel that
has:

CONFIG_FSL_BOOKE=y
CONFIG_SPE=y
CONFIG_KGDB=y

This patch also fixes the following compilation problems:

arch/powerpc/kernel/kgdb.c: In function 'dbg_get_reg':
arch/powerpc/kernel/kgdb.c:341: error: passing argument 2 of 'memcpy' makes pointer from integer without a cast
arch/powerpc/kernel/kgdb.c: In function 'dbg_set_reg':
arch/powerpc/kernel/kgdb.c:366: error: passing argument 1 of 'memcpy' makes pointer from integer without a cast

[jason.wessel@windriver.com: Remove void * casts and fix patch header]
Reported-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
CC: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/kernel/kgdb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 7a9db64..42850ee 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
 		if (current)
-			memcpy(mem, current->thread.evr[regno-32],
+			memcpy(mem, &current->thread.evr[regno-32],
 					dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
@@ -362,7 +362,7 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
 	if (regno >= 32 && regno < 64) {
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
-		memcpy(current->thread.evr[regno-32], mem,
+		memcpy(&current->thread.evr[regno-32], mem,
 				dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
-- 
1.7.0.4

^ permalink raw reply related

* [PATCH] powerpc/mm: Fix module instruction tlb fault handling on Book-E 64
From: Kumar Gala @ 2010-11-17 17:20 UTC (permalink / raw)
  To: linuxppc-dev

We were seeing oops like the following when we did an rmmod on a module:

Unable to handle kernel paging request for instruction fetch
Faulting instruction address: 0x8000000000008010
Oops: Kernel access of bad area, sig: 11 [#1]
SMP NR_CPUS=2 P5020 DS
last sysfs file: /sys/devices/qman-portals.2/qman-pool.9/uevent
Modules linked in: qman_tester(-)
NIP: 8000000000008010 LR: c000000000074858 CTR: 8000000000008010
REGS: c00000002e29bab0 TRAP: 0400   Not tainted
(2.6.34.6-00744-g2d21f14)
MSR: 0000000080029000 <EE,ME,CE>  CR: 24000448  XER: 00000000
TASK = c00000007a8be600[4987] 'rmmod' THREAD: c00000002e298000 CPU: 1
GPR00: 8000000000008010 c00000002e29bd30 8000000000012798 c00000000035fb28
GPR04: 0000000000000002 0000000000000002 0000000024022428 c000000000009108
GPR08: fffffffffffffffe 800000000000a618 c0000000003c13c8 0000000000000000
GPR12: 0000000022000444 c00000000fffed00 0000000000000000 0000000000000000
GPR16: 00000000100c0000 0000000000000000 00000000100dabc8 0000000010099688
GPR20: 0000000000000000 00000000100cfc28 0000000000000000 0000000010011a44
GPR24: 00000000100017b2 0000000000000000 0000000000000000 0000000000000880
GPR28: c00000000035fb28 800000000000a7b8 c000000000376d80 c0000000003cce50
NIP [8000000000008010] .test_exit+0x0/0x10 [qman_tester]
LR [c000000000074858] .SyS_delete_module+0x1f8/0x2f0
Call Trace:
[c00000002e29bd30] [c0000000000748b4] .SyS_delete_module+0x254/0x2f0 (unreliable)
[c00000002e29be30] [c000000000000580] syscall_exit+0x0/0x2c
Instruction dump:
XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
38600000 4e800020 60000000 60000000 <4e800020> 60000000 60000000 60000000
---[ end trace 4f57124939a84dc8 ]---

This appears to be due to checking the wrong permission bits in the
instruction_tlb_miss handling if the address that faulted was in vmalloc
space.  We need to look at the supervisor execute (_PAGE_BAP_SX) bit and
not the user bit (_PAGE_BAP_UX/_PAGE_EXEC).

Also removed a branch level since it did not appear to be used.

Reported-by: Jeffrey Ladouceur <Jeffrey.Ladouceur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/mm/tlb_low_64e.S |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index 8b04c54..8526bd9 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -138,8 +138,11 @@
 	cmpldi	cr0,r15,0			/* Check for user region */
 	std	r14,EX_TLB_ESR(r12)		/* write crazy -1 to frame */
 	beq	normal_tlb_miss
+
+	li	r11,_PAGE_PRESENT|_PAGE_BAP_SX	/* Base perm */
+	oris	r11,r11,_PAGE_ACCESSED@h
 	/* XXX replace the RMW cycles with immediate loads + writes */
-1:	mfspr	r10,SPRN_MAS1
+	mfspr	r10,SPRN_MAS1
 	cmpldi	cr0,r15,8			/* Check for vmalloc region */
 	rlwinm	r10,r10,0,16,1			/* Clear TID */
 	mtspr	SPRN_MAS1,r10
-- 
1.7.2.3

^ permalink raw reply related

* Re: [PATCH] kgdb, ppc: Corrected the address using of current->thread.evr register
From: Kumar Gala @ 2010-11-17 17:16 UTC (permalink / raw)
  To: Jason Wessel
  Cc: Dongdong Deng, Sergei Shtylyov, kgdb-bugreport, miltonm,
	Hai, Shan, linuxppc-dev
In-Reply-To: <4CE2FF5A.402@windriver.com>


On Nov 16, 2010, at 4:02 PM, Jason Wessel wrote:

> On 11/16/2010 06:58 AM, Dongdong Deng wrote:
>> Passing the address of current->thread.evr register to memcpy =
function.
>>=20
>>=20
>=20
> It turns out that out of all of my test configs and targets I did not
> have any that defined both CONFIG_FSL_BOOKE and CONFIG_SPE else this
> would have been caught in testing because will definitely crash
> dereferencing the contents of the evr registers.
>=20
>> Signed-off-by: Dongdong Deng <dongdong.deng@windriver.com>
>> CC: Hai Shan <shan.hai@windriver.com>
>> CC: Milton Miller <miltonm@bga.com>
>> CC: linuxppc-dev@lists.ozlabs.org
>> ---
>> arch/powerpc/kernel/kgdb.c |    4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>=20
>> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
>> index 7a9db64..781acff 100644
>> --- a/arch/powerpc/kernel/kgdb.c
>> +++ b/arch/powerpc/kernel/kgdb.c
>> @@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct =
pt_regs *regs)
>> 		/* FP registers 32 -> 63 */
>> #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
>> 		if (current)
>> -			memcpy(mem, current->thread.evr[regno-32],
>> +			memcpy(mem, (void =
*)&current->thread.evr[regno-32],
>> 					dbg_reg_def[regno].size);
>>=20
>=20
> As Sergei already pointed out, the (void *) casts should not be needed =
here.
>=20
> This would have been fixed correctly had I seen the compile warnings
> from the CONFIG_SPE at the test phase.   Namely at the compile phase
> doesn't even complete:
>=20
> arch/powerpc/kernel/kgdb.c: In function 'dbg_get_reg':
> arch/powerpc/kernel/kgdb.c:341: error: passing argument 2 of 'memcpy'
> makes pointer from integer without a cast
> arch/powerpc/include/asm/string.h:25: note: expected 'const void *' =
but
> argument is of type 'long unsigned int'
> arch/powerpc/kernel/kgdb.c: In function 'dbg_set_reg':
> arch/powerpc/kernel/kgdb.c:366: error: passing argument 1 of 'memcpy'
> makes pointer from integer without a cast
> arch/powerpc/include/asm/string.h:25: note: expected 'void *' but
> argument is of type 'long unsigned int'
>=20
>=20
> Moral of the story... I now have a board and config with the SPE =
turned
> on, and after boot testing confirmed the evr registers are working.
>=20
> I plan to have a pull request out to Linus with this fix and several
> other accumulated regression fixes sometime in the next 48 hours.
>=20
> Thanks,
> Jason.

Repost a version with the casts and I'll pick it up.

- k=

^ permalink raw reply

* Re: [PATCH] powerpc: Per process DSCR
From: Kumar Gala @ 2010-11-17 17:15 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: paulus, linuxppc-dev
In-Reply-To: <20101117113130.3702897c@kryten>


On Nov 16, 2010, at 6:31 PM, Anton Blanchard wrote:

> In order to add per process control of the DSCR, the following patch =
emulates
> read/write of the DSCR from userspace and saves and restores it on =
context
> switch. We add emulated stats to track how many times we do this.
>=20
> While writing this patch a few things were apparent:
>=20
> - How will this work with the global DSCR setting in
>  /sys/devices/system/cpu/cpu*/dscr? Do we deprecate it? One thought is
>  to add a new sysfs entry (eg dscr_enabled), which tells us to
>  override any per process settings. Another way would be to overload
>  the dscr sysfs entry and make -1 mean the system wide dscr setting is
>  disabled.
>=20
> - Do we need an out of band method of changing the DSCR so another
>  process or could modify it? We may want to modify the DSCR of a long
>  running process, eg a HPC job.
>=20
> - To improve context switch speed we should probably check the old and
>  new DSCR values are identical and avoid the SPR write.
>=20
> Signed-off-by: Anton Blanchard <anton@samba.org>

We don't have no stinking DSCR ;).  Would like this to be #ifdef =
CONFIG_PPC_BOOK3S_64.

- k=

^ permalink raw reply

* Re: [PATCH 1/5] scripts: dtc: Merge in changes from the dtc repository
From: Jon Loeliger @ 2010-11-17 15:51 UTC (permalink / raw)
  To: Kyle Moffett
  Cc: glikely, devicetree-discuss, linux-kernel, John Bonesio,
	linuxppc-dev, david
In-Reply-To: <AANLkTimTks01SnjWJZFycSCQC+ZBEonPLLUwMRQkxLz2@mail.gmail.com>

> 
> Hmm, is there some documentation for how to use this feature?
> Specifically I have a custom board with multiple discrete computers on
> it which are only very slightly physically different from each other
> and I'd like to be able to avoid maintaining 2 nearly-exact copies of
> the same DTS file.

Heh.

jdl

^ permalink raw reply

* Re: [PATCH 1/5] scripts: dtc: Merge in changes from the dtc repository
From: Jon Loeliger @ 2010-11-17 15:47 UTC (permalink / raw)
  To: Grant Likely
  Cc: glikely, devicetree-discuss, linux-kernel, John Bonesio,
	linuxppc-dev, david
In-Reply-To: <20101117045935.GA12084@angua.secretlab.ca>

> On Tue, Nov 16, 2010 at 12:49:51PM -0800, John Bonesio wrote:
> > Pull in recent changes from the main dtc repository. These changes primarily
> > allow multiple device trees to be declared which are merged by dtc. This
> > feature allows us to include a basic dts file and then provide more informatio
> n
> > for the specific system through the merging functionality.
> > 
> > Signed-off-by: John Bonesio <bones@secretlab.ca>
> 
> Jon & David, I'll need your input on whether or not this is the best
> way to handle updating the dtc copy in the kernel tree.
> 
> g.

Grant,

Yeah, I wondered too. :-)  David added it and updated
in the kernel last round, so he may have some good notion
of what would be best there.

jdl

^ permalink raw reply

* [PATCH 2/3] misc: at24: add more sanity checks for parameters
From: Wolfram Sang @ 2010-11-17 12:00 UTC (permalink / raw)
  To: devicetree-discuss; +Cc: linuxppc-dev
In-Reply-To: <1289995250-17927-1-git-send-email-w.sang@pengutronix.de>

Side-effects happen when passing 0 to either io_limit or page_size. Give
an error in case of this misconfiguration.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
 drivers/misc/eeprom/at24.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 3a53efc..ab1ad41 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -517,6 +517,11 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	if (!is_power_of_2(chip.byte_len))
 		dev_warn(&client->dev,
 			"byte_len looks suspicious (no power of 2)!\n");
+	if (!chip.page_size) {
+		dev_err(&client->dev, "page_size must not be 0!\n");
+		err = -EINVAL;
+		goto err_out;
+	}
 	if (!is_power_of_2(chip.page_size))
 		dev_warn(&client->dev,
 			"page_size looks suspicious (no power of 2)!\n");
@@ -681,6 +686,11 @@ static struct i2c_driver at24_driver = {
 
 static int __init at24_init(void)
 {
+	if (!io_limit) {
+		pr_err("at24: io_limit must not be 0!\n");
+		return -EINVAL;
+	}
+
 	io_limit = rounddown_pow_of_two(io_limit);
 	return i2c_add_driver(&at24_driver);
 }
-- 
1.7.2.3

^ permalink raw reply related

* [PATCH 3/3] powerpc: pcm030/032: add pagesize to dts
From: Wolfram Sang @ 2010-11-17 12:00 UTC (permalink / raw)
  To: devicetree-discuss; +Cc: linuxppc-dev
In-Reply-To: <1289995250-17927-1-git-send-email-w.sang@pengutronix.de>

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---
 arch/powerpc/boot/dts/pcm030.dts |    1 +
 arch/powerpc/boot/dts/pcm032.dts |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
index 8a4ec30..e7c36bc 100644
--- a/arch/powerpc/boot/dts/pcm030.dts
+++ b/arch/powerpc/boot/dts/pcm030.dts
@@ -259,6 +259,7 @@
 			eeprom@52 {
 				compatible = "catalyst,24c32";
 				reg = <0x52>;
+				pagesize = <32>;
 			};
 		};
 
diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
index 85d857a..e175e2c 100644
--- a/arch/powerpc/boot/dts/pcm032.dts
+++ b/arch/powerpc/boot/dts/pcm032.dts
@@ -257,8 +257,9 @@
 				reg = <0x51>;
 			};
 			eeprom@52 {
-				compatible = "at24,24c32";
+				compatible = "catalyst,24c32";
 				reg = <0x52>;
+				pagesize = <32>;
 			};
 		};
 
-- 
1.7.2.3

^ permalink raw reply related

* [PATCH 1/3] misc: at24: parse OF-data, too
From: Wolfram Sang @ 2010-11-17 12:00 UTC (permalink / raw)
  To: devicetree-discuss; +Cc: linuxppc-dev
In-Reply-To: <1289995250-17927-1-git-send-email-w.sang@pengutronix.de>

Information about the pagesize and read-only-status may also come from
the devicetree. Parse this data, too, and act accordingly. While we are
here, change the initialization printout a bit. write_max is useful to
know to detect performance bottlenecks, the rest is superfluous.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---

Changes since last version:

- use __be32 instead of u32

 Documentation/powerpc/dts-bindings/eeprom.txt |   28 +++++++++++++++++++++
 drivers/misc/eeprom/at24.c                    |   33 ++++++++++++++++++++----
 2 files changed, 55 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/powerpc/dts-bindings/eeprom.txt

diff --git a/Documentation/powerpc/dts-bindings/eeprom.txt b/Documentation/powerpc/dts-bindings/eeprom.txt
new file mode 100644
index 0000000..4342c10
--- /dev/null
+++ b/Documentation/powerpc/dts-bindings/eeprom.txt
@@ -0,0 +1,28 @@
+EEPROMs (I2C)
+
+Required properties:
+
+  - compatible : should be "<manufacturer>,<type>"
+		 If there is no specific driver for <manufacturer>, a generic
+		 driver based on <type> is selected. Possible types are:
+		 24c00, 24c01, 24c02, 24c04, 24c08, 24c16, 24c32, 24c64,
+		 24c128, 24c256, 24c512, 24c1024, spd
+
+  - reg : the I2C address of the EEPROM
+
+Optional properties:
+
+  - pagesize : the length of the pagesize for writing. Please consult the
+               manual of your device, that value varies a lot. A wrong value
+	       may result in data loss! If not specified, a safety value of
+	       '1' is used which will be very slow.
+
+  - read-only: this parameterless property disables writes to the eeprom
+
+Example:
+
+eeprom@52 {
+	compatible = "atmel,24c32";
+	reg = <0x52>;
+	pagesize = <32>;
+};
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 559b0b3..3a53efc 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -20,6 +20,7 @@
 #include <linux/log2.h>
 #include <linux/bitops.h>
 #include <linux/jiffies.h>
+#include <linux/of.h>
 #include <linux/i2c.h>
 #include <linux/i2c/at24.h>
 
@@ -457,6 +458,27 @@ static ssize_t at24_macc_write(struct memory_accessor *macc, const char *buf,
 
 /*-------------------------------------------------------------------------*/
 
+#ifdef CONFIG_OF
+static void at24_get_ofdata(struct i2c_client *client,
+		struct at24_platform_data *chip)
+{
+	const __be32 *val;
+	struct device_node *node = client->dev.of_node;
+
+	if (node) {
+		if (of_get_property(node, "read-only", NULL))
+			chip->flags |= AT24_FLAG_READONLY;
+		val = of_get_property(node, "pagesize", NULL);
+		if (val)
+			chip->page_size = be32_to_cpup(val);
+	}
+}
+#else
+static void at24_get_ofdata(struct i2c_client *client,
+		struct at24_platform_data *chip)
+{ }
+#endif /* CONFIG_OF */
+
 static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
 	struct at24_platform_data chip;
@@ -485,6 +507,9 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		 */
 		chip.page_size = 1;
 
+		/* update chipdata if OF is present */
+		at24_get_ofdata(client, &chip);
+
 		chip.setup = NULL;
 		chip.context = NULL;
 	}
@@ -597,19 +622,15 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 
 	i2c_set_clientdata(client, at24);
 
-	dev_info(&client->dev, "%zu byte %s EEPROM %s\n",
+	dev_info(&client->dev, "%zu byte %s EEPROM, %s, %u bytes/write\n",
 		at24->bin.size, client->name,
-		writable ? "(writable)" : "(read-only)");
+		writable ? "writable" : "read-only", at24->write_max);
 	if (use_smbus == I2C_SMBUS_WORD_DATA ||
 	    use_smbus == I2C_SMBUS_BYTE_DATA) {
 		dev_notice(&client->dev, "Falling back to %s reads, "
 			   "performance will suffer\n", use_smbus ==
 			   I2C_SMBUS_WORD_DATA ? "word" : "byte");
 	}
-	dev_dbg(&client->dev,
-		"page_size %d, num_addresses %d, write_max %d, use_smbus %d\n",
-		chip.page_size, num_addresses,
-		at24->write_max, use_smbus);
 
 	/* export data to kernel code */
 	if (chip.setup)
-- 
1.7.2.3

^ permalink raw reply related

* [PATCH V2 0/3] at24: parse OF-data
From: Wolfram Sang @ 2010-11-17 12:00 UTC (permalink / raw)
  To: devicetree-discuss; +Cc: linuxppc-dev

Here is the second round of this series:

* 1/3 now uses __be32 instead of u32.
* 2/3 is new and adds some more sanity checks
* 3/3 is unchanged

Grant, I hope you can pick 2/3 as well. Should make things easier and it is
just a misc-driver (which I maintain) :)

Wolfram Sang (3):
  misc: at24: parse OF-data, too
  misc: at24: add more sanity checks for parameters
  powerpc: pcm030/032: add pagesize to dts

 Documentation/powerpc/dts-bindings/eeprom.txt |   28 ++++++++++++++++
 arch/powerpc/boot/dts/pcm030.dts              |    1 +
 arch/powerpc/boot/dts/pcm032.dts              |    3 +-
 drivers/misc/eeprom/at24.c                    |   43 +++++++++++++++++++++---
 4 files changed, 68 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/powerpc/dts-bindings/eeprom.txt

-- 
1.7.2.3

^ permalink raw reply

* Re: [PATCH 1/5] of: Add support for linking device tree blobs into vmlinux
From: Sam Ravnborg @ 2010-11-17  9:27 UTC (permalink / raw)
  To: dirk.brandewie, Michal Marek
  Cc: linux-arch, linux-kbuild, linuxppc-dev, devicetree-discuss,
	linux-kernel, sodaville, microblaze-uclinux, arjan
In-Reply-To: <9129f0a21ea48fb2dcb89cea290e88f3e8c0d8a2.1289943240.git.dirk.brandewie@gmail.com>

On Tue, Nov 16, 2010 at 02:41:36PM -0800, dirk.brandewie@gmail.com wrote:
> From: Dirk Brandewie <dirk.brandewie@gmail.com>
> 
> This patch adds support for linking device tree blobs into
> vmlinux. Modifies asm-generic/vmlinux.lds.h to add linking
> .dtb.init.rodata sections into the .init.data section of the vmlinux
> image. Modifies scripts/Makefile.lib to add a kbuild command to
> compile DTS files to device tree blobs and a rule to create objects to
> wrap the blobs for linking.
> 
> The DTB's are placed on 32 byte boundries to allow parsing the blob
> with driver/of/fdt.c during early boot without having to copy the blob
> to get the structure alignment GCC expects.
> 
> A DTB is linked in by adding the DTB object to the list of objects to
> be linked into vmlinux in the archtecture specific Makefile using
>    obj-y += foo.dtb.o
> 
> Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
> ---
>  include/asm-generic/vmlinux.lds.h |   19 +++++++++++++++++--
>  scripts/Makefile.lib              |   20 ++++++++++++++++++++
>  2 files changed, 37 insertions(+), 2 deletions(-)

When you touch Makefiles in scripts/* it is always a good idea to cc:
kbuild maintainer on the patch - I have added Michal.

Support functionality in Makefile.lib is documented in
Documentation/kbuild/* - please add documentation there.

> 
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index bd69d79..ea671e7 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -67,7 +67,14 @@
>   * Align to a 32 byte boundary equal to the
>   * alignment gcc 4.5 uses for a struct
>   */
> -#define STRUCT_ALIGN() . = ALIGN(32)
> +#define STRUCT_ALIGNMENT 32
> +#define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
> +
> +/* Device tree blobs linked into the kernel need to have proper
> + * structure alignment to be parsed by the flat device tree library
> + * used in early boot
> +*/
> +#define DTB_ALIGNMENT STRUCT_ALIGNMENT

It has been discussed in another thread some time ago to move
to a general 32 byte alignment for everything in vmlinux.lds.h
So there is not much need for the specific DTB alignment.

> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 4c72c11..29db062 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -200,6 +200,26 @@ quiet_cmd_gzip = GZIP    $@
>  cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
>  	(rm -f $@ ; false)
>  
> +# DTC
> +#  ---------------------------------------------------------------------------
> +$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
> +	@echo '#include <asm-generic/vmlinux.lds.h>' > $@
> +	@echo '.section .dtb.init.rodata,"a"' >> $@
> +	@echo '.balign DTB_ALIGNMENT' >> $@
> +	@echo '.global __dtb_$(*F)_begin' >> $@
> +	@echo '__dtb_$(*F)_begin:' >> $@
> +	@echo '.incbin "$<" ' >> $@
> +	@echo '__dtb_$(*F)_end:' >> $@
> +	@echo '.global __dtb_$(*F)_end' >> $@
> +	@echo '.balign DTB_ALIGNMENT' >> $@


This will be noisy during build. Please use proper macors to supress output.


> +
> +DTC = $(objtree)/scripts/dtc/dtc
> +
> +quiet_cmd_dtc = DTC	$@
Please avoid tabs in the output - all other uses spaces. (There is a tab between DTC and $@)

> +      cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(src)/dts/$*.dts

Looks strange. How about:
      cmd_dtc = $(DTC) -O dtb -o $@ -b 0 $(DTS_FLAGS) $<

Then you avoid the hardcoded path in the rule too.


> +
> +$(obj)/%.dtb: $(src)/dts/%.dts
> +	$(call if_changed,dtc)

This snippet belong in the file that uses this.
This is how we do for other rules like bzip etc.

	Sam

^ permalink raw reply

* RE: [PATCH 4/4][v2] rapidio, powerpc/85xx: Error interrupt handler for sRIO.
From: Xie Shaohui-B21989 @ 2010-11-17  8:09 UTC (permalink / raw)
  To: Bounine, Alexandre, akpm
  Cc: Zang Roy-R61911, Gala Kumar-B11780, linuxppc-dev, linux-kernel,
	Li Yang-R58472
In-Reply-To: <0CE8B6BE3C4AD74AB97D9D29BD24E552015397DD@CORPEXCH1.na.ads.idt.com>

[-- Attachment #1: Type: text/plain, Size: 2622 bytes --]

 

 

 

Best Regards, 
Shaohui Xie 

 

From: Bounine, Alexandre [mailto:Alexandre.Bounine@idt.com] 
Sent: Tuesday, November 16, 2010 10:01 PM
To: Xie Shaohui-B21989; akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; Li
Yang-R58472; Gala Kumar-B11780; Zang Roy-R61911
Subject: RE: [PATCH 4/4][v2] rapidio, powerpc/85xx: Error interrupt
handler for sRIO.

 

> From: Shaohui Xie [mailto:b21989@freescale.com]
>
> The sRIO controller reports errors to the core with one signal, it
uses
> register EPWISR to provides the core quick access to where the error
occurred.
> The EPWISR indicates that there are 4 interrupts sources, port1,
port2, message
> unit and port write receive, but the sRIO driver does not support
port2
> for now, still the handler takes care of port2.
> Currently the handler only clear error status without any recovery.
>

Do these dual-RIO controllers have only one port-write interrupt?
(sorry, user manuals are not available for download from FSL).  

[Xie Shaohui] Yes, only one inbound port-write interrupt.



> @@ -1082,14 +1142,24 @@ fsl_rio_port_write_handler(int irq, void
*dev_instance)
>       ipwsr = in_be32(&priv->msg_regs->pwsr);
>
>       epwisr = in_be32(priv->regs_win + RIO_EPWISR);
> -     if (epwisr & 0x80000000) {
> +     if (epwisr & EPWISR_ERR_PINT1) {
>               tmp = in_be32(priv->regs_win + RIO_LTLEDCSR);
>               pr_info("RIO_LTLEDCSR = 0x%x\n", tmp);
> -             out_be32(priv->regs_win + RIO_LTLEDCSR, 0);
> +             port_error_handler(port, 0);
> +     }
> +
> +     if (epwisr & EPWISR_ERR_PINT2) {
> +             pr_info("RIO: port2 error\n");
> +             port_error_handler(port, 1);
> +     }
> +
> +     if (epwisr & EPWISR_ERR_MU) {
> +             pr_info("RIO: message unit error\n");
> +             msg_unit_error_handler(port);
>       }
>
> -     if (!(epwisr & 0x00000001))
> -             return IRQ_HANDLED;
> +     if (!(epwisr & EPWISR_ERR_PW))
> +             return IRQ_NONE;
>
>  #ifdef DEBUG_PW
>       pr_debug("PW Int->IPWMR: 0x%08x IPWSR: 0x%08x (", ipwmr, ipwsr);

This part is out of sync with mainline code tree (37-rc1). Probably it
should be updated to make it easier to apply your patch. Besides that,
works as expected on my RIO setup.




[Xie Shaohui] Ok, I'll updated my patch to latest kernel.

BTW: Something wrong with my outlook, seems it cannot prefix  each line
of original message to some specific emails, but not all, Sorry if this
cause you trouble to read my reply. 


[-- Attachment #2: Type: text/html, Size: 8157 bytes --]

^ permalink raw reply

* Re: [PATCH 3/5] x86/of: Add building device tree blob(s) into image.
From: Dirk Brandewie @ 2010-11-17  6:43 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-arch, linux-kbuild, microblaze-uclinux, devicetree-discuss,
	linux-kernel, sodaville, arjan, linuxppc-dev
In-Reply-To: <20101117060227.GH12813@angua.secretlab.ca>

On 11/16/2010 10:02 PM, Grant Likely wrote:
> On Tue, Nov 16, 2010 at 02:41:38PM -0800, dirk.brandewie@gmail.com wrote:
>> From: Dirk Brandewie<dirk.brandewie@gmail.com>
>>
>> This patch adds linking device tree blobs into vmlinux. DTB's are
>> added by adding the blob object name to list of objects to be linked
>> into the image.
>> e.g:
>>    obj-$(CONFIG_TEST_DTB) += test.dtb.o
>>
>> The set of DTB linked into the image is controlled the Kconfig file
>> in arch/x86/kernel/dts/Kconfig
>>
>> Signed-off-by: Dirk Brandewie<dirk.brandewie@gmail.com>
>> ---
>>   arch/x86/Kconfig            |    6 +++++-
>>   arch/x86/kernel/Makefile    |    6 ++++++
>>   arch/x86/kernel/dts/Kconfig |    7 +++++++
>>   3 files changed, 18 insertions(+), 1 deletions(-)
>>   create mode 100644 arch/x86/kernel/dts/Kconfig
>>
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index 5904f38..f2f516a 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -299,13 +299,17 @@ config X86_BIGSMP
>>   	---help---
>>   	  This option is needed for the systems that have more than 8 CPUs
>>
>> -config X86_OF
>> +menuconfig X86_OF
>>   	bool "Support for device tree"
>>   	select OF
>>   	select OF_FLATTREE
>>   	---help---
>>   	  Device tree support on X86.
>>
>> +if X86_OF
>> +source arch/x86/kernel/dts/Kconfig
>> +endif
>> +
>>   if X86_32
>>   config X86_EXTENDED_PLATFORM
>>   	bool "Support for extended (non-PC) x86 platforms"
>> diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
>> index 586df14..49e017d 100644
>> --- a/arch/x86/kernel/Makefile
>> +++ b/arch/x86/kernel/Makefile
>> @@ -114,6 +114,12 @@ obj-$(CONFIG_SWIOTLB)			+= pci-swiotlb.o
>>   obj-$(CONFIG_X86_OF)			+= prom.o
>>
>>   ###
>> +# device tree blobs
>> +obj-$(CONFIG_CE4100_DTB) += ce4100.dtb.o
>> +obj-$(CONFIG_TEST_DTB) += test.dtb.o
>> +
>> +
>> +###
>>   # 64 bit specific files
>>   ifeq ($(CONFIG_X86_64),y)
>>   	obj-$(CONFIG_AUDIT)		+= audit_64.o
>> diff --git a/arch/x86/kernel/dts/Kconfig b/arch/x86/kernel/dts/Kconfig
>> new file mode 100644
>> index 0000000..d3e5cd4
>> --- /dev/null
>> +++ b/arch/x86/kernel/dts/Kconfig
>> @@ -0,0 +1,7 @@
>> +config CE4100_DTB
>> +       bool "Intel CE4100"
>> +
>> +config TEST_DTB
>> +       bool "Test DTS"
>> +
>> +
>
> As previously mentioned, this isn't going to scale.  Need to look at
> allowing the user to specify a list of .dtbs that will be linked in.
>

These config variables will likely get pushed into being set when the
platform configuration is selected. I still need to talk to the x86 maintainers
and my distribution team to figure out what is going to happen here.

> g.
>
>> --
>> 1.7.2.3
>>
>> _______________________________________________
>> devicetree-discuss mailing list
>> devicetree-discuss@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply

* Re: [PATCH 4/5] of/powerpc: Move build to use generic dts->dtb rule
From: Dirk Brandewie @ 2010-11-17  6:32 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-arch, linux-kbuild, microblaze-uclinux, devicetree-discuss,
	linux-kernel, sodaville, arjan, linuxppc-dev
In-Reply-To: <20101117060653.GI12813@angua.secretlab.ca>

On 11/16/2010 10:06 PM, Grant Likely wrote:
> On Tue, Nov 16, 2010 at 02:41:39PM -0800, dirk.brandewie@gmail.com wrote:
>> From: Dirk Brandewie<dirk.brandewie@gmail.com>
>>
>> This patch changes arch/powerpc/boot/Makefile to use the generic
>> rule build the device tree blobs in scripts/Makefile.lib
>>
>> Signed-off-by: Dirk Brandewie<dirk.brandewie@gmail.com>
>> ---
>>   arch/powerpc/boot/Makefile |    7 -------
>>   1 files changed, 0 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
>> index fae8192..d90c674 100644
>> --- a/arch/powerpc/boot/Makefile
>> +++ b/arch/powerpc/boot/Makefile
>> @@ -147,8 +147,6 @@ targets		+= $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
>>   extra-y		:= $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
>>   		   $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
>>
>> -dtstree		:= $(srctree)/$(src)/dts
>> -
>>   wrapper		:=$(srctree)/$(src)/wrapper
>>   wrapperbits	:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
>>   			$(wrapper) FORCE
>> @@ -331,11 +329,6 @@ $(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
>>   $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
>>   	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
>>
>> -# Rule to build device tree blobs
>> -DTC = $(objtree)/scripts/dtc/dtc
>> -
>> -$(obj)/%.dtb: $(dtstree)/%.dts
>> -	$(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts
> 
> This patch needs to modify the rules that have %.dtb dependencies to
> go looking in arch/powerpc/boot/dts instead of arch/powerpc/boot
> because the rule change will change where .dtb files get generated.

The rule in patch 1 takes of this. The dts directory is relative to the
arch/powerpc/boot/Makefile
+quiet_cmd_dtc = DTC	$@
+      cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(src)/dts/$*.dts
+

> 
> Also, this patch and patch 5 need to be merged with patch 1 so that
> the series remains bisectable.

I tested building a powerpc image with patch 1 applied and patch 4 unapplied and 
the image built without errors and the dtb was present in the wrapped image.
unfortunately I don't have a system to do runtime testing.
I could not build the uboot image type I am missing mkimage.  I did build
the dtbImage, zImage and cuImage types before and after this patch was applied.

--Dirk
> 
> g.
> 
>>
>>   # If there isn't a platform selected then just strip the vmlinux.
>>   ifeq (,$(image-y))
>> -- 
>> 1.7.2.3
>>
>> _______________________________________________
>> devicetree-discuss mailing list
>> devicetree-discuss@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply

* Re: [PATCH 1/5] scripts: dtc: Merge in changes from the dtc repository
From: John Bonesio @ 2010-11-17  6:29 UTC (permalink / raw)
  To: Grant Likely
  Cc: jdl, devicetree-discuss, linux-kernel, John Bonesio, linuxppc-dev,
	david
In-Reply-To: <AANLkTinYZYR_QtS5-Nodpaf2MBBuaw06SW9pDCNQ9ov3@mail.gmail.com>

Arg!

I had this working. I'll look into it.

- John

On 11/16/2010 10:11 PM, Grant Likely wrote:
> On Tue, Nov 16, 2010 at 1:49 PM, John Bonesio <bones@secretlab.ca> wrote:
>> Pull in recent changes from the main dtc repository. These changes primarily
>> allow multiple device trees to be declared which are merged by dtc. This
>> feature allows us to include a basic dts file and then provide more information
>> for the specific system through the merging functionality.
>>
>> Signed-off-by: John Bonesio <bones@secretlab.ca>
>> ---
>>
>>  0 files changed, 0 insertions(+), 0 deletions(-)
> ???  Something isn't right in patch generation.
>
> Also:
>
> ~/hacking/linux-2.6$ xc-6xx make -j3
>   GEN     /home/grant/hacking/linux-2.6.build/6xx/Makefile
>   HOSTCC  scripts/kconfig/zconf.tab.o
>   HOSTLD  scripts/kconfig/conf
> scripts/kconfig/conf --silentoldconfig Kconfig
> #
> # configuration written to .config
> #
>   GEN     /home/grant/hacking/linux-2.6.build/6xx/Makefile
>   CHK     include/linux/version.h
>   UPD     include/linux/version.h
>   HOSTCC  scripts/dtc/checks.o
> In file included from /home/grant/hacking/linux-2.6/scripts/dtc/checks.c:21:
> /home/grant/hacking/linux-2.6/scripts/dtc/dtc.h:37: fatal error:
> util.h: No such file or directory
> compilation terminated.
> make[3]: *** [scripts/dtc/checks.o] Error 1
> make[2]: *** [scripts/dtc] Error 2
> make[1]: *** [scripts] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [sub-make] Error 2
> (devicetree/test) ~/hacking/linux-2.6$
>
> Looks like the updated dtc is broken.
>
> g.
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH 1/5] of: Add support for linking device tree blobs into vmlinux
From: Dirk Brandewie @ 2010-11-17  6:14 UTC (permalink / raw)
  To: Grant Likely
  Cc: arjan, devicetree-discuss, David Daney, linux-kernel, sodaville,
	microblaze-uclinux, linuxppc-dev
In-Reply-To: <AANLkTi=T_bqEswe32dTAfL4++WAitc7+VHnyjqP2sQfi@mail.gmail.com>

On 11/16/2010 06:58 PM, Grant Likely wrote:
> On Tue, Nov 16, 2010 at 7:21 PM, Dirk Brandewie
> <dirk.brandewie@gmail.com>  wrote:
>>
>> On 11/16/2010 04:39 PM, David Daney wrote:
>>>
>>> Thanks for doing this. However I have a few comments...
>>>
>>> On 11/16/2010 02:41 PM, dirk.brandewie@gmail.com wrote:
>>>>
>>>> From: Dirk Brandewie<dirk.brandewie@gmail.com>
>>>>
>>>> /* .data section */
>>>> #define DATA_DATA \
>>>> *(.data) \
>>>> @@ -468,7 +482,8 @@
>>>> MCOUNT_REC() \
>>>> DEV_DISCARD(init.rodata) \
>>>> CPU_DISCARD(init.rodata) \
>>>> - MEM_DISCARD(init.rodata)
>>>> + MEM_DISCARD(init.rodata) \
>>>> + KERNEL_DTB()
>>>>
>>>
>>> I thought the init.rodata was only for data used by __init things.
>>> Although the
>>> current linker scripts do not put it in the section that gets recycled as
>>> usable
>>> memory.
>>>
>>> IIRC the unflattened version of the device tree has pointers to the
>>> flattened
>>> data. Since the device tree nodes are live for the entire kernel
>>> lifecycle,
>>> shouldn't the device tree blobs be in non-init memory?
>>>
>>
>> The contents of the blob get copied to allocated memory during
>> unflatten_device_tree() so the blob that is linked in is no longer needed
>> after init.
>
> Have you written a patch to add this behaviour?  The current code doesn't.  :-)
>

I misspoke, my blob gets copied to allocated memory during unflatten_device_tree.
my early_init_dt_alloc_memory_arch() returns the physical address of a kmalloc'd
buffer.

You would want copy the dtb that your platform is going to use to non-init memory.

--Dirk

^ permalink raw reply

* Re: [PATCH 1/5] scripts: dtc: Merge in changes from the dtc repository
From: Grant Likely @ 2010-11-17  6:11 UTC (permalink / raw)
  To: John Bonesio; +Cc: devicetree-discuss, jdl, linuxppc-dev, linux-kernel, david
In-Reply-To: <20101116204951.12146.21084.stgit@riker>

On Tue, Nov 16, 2010 at 1:49 PM, John Bonesio <bones@secretlab.ca> wrote:
> Pull in recent changes from the main dtc repository. These changes primar=
ily
> allow multiple device trees to be declared which are merged by dtc. This
> feature allows us to include a basic dts file and then provide more infor=
mation
> for the specific system through the merging functionality.
>
> Signed-off-by: John Bonesio <bones@secretlab.ca>
> ---
>
> =A00 files changed, 0 insertions(+), 0 deletions(-)

???  Something isn't right in patch generation.

Also:

~/hacking/linux-2.6$ xc-6xx make -j3
  GEN     /home/grant/hacking/linux-2.6.build/6xx/Makefile
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
#
# configuration written to .config
#
  GEN     /home/grant/hacking/linux-2.6.build/6xx/Makefile
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  HOSTCC  scripts/dtc/checks.o
In file included from /home/grant/hacking/linux-2.6/scripts/dtc/checks.c:21=
:
/home/grant/hacking/linux-2.6/scripts/dtc/dtc.h:37: fatal error:
util.h: No such file or directory
compilation terminated.
make[3]: *** [scripts/dtc/checks.o] Error 1
make[2]: *** [scripts/dtc] Error 2
make[1]: *** [scripts] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [sub-make] Error 2
(devicetree/test) ~/hacking/linux-2.6$

Looks like the updated dtc is broken.

g.

^ permalink raw reply

* Re: [PATCH 4/5] of/powerpc: Move build to use generic dts->dtb rule
From: Grant Likely @ 2010-11-17  6:06 UTC (permalink / raw)
  To: dirk.brandewie
  Cc: linux-arch, linux-kbuild, microblaze-uclinux, devicetree-discuss,
	linux-kernel, sodaville, arjan, linuxppc-dev
In-Reply-To: <dae91d8292876db96f96896b79076c32cd2bf467.1289943240.git.dirk.brandewie@gmail.com>

On Tue, Nov 16, 2010 at 02:41:39PM -0800, dirk.brandewie@gmail.com wrote:
> From: Dirk Brandewie <dirk.brandewie@gmail.com>
> 
> This patch changes arch/powerpc/boot/Makefile to use the generic
> rule build the device tree blobs in scripts/Makefile.lib
> 
> Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
> ---
>  arch/powerpc/boot/Makefile |    7 -------
>  1 files changed, 0 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index fae8192..d90c674 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -147,8 +147,6 @@ targets		+= $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
>  extra-y		:= $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
>  		   $(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds
>  
> -dtstree		:= $(srctree)/$(src)/dts
> -
>  wrapper		:=$(srctree)/$(src)/wrapper
>  wrapperbits	:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
>  			$(wrapper) FORCE
> @@ -331,11 +329,6 @@ $(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
>  $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
>  	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
>  
> -# Rule to build device tree blobs
> -DTC = $(objtree)/scripts/dtc/dtc
> -
> -$(obj)/%.dtb: $(dtstree)/%.dts
> -	$(DTC) -O dtb -o $(obj)/$*.dtb -b 0 $(DTS_FLAGS) $(dtstree)/$*.dts

This patch needs to modify the rules that have %.dtb dependencies to
go looking in arch/powerpc/boot/dts instead of arch/powerpc/boot
because the rule change will change where .dtb files get generated.

Also, this patch and patch 5 need to be merged with patch 1 so that
the series remains bisectable.

g.

>  
>  # If there isn't a platform selected then just strip the vmlinux.
>  ifeq (,$(image-y))
> -- 
> 1.7.2.3
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply

* Re: [PATCH 3/5] x86/of:  Add building device tree blob(s) into image.
From: Grant Likely @ 2010-11-17  6:02 UTC (permalink / raw)
  To: dirk.brandewie
  Cc: linux-arch, linux-kbuild, microblaze-uclinux, devicetree-discuss,
	linux-kernel, sodaville, arjan, linuxppc-dev
In-Reply-To: <35263573f57fd7e780dede628cf489212bfa1400.1289943240.git.dirk.brandewie@gmail.com>

On Tue, Nov 16, 2010 at 02:41:38PM -0800, dirk.brandewie@gmail.com wrote:
> From: Dirk Brandewie <dirk.brandewie@gmail.com>
> 
> This patch adds linking device tree blobs into vmlinux. DTB's are
> added by adding the blob object name to list of objects to be linked
> into the image.
> e.g:
>   obj-$(CONFIG_TEST_DTB) += test.dtb.o
> 
> The set of DTB linked into the image is controlled the Kconfig file
> in arch/x86/kernel/dts/Kconfig
> 
> Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
> ---
>  arch/x86/Kconfig            |    6 +++++-
>  arch/x86/kernel/Makefile    |    6 ++++++
>  arch/x86/kernel/dts/Kconfig |    7 +++++++
>  3 files changed, 18 insertions(+), 1 deletions(-)
>  create mode 100644 arch/x86/kernel/dts/Kconfig
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 5904f38..f2f516a 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -299,13 +299,17 @@ config X86_BIGSMP
>  	---help---
>  	  This option is needed for the systems that have more than 8 CPUs
>  
> -config X86_OF
> +menuconfig X86_OF
>  	bool "Support for device tree"
>  	select OF
>  	select OF_FLATTREE
>  	---help---
>  	  Device tree support on X86.
>  
> +if X86_OF
> +source arch/x86/kernel/dts/Kconfig
> +endif
> +
>  if X86_32
>  config X86_EXTENDED_PLATFORM
>  	bool "Support for extended (non-PC) x86 platforms"
> diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> index 586df14..49e017d 100644
> --- a/arch/x86/kernel/Makefile
> +++ b/arch/x86/kernel/Makefile
> @@ -114,6 +114,12 @@ obj-$(CONFIG_SWIOTLB)			+= pci-swiotlb.o
>  obj-$(CONFIG_X86_OF)			+= prom.o
>  
>  ###
> +# device tree blobs
> +obj-$(CONFIG_CE4100_DTB) += ce4100.dtb.o
> +obj-$(CONFIG_TEST_DTB) += test.dtb.o
> +
> +
> +###
>  # 64 bit specific files
>  ifeq ($(CONFIG_X86_64),y)
>  	obj-$(CONFIG_AUDIT)		+= audit_64.o
> diff --git a/arch/x86/kernel/dts/Kconfig b/arch/x86/kernel/dts/Kconfig
> new file mode 100644
> index 0000000..d3e5cd4
> --- /dev/null
> +++ b/arch/x86/kernel/dts/Kconfig
> @@ -0,0 +1,7 @@
> +config CE4100_DTB
> +       bool "Intel CE4100"
> +
> +config TEST_DTB
> +       bool "Test DTS"
> +
> +

As previously mentioned, this isn't going to scale.  Need to look at
allowing the user to specify a list of .dtbs that will be linked in.

g.

> -- 
> 1.7.2.3
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply

* Re: [PATCH 1/5] scripts: dtc: Merge in changes from the dtc repository
From: Grant Likely @ 2010-11-17  5:59 UTC (permalink / raw)
  To: Kyle Moffett
  Cc: jdl, devicetree-discuss, linux-kernel, John Bonesio, linuxppc-dev,
	david
In-Reply-To: <AANLkTimTks01SnjWJZFycSCQC+ZBEonPLLUwMRQkxLz2@mail.gmail.com>

On Tue, Nov 16, 2010 at 10:56 PM, Kyle Moffett <kyle@moffetthome.net> wrote:
> On Tue, Nov 16, 2010 at 15:49, John Bonesio <bones@secretlab.ca> wrote:
>> Pull in recent changes from the main dtc repository. These changes primarily
>> allow multiple device trees to be declared which are merged by dtc. This
>> feature allows us to include a basic dts file and then provide more information
>> for the specific system through the merging functionality.
>
> Hmm, is there some documentation for how to use this feature?
> Specifically I have a custom board with multiple discrete computers on
> it which are only very slightly physically different from each other
> and I'd like to be able to avoid maintaining 2 nearly-exact copies of
> the same DTS file.

Not yet, but there will be.

g.

^ permalink raw reply

* Re: [PATCH 1/5] scripts: dtc: Merge in changes from the dtc repository
From: Kyle Moffett @ 2010-11-17  5:56 UTC (permalink / raw)
  To: John Bonesio
  Cc: jdl, glikely, devicetree-discuss, linux-kernel, linuxppc-dev,
	david
In-Reply-To: <20101116204951.12146.21084.stgit@riker>

On Tue, Nov 16, 2010 at 15:49, John Bonesio <bones@secretlab.ca> wrote:
> Pull in recent changes from the main dtc repository. These changes primarily
> allow multiple device trees to be declared which are merged by dtc. This
> feature allows us to include a basic dts file and then provide more information
> for the specific system through the merging functionality.

Hmm, is there some documentation for how to use this feature?
Specifically I have a custom board with multiple discrete computers on
it which are only very slightly physically different from each other
and I'd like to be able to avoid maintaining 2 nearly-exact copies of
the same DTS file.

Cheers,
Kyle Moffett

^ permalink raw reply

* Re: [PATCH 4/5] powerpc/5200: dts: Remove incorrect combatible strings
From: Grant Likely @ 2010-11-17  5:08 UTC (permalink / raw)
  To: John Bonesio
  Cc: jdl, glikely, devicetree-discuss, linux-kernel, linuxppc-dev,
	david
In-Reply-To: <20101116205019.12146.79445.stgit@riker>

On Tue, Nov 16, 2010 at 12:50:19PM -0800, John Bonesio wrote:
> This patch removes some incorrect compatible strings on the local plus bus node
> in dts files for MPC5200b based systems.
> 
> Signed-off-by: John Bonesio <bones@secretlab.ca>
> ---
> 
>  arch/powerpc/boot/dts/lite5200b.dts |    2 +-
>  arch/powerpc/boot/dts/mucmc52.dts   |    2 +-
>  arch/powerpc/boot/dts/pcm032.dts    |    2 +-
>  arch/powerpc/boot/dts/uc101.dts     |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
> index c0a4e45..ed8d7ae 100644
> --- a/arch/powerpc/boot/dts/lite5200b.dts
> +++ b/arch/powerpc/boot/dts/lite5200b.dts
> @@ -295,7 +295,7 @@
>  	};
>  
>  	localbus {
> -		compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";
> +		compatible = "fsl,mpc5200b-lpb","simple-bus";

Actually, this is change backwards; all of the mpc5200b localbus nodes
should be:

	compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";


>  
>  		#address-cells = <2>;
>  		#size-cells = <1>;
> diff --git a/arch/powerpc/boot/dts/mucmc52.dts b/arch/powerpc/boot/dts/mucmc52.dts
> index 8dc212d..b9d3559 100644
> --- a/arch/powerpc/boot/dts/mucmc52.dts
> +++ b/arch/powerpc/boot/dts/mucmc52.dts
> @@ -217,7 +217,7 @@
>  	};
>  
>  	localbus {
> -		compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";
> +		compatible = "fsl,mpc5200b-lpb","simple-bus";
>  
>  		#address-cells = <2>;
>  		#size-cells = <1>;
> diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
> index e0f2702..085a646 100644
> --- a/arch/powerpc/boot/dts/pcm032.dts
> +++ b/arch/powerpc/boot/dts/pcm032.dts
> @@ -292,7 +292,7 @@
>  	};
>  
>  	localbus {
> -		compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";
> +		compatible = "fsl,mpc5200b-lpb","simple-bus";
>  
>  		#address-cells = <2>;
>  		#size-cells = <1>;
> diff --git a/arch/powerpc/boot/dts/uc101.dts b/arch/powerpc/boot/dts/uc101.dts
> index e00441a..70299a4 100644
> --- a/arch/powerpc/boot/dts/uc101.dts
> +++ b/arch/powerpc/boot/dts/uc101.dts
> @@ -229,7 +229,7 @@
>  	};
>  
>  	localbus {
> -		compatible = "fsl,mpc5200b-lpb","fsl,mpc5200-lpb","simple-bus";
> +		compatible = "fsl,mpc5200b-lpb","simple-bus";
>  
>  		#address-cells = <2>;
>  		#size-cells = <1>;
> 

^ permalink raw reply

* Re: [PATCH 3/5] powerpc/5200: dts: remove unused properties
From: Grant Likely @ 2010-11-17  5:05 UTC (permalink / raw)
  To: John Bonesio
  Cc: jdl, glikely, devicetree-discuss, linux-kernel, linuxppc-dev,
	david
In-Reply-To: <20101116205010.12146.37154.stgit@riker>

On Tue, Nov 16, 2010 at 12:50:10PM -0800, John Bonesio wrote:
> This patch remove unused properties in dts files in preparation of refactoring
> the dts files for MPC5200b based boards.
> 
> Signed-off-by: John Bonesio <bones@secretlab.ca>
> ---
> 
>  arch/powerpc/boot/dts/cm5200.dts    |    2 --
>  arch/powerpc/boot/dts/lite5200b.dts |    3 ---
>  arch/powerpc/boot/dts/media5200.dts |    2 --
>  arch/powerpc/boot/dts/motionpro.dts |    2 --
>  arch/powerpc/boot/dts/pcm030.dts    |    2 --
>  arch/powerpc/boot/dts/pcm032.dts    |    2 --
>  6 files changed, 0 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/powerpc/boot/dts/cm5200.dts b/arch/powerpc/boot/dts/cm5200.dts
> index 9369dcd..d549897 100644
> --- a/arch/powerpc/boot/dts/cm5200.dts
> +++ b/arch/powerpc/boot/dts/cm5200.dts
> @@ -230,8 +230,6 @@
>  			reg = <0 0 0x2000000>;
>  			bank-width = <2>;
>  			device-width = <2>;
> -			#size-cells = <1>;
> -			#address-cells = <1>;
>  		};
>  	};
>  };
> diff --git a/arch/powerpc/boot/dts/lite5200b.dts b/arch/powerpc/boot/dts/lite5200b.dts
> index a74b790..c0a4e45 100644
> --- a/arch/powerpc/boot/dts/lite5200b.dts
> +++ b/arch/powerpc/boot/dts/lite5200b.dts
> @@ -174,7 +174,6 @@
>  
>  		psc@2000 {		// PSC1
>  			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -			cell-index = <0>;
>  			reg = <0x2000 0x100>;
>  			interrupts = <2 1 0>;
>  		};
> @@ -198,7 +197,6 @@
>  		// PSC4 in uart mode example
>  		//serial@2600 {		// PSC4
>  		//	compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -		//	cell-index = <3>;
>  		//	reg = <0x2600 0x100>;
>  		//	interrupts = <2 11 0>;
>  		//};
> @@ -206,7 +204,6 @@
>  		// PSC5 in uart mode example
>  		//serial@2800 {		// PSC5
>  		//	compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -		//	cell-index = <4>;
>  		//	reg = <0x2800 0x100>;
>  		//	interrupts = <2 12 0>;
>  		//};

How about deleting the commented out nodes entirely since they can now
be captured in the mpc5200.dtsi file.

> diff --git a/arch/powerpc/boot/dts/media5200.dts b/arch/powerpc/boot/dts/media5200.dts
> index a70ef68..e027f45 100644
> --- a/arch/powerpc/boot/dts/media5200.dts
> +++ b/arch/powerpc/boot/dts/media5200.dts
> @@ -185,8 +185,6 @@
>  		// PSC6 in uart mode
>  		console: psc@2c00 {		// PSC6
>  			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -			cell-index = <5>;
> -			port-number = <0>;  // Logical port assignment
>  			reg = <0x2c00 0x100>;
>  			interrupts = <2 4 0>;
>  		};
> diff --git a/arch/powerpc/boot/dts/motionpro.dts b/arch/powerpc/boot/dts/motionpro.dts
> index f6261ea..3ab4666 100644
> --- a/arch/powerpc/boot/dts/motionpro.dts
> +++ b/arch/powerpc/boot/dts/motionpro.dts
> @@ -277,8 +277,6 @@
>  			reg = <0 0 0x01000000>;
>  			bank-width = <2>;
>  			device-width = <2>;
> -			#size-cells = <1>;
> -			#address-cells = <1>;
>  		};
>  	};
>  };
> diff --git a/arch/powerpc/boot/dts/pcm030.dts b/arch/powerpc/boot/dts/pcm030.dts
> index 3a4f554..f3e30bb 100644
> --- a/arch/powerpc/boot/dts/pcm030.dts
> +++ b/arch/powerpc/boot/dts/pcm030.dts
> @@ -196,7 +196,6 @@
>  
>  		psc@2400 { /* PSC3 in UART mode */
>  			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -			cell-index = <2>;
>  			reg = <0x2400 0x100>;
>  			interrupts = <2 3 0>;
>  		};
> @@ -207,7 +206,6 @@
>  
>  		psc@2c00 { /* PSC6 in UART mode */
>  			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -			cell-index = <5>;
>  			reg = <0x2c00 0x100>;
>  			interrupts = <2 4 0>;
>  		};
> diff --git a/arch/powerpc/boot/dts/pcm032.dts b/arch/powerpc/boot/dts/pcm032.dts
> index 17596c7..e0f2702 100644
> --- a/arch/powerpc/boot/dts/pcm032.dts
> +++ b/arch/powerpc/boot/dts/pcm032.dts
> @@ -196,7 +196,6 @@
>  
>  		psc@2400 { /* PSC3 in UART mode */
>  			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -			cell-index = <2>;
>  			reg = <0x2400 0x100>;
>  			interrupts = <2 3 0>;
>  		};
> @@ -207,7 +206,6 @@
>  
>  		psc@2c00 { /* PSC6 in UART mode */
>  			compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart";
> -			cell-index = <5>;
>  			reg = <0x2c00 0x100>;
>  			interrupts = <2 4 0>;
>  		};
> 

^ 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