* Re: [PATCH] fix powerpc breakage in sg chaining code (again)
From: Johannes Berg @ 2007-10-24 9:24 UTC (permalink / raw)
To: Jens Axboe; +Cc: linuxppc-dev list, Paul Mackerras, Anton Blanchard
In-Reply-To: <1193217816.5715.8.camel@johannes.berg>
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
On Wed, 2007-10-24 at 11:23 +0200, Johannes Berg wrote:
> On Wed, 2007-10-24 at 11:22 +0200, Johannes Berg wrote:
>
> > No, it came out after I pulled, I was on v2.6.23-6815-g0895e91. I'll
> > give it a try, but I don't think I can confirm it works before tomorrow.
> > I see the build failure got fixed with commit
> > 5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2 too.
>
> Wait, now I lost track. This patch is identical to that commit 5edad...,
> what I was thinking of was the oops I got.
Nah, never mind. Apologies to everybody. I'm confused, Jens says the
oops was fixed. I'll verify that.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [PATCH] fix powerpc breakage in sg chaining code (again)
From: Johannes Berg @ 2007-10-24 9:23 UTC (permalink / raw)
To: Jens Axboe; +Cc: linuxppc-dev list, Paul Mackerras, Anton Blanchard
In-Reply-To: <1193217742.5715.6.camel@johannes.berg>
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
On Wed, 2007-10-24 at 11:22 +0200, Johannes Berg wrote:
> No, it came out after I pulled, I was on v2.6.23-6815-g0895e91. I'll
> give it a try, but I don't think I can confirm it works before tomorrow.
> I see the build failure got fixed with commit
> 5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2 too.
Wait, now I lost track. This patch is identical to that commit 5edad...,
what I was thinking of was the oops I got.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [PATCH] fix powerpc breakage in sg chaining code (again)
From: Johannes Berg @ 2007-10-24 9:22 UTC (permalink / raw)
To: Jens Axboe; +Cc: linuxppc-dev list, Paul Mackerras, Anton Blanchard
In-Reply-To: <20071024091446.GL14671@kernel.dk>
[-- Attachment #1: Type: text/plain, Size: 431 bytes --]
On Wed, 2007-10-24 at 11:14 +0200, Jens Axboe wrote:
> I lost track - which kernel are you booting? This looks like something
> that should be fixed, did you try 2.6.24-rc1?
No, it came out after I pulled, I was on v2.6.23-6815-g0895e91. I'll
give it a try, but I don't think I can confirm it works before tomorrow.
I see the build failure got fixed with commit
5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2 too.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [PATCH] fix powerpc breakage in sg chaining code (again)
From: Jens Axboe @ 2007-10-24 9:14 UTC (permalink / raw)
To: Johannes Berg; +Cc: linuxppc-dev list, Paul Mackerras, Anton Blanchard
In-Reply-To: <1193176034.4097.3.camel@johannes.berg>
On Tue, Oct 23 2007, Johannes Berg wrote:
> On Tue, 2007-10-23 at 23:00 +0200, Johannes Berg wrote:
> > Commit 33ff910f0f466184ffc3514628f18403dcd86761 fixed commit
> > 78bdc3106a877cfa50439fa66b52acbc4e7868df but the code that got put in
> > uses struct scatterlist->page which no longer exists since commit
> > 18dabf473e15850c0dbc8ff13ac1e2806d542c15 which requires using
> > sg_page(sg) instead of sg->page.
>
> This doesn't help though, when I boot I get a NULL-pointer dereference
> that looks approximately like this:
>
> NIP blk_rq_map_sg + 0x64/0x190
> LR ide_map_sg + 0x38/?
> Call trace:
> cfq_remove_request + 0x168 (unreliable)
> cfq_dispatch_request + 0x44
> ide_build_sglist + 0x38?
> pmac_ide_dma_setup + 0xa0?
> ide_do_rw_disk? + ?
> [...]
>
> I can upload the picture I took but it's hardly readable (taken with my
> crappy cell phone)
I lost track - which kernel are you booting? This looks like something
that should be fixed, did you try 2.6.24-rc1?
--
Jens Axboe
^ permalink raw reply
* Re: [PATCH] fix powerpc breakage in sg chaining code (again)
From: Johannes Berg @ 2007-10-23 21:47 UTC (permalink / raw)
To: Anton Blanchard; +Cc: linuxppc-dev list, Paul Mackerras, Jens Axboe
In-Reply-To: <1193173222.7733.42.camel@johannes.berg>
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
On Tue, 2007-10-23 at 23:00 +0200, Johannes Berg wrote:
> Commit 33ff910f0f466184ffc3514628f18403dcd86761 fixed commit
> 78bdc3106a877cfa50439fa66b52acbc4e7868df but the code that got put in
> uses struct scatterlist->page which no longer exists since commit
> 18dabf473e15850c0dbc8ff13ac1e2806d542c15 which requires using
> sg_page(sg) instead of sg->page.
This doesn't help though, when I boot I get a NULL-pointer dereference
that looks approximately like this:
NIP blk_rq_map_sg + 0x64/0x190
LR ide_map_sg + 0x38/?
Call trace:
cfq_remove_request + 0x168 (unreliable)
cfq_dispatch_request + 0x44
ide_build_sglist + 0x38?
pmac_ide_dma_setup + 0xa0?
ide_do_rw_disk? + ?
[...]
I can upload the picture I took but it's hardly readable (taken with my
crappy cell phone)
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* [PATCH] fix powerpc breakage in sg chaining code (again)
From: Johannes Berg @ 2007-10-23 21:00 UTC (permalink / raw)
To: Anton Blanchard; +Cc: linuxppc-dev list, Paul Mackerras, Jens Axboe
Commit 33ff910f0f466184ffc3514628f18403dcd86761 fixed commit
78bdc3106a877cfa50439fa66b52acbc4e7868df but the code that got put in
uses struct scatterlist->page which no longer exists since commit
18dabf473e15850c0dbc8ff13ac1e2806d542c15 which requires using
sg_page(sg) instead of sg->page.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
If it was fixed before please ignore, I just ran into this.
--- linux-2.6.orig/include/asm/dma-mapping.h 2007-10-23 22:55:33.551133142 +0200
+++ linux-2.6/include/asm/dma-mapping.h 2007-10-23 22:56:07.081133142 +0200
@@ -285,9 +285,9 @@ dma_map_sg(struct device *dev, struct sc
BUG_ON(direction == DMA_NONE);
for_each_sg(sgl, sg, nents, i) {
- BUG_ON(!sg->page);
- __dma_sync_page(sg->page, sg->offset, sg->length, direction);
- sg->dma_address = page_to_bus(sg->page) + sg->offset;
+ BUG_ON(!sg_page(sg));
+ __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
+ sg->dma_address = page_to_bus(sg_page(sg)) + sg->offset;
}
return nents;
@@ -328,7 +328,7 @@ static inline void dma_sync_sg_for_cpu(s
BUG_ON(direction == DMA_NONE);
for_each_sg(sgl, sg, nents, i)
- __dma_sync_page(sg->page, sg->offset, sg->length, direction);
+ __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
}
static inline void dma_sync_sg_for_device(struct device *dev,
@@ -341,7 +341,7 @@ static inline void dma_sync_sg_for_devic
BUG_ON(direction == DMA_NONE);
for_each_sg(sgl, sg, nents, i)
- __dma_sync_page(sg->page, sg->offset, sg->length, direction);
+ __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
}
static inline int dma_mapping_error(dma_addr_t dma_addr)
^ permalink raw reply
* CPM microcode uploading and CPM reset on MPC8560
From: Vladislav Nyaykalo @ 2007-10-24 8:05 UTC (permalink / raw)
To: linuxppc-embedded
Hello to everyone,
I need to insert a function that uploads CPM microcode and resets CPM
somewhere during kernel initialization before UART is initialized. Could you
please suggest me the best suitable place.
Target platform: MPC8560
Kernel: 2.6.10
Regards,
Vlad
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/
^ permalink raw reply
* PPC4xx 2x eth phy
From: - Reyneke @ 2007-10-24 7:26 UTC (permalink / raw)
To: linuxppc-embedded
Some quick feedback to the list. A few weeks ago I talked about the problem=
of the second ethernet connection not working when the first ethernet conn=
ection does not have a link.
Basically the problem is PHYs that don't generate a RX clock when no link i=
s present (i.e. ET1011. It turns out that in case of the 440Epx, there is s=
ome interdependency within the EMAC which means that when EMAC1 initialises=
, there MUST be a RX clock on EMAC0. If that is not the case, EMAC1 will NO=
T send/receive even though initialisation and auto-negotiation is successfu=
l.
There is some linux code for handling missing RX clocks, but this code does=
not extend to the scenario where one EMAC is dependent on another EMAC's P=
HY having a receive clock.
Regards
Jan Reyneke
> HI,
>
> We've run into a bit of an odd problem and we are not sure where to go an=
d
> look for the cause.
>
> We have some 440EPx based hardware with two GIG-Ethernet ports using RGMI=
I
> and 2x ET1011C PHY's. Problem is that eth1 will only initialise correctly
> (i.e. receive and transmit) if eth0 has a link. Eth0 always work OK,
> regardless of eth1 status. Eth1 will work OK if eth0 has a link (i.e.
> initialised) at time of setup. Once initialised, eth0 status is
> irrelevant.
> All this is during Linux boot process.
>
> Any ideas?
>
> We can access PHY registers via u-boot (mii commands). Same 1Gig link
> speed
> is used on both ports. Linux kernel is 2.6.19.
_________________________________________________________________
The next generation of MSN Hotmail has arrived - Windows Live Hotmail
http://www.newhotmail.co.uk=
^ permalink raw reply
* Re: [PATCH 03/11] [POWERPC] Add common mpc52xx_setup_pci() routine
From: Stephen Rothwell @ 2007-10-24 7:16 UTC (permalink / raw)
To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20071023231321.29359.96506.stgit@hekate.izotz.org>
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
On Wed, 24 Oct 2007 01:13:21 +0200 Marian Balakowicz <m8@semihalf.com> wrote:
>
> +++ b/arch/powerpc/platforms/52xx/lite5200.c
> @@ -155,11 +155,7 @@ static void __init lite5200_setup_arch(void)
> #endif
>
> #ifdef CONFIG_PCI
> - np = of_find_node_by_type(NULL, "pci");
> - if (np) {
> - mpc52xx_add_bridge(np);
> - of_node_put(np);
> - }
> + mpc52xx_setup_pci();
> #endif
Normally we would have no "#ifdef CONFIG_PCI" here but instead define a
static inline void mpc52xx_setup_pci(void) { }
in the header file for the non PCI case.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH 01/11] [POWERPC] Add 'machine: ...' line to common show_cpuinfo()
From: Stephen Rothwell @ 2007-10-24 7:11 UTC (permalink / raw)
To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20071023231309.29359.20887.stgit@hekate.izotz.org>
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
On Wed, 24 Oct 2007 01:13:09 +0200 Marian Balakowicz <m8@semihalf.com> wrote:
>
> + root = of_find_node_by_path("/");
> + if (root)
> + model = of_get_property(root, "model", NULL);
> + of_node_put(root);
The paranoid part of me says:
if (model)
> + seq_printf(m, "machine\t\t: %s\n", model);
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* libfdt: Add some documenting comments in libfdt.h
From: David Gibson @ 2007-10-24 7:10 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch adds some internal documentation in libfdt.h, in the form
of comments on the error codes and some functions. Only a couple of
functions are covered so far, leaving the documentation still woefully
inadequate, but hey, it's a start.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/libfdt/libfdt.h
===================================================================
--- dtc.orig/libfdt/libfdt.h 2007-10-24 15:56:14.000000000 +1000
+++ dtc/libfdt/libfdt.h 2007-10-24 16:55:09.000000000 +1000
@@ -59,27 +59,64 @@
/* Error codes: informative error codes */
#define FDT_ERR_NOTFOUND 1
+ /* FDT_ERR_NOTFOUND: The requested node or property does not exist */
#define FDT_ERR_EXISTS 2
+ /* FDT_ERR_EXISTS: Attemped to create a node or property which
+ * already exists */
#define FDT_ERR_NOSPACE 3
+ /* FDT_ERR_NOSPACE: Operation needed to expand the device
+ * tree, but its buffer did not have sufficient space to
+ * contain the expanded tree. Use fdt_open_into() to move the
+ * device tree to a buffer with more space. */
/* Error codes: codes for bad parameters */
#define FDT_ERR_BADOFFSET 4
+ /* FDT_ERR_BADOFFSET: Function was passed a structure block
+ * offset which is out-of-bounds, or which points to an
+ * unsuitable part of the structure for the operation. */
#define FDT_ERR_BADPATH 5
+ /* FDT_ERR_BADPATH: Function was passed a badly formatted path
+ * (e.g. missing a leading / for a function which requires an
+ * absolute path) */
#define FDT_ERR_BADSTATE 6
+ /* FDT_ERR_BADSTATE: Function was passed an incomplete device
+ * tree created by the sequential-write functions, which is
+ * not sufficiently complete for the requested operation. */
/* Error codes: codes for bad device tree blobs */
#define FDT_ERR_TRUNCATED 7
+ /* FDT_ERR_TRUNCATED: Structure block of the given device tree
+ * ends without an FDT_END tag. */
#define FDT_ERR_BADMAGIC 8
+ /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
+ * device tree at all - it is missing the flattened device
+ * tree magic number. */
#define FDT_ERR_BADVERSION 9
+ /* FDT_ERR_BADVERSION: Given device tree has a version which
+ * can't be handled by the requested operation. For
+ * read-write functions, this may mean that fdt_open_into() is
+ * required to convert the tree to the expected version. */
#define FDT_ERR_BADSTRUCTURE 10
+ /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
+ * structure block or other serious error (e.g. misnested
+ * nodes, or subnodes preceding properties). */
#define FDT_ERR_BADLAYOUT 11
+ /* FDT_ERR_BADLAYOUT: For read-write functions, the given
+ * device tree has it's sub-blocks in an order that the
+ * function can't handle (memory reserve map, then structure,
+ * then strings). Use fdt_open_into() to reorganize the tree
+ * into a form suitable for the read-write operations. */
/* "Can't happen" error indicating a bug in libfdt */
#define FDT_ERR_INTERNAL 12
+ /* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
+ * Indicates a bug in libfdt itself. */
#define FDT_ERR_MAX 12
-/* Low-level functions (you probably don't need these) */
+/**********************************************************************/
+/* Low-level functions (you probably don't need these) */
+/**********************************************************************/
const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
@@ -94,7 +131,10 @@ static inline void *fdt_offset_ptr_w(voi
uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
-/* General functions */
+/**********************************************************************/
+/* General functions */
+/**********************************************************************/
+
#define fdt_get_header(fdt, field) \
(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
@@ -111,15 +151,91 @@ uint32_t fdt_next_tag(const void *fdt, i
#define fdt_set_header(fdt, field, val) \
((struct fdt_header *)(fdt))->field = cpu_to_fdt32(val)
+/**
+ * fdt_check_header - sanity check a device tree or possible device tree
+ * @fdt: pointer to data which might be a flattened device tree
+ *
+ * fdt_check_header() checks that the given buffer contains what
+ * appears to be a flattened device tree with sane information in its
+ * header.
+ *
+ * returns:
+ * 0, if the buffer appears to contain a valid device tree
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings, as above
+ */
int fdt_check_header(const void *fdt);
+
+/**
+ * fdt_move - move a device tree around in memory
+ * @fdt: pointer to the device tree to move
+ * @buf: pointer to memory where the device is to be moved
+ * @bufsize: size of the memory space at buf
+ *
+ * fdt_move() relocates, if possible, the device tree blob located at
+ * fdt to the buffer at buf of size bufsize. The buffer may overlap
+ * with the existing device tree blob at fdt. Therefore,
+ * fdt_move(fdt, fdt, fdt_totalsize(fdt))
+ * should always succeed.
+ *
+ * returns:
+ * 0, on success
+ * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings
+ */
int fdt_move(const void *fdt, void *buf, int bufsize);
-/* Read-only functions */
+/**********************************************************************/
+/* Read-only functions */
+/**********************************************************************/
+
+/**
+ * fdt_string - retreive a string from the strings block of a device tree
+ * @fdt: pointer to the device tree blob
+ * @stroffset: offset of the string within the strings block (native endian)
+ *
+ * fdt_string() retrieves a pointer to a single string from the
+ * strings block of the device tree blob at fdt.
+ *
+ * returns:
+ * a pointer to the string, on success
+ * NULL, if stroffset is out of bounds
+ */
const char *fdt_string(const void *fdt, int stroffset);
-int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+/**
+ * fdt_num_mem_rsv - retreive the number of memory reserve map entries
+ * @fdt: pointer to the device tree blob
+ *
+ * Returns the number of entries in the device tree blob's memory
+ * reservation map. This does not include the terminating 0,0 entry
+ * or any other (0,0) entries reserved for expansion.
+ *
+ * returns:
+ * the number of entries
+ */
int fdt_num_mem_rsv(const void *fdt);
+/**
+ * fdt_get_mem_rsv - retreive one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: pointers to 64-bit variables
+ *
+ * On success, *address and *size will contain the address and size of
+ * the n-th reserve map entry from the device tree blob, in
+ * native-endian format.
+ *
+ * returns:
+ * 0, on success
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
const char *name, int namelen);
int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
@@ -163,7 +279,10 @@ int fdt_node_check_compatible(const void
int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
const char *compatible);
-/* Write-in-place functions */
+/**********************************************************************/
+/* Write-in-place functions */
+/**********************************************************************/
+
int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
const void *val, int len);
@@ -176,7 +295,10 @@ int fdt_setprop_inplace(void *fdt, int n
int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
int fdt_nop_node(void *fdt, int nodeoffset);
-/* Sequential-write functions */
+/**********************************************************************/
+/* Sequential write functions */
+/**********************************************************************/
+
int fdt_create(void *buf, int bufsize);
int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
int fdt_finish_reservemap(void *fdt);
@@ -192,7 +314,10 @@ int fdt_property(void *fdt, const char *
int fdt_end_node(void *fdt);
int fdt_finish(void *fdt);
-/* Read-write functions */
+/**********************************************************************/
+/* Read-write functions */
+/**********************************************************************/
+
int fdt_open_into(void *fdt, void *buf, int bufsize);
int fdt_pack(void *fdt);
@@ -214,7 +339,10 @@ int fdt_add_subnode_namelen(void *fdt, i
int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
int fdt_del_node(void *fdt, int nodeoffset);
-/* Extra functions */
+/**********************************************************************/
+/* Debugging / informational functions */
+/**********************************************************************/
+
const char *fdt_strerror(int errval);
#endif /* _LIBFDT_H */
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* [PATCH] taskstats scaled time cleanup
From: Michael Neuling @ 2007-10-24 6:54 UTC (permalink / raw)
To: paulus, akpm, linux390
Cc: linuxppc-dev, Balbir Singh, linux-kernel, linux-s390
This moves the ability to scale cputime into generic code. This
allows us to fix the issue in kernel/timer.c (noticed by Balbir) where
we could only add an unscaled value to the scaled utime/stime.
This adds a cputime_to_scaled function. As before, the POWERPC
version does the scaling based on the last SPURR/PURR ratio
calculated. The generic and s390 (only other arch to implement
asm/cputime.h) versions are both NOPs.
Also moves the SPURR and PURR snapshots closer.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/kernel/time.c | 14 +++++++-------
include/asm-generic/cputime.h | 1 +
include/asm-powerpc/cputime.h | 14 ++++++++++++++
include/asm-powerpc/paca.h | 2 --
include/asm-s390/cputime.h | 1 +
kernel/timer.c | 9 +++++----
6 files changed, 28 insertions(+), 13 deletions(-)
Index: linux-2.6-ozlabs/arch/powerpc/kernel/time.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/time.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/time.c
@@ -66,6 +66,7 @@
#include <asm/smp.h>
#include <asm/vdso_datapage.h>
#include <asm/firmware.h>
+#include <asm/cputime.h>
#ifdef CONFIG_PPC_ISERIES
#include <asm/iseries/it_lp_queue.h>
#include <asm/iseries/hv_call_xm.h>
@@ -186,6 +187,8 @@ u64 __cputime_sec_factor;
EXPORT_SYMBOL(__cputime_sec_factor);
u64 __cputime_clockt_factor;
EXPORT_SYMBOL(__cputime_clockt_factor);
+DEFINE_PER_CPU(unsigned long, cputime_last_delta);
+DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta);
static void calc_cputime_factors(void)
{
@@ -232,9 +235,9 @@ void account_system_vtime(struct task_st
local_irq_save(flags);
now = read_purr();
+ nowscaled = read_spurr(now);
delta = now - get_paca()->startpurr;
get_paca()->startpurr = now;
- nowscaled = read_spurr(now);
deltascaled = nowscaled - get_paca()->startspurr;
get_paca()->startspurr = nowscaled;
if (!in_interrupt()) {
@@ -247,9 +250,9 @@ void account_system_vtime(struct task_st
get_paca()->system_time = 0;
}
account_system_time(tsk, 0, delta);
- get_paca()->purrdelta = delta;
+ per_cpu(cputime_last_delta, smp_processor_id()) = delta;
account_system_time_scaled(tsk, deltascaled);
- get_paca()->spurrdelta = deltascaled;
+ per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
local_irq_restore(flags);
}
@@ -267,10 +270,7 @@ void account_process_vtime(struct task_s
get_paca()->user_time = 0;
account_user_time(tsk, utime);
- /* Estimate the scaled utime by scaling the real utime based
- * on the last spurr to purr ratio */
- utimescaled = utime * get_paca()->spurrdelta / get_paca()->purrdelta;
- get_paca()->spurrdelta = get_paca()->purrdelta = 0;
+ utimescaled = cputime_to_scaled(utime);
account_user_time_scaled(tsk, utimescaled);
}
Index: linux-2.6-ozlabs/include/asm-generic/cputime.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-generic/cputime.h
+++ linux-2.6-ozlabs/include/asm-generic/cputime.h
@@ -18,6 +18,7 @@ typedef unsigned long cputime_t;
#define cputime_lt(__a, __b) ((__a) < (__b))
#define cputime_le(__a, __b) ((__a) <= (__b))
#define cputime_to_jiffies(__ct) (__ct)
+#define cputime_to_scaled(__ct) (__ct)
#define jiffies_to_cputime(__hz) (__hz)
typedef u64 cputime64_t;
Index: linux-2.6-ozlabs/include/asm-powerpc/cputime.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/cputime.h
+++ linux-2.6-ozlabs/include/asm-powerpc/cputime.h
@@ -52,12 +52,26 @@ typedef u64 cputime64_t;
* Convert cputime <-> jiffies
*/
extern u64 __cputime_jiffies_factor;
+DECLARE_PER_CPU(unsigned long, cputime_last_delta);
+DECLARE_PER_CPU(unsigned long, cputime_scaled_last_delta);
static inline unsigned long cputime_to_jiffies(const cputime_t ct)
{
return mulhdu(ct, __cputime_jiffies_factor);
}
+/* Estimate the scaled cputime by scaling the real cputime based on
+ * the last scaled to real ratio */
+static inline cputime_t cputime_to_scaled(const cputime_t ct)
+{
+ if (cpu_has_feature(CPU_FTR_SPURR) &&
+ per_cpu(cputime_last_delta, smp_processor_id()))
+ return ct *
+ per_cpu(cputime_scaled_last_delta, smp_processor_id())/
+ per_cpu(cputime_last_delta, smp_processor_id());
+ return ct;
+}
+
static inline cputime_t jiffies_to_cputime(const unsigned long jif)
{
cputime_t ct;
Index: linux-2.6-ozlabs/include/asm-powerpc/paca.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/paca.h
+++ linux-2.6-ozlabs/include/asm-powerpc/paca.h
@@ -115,8 +115,6 @@ struct paca_struct {
u64 system_time; /* accumulated system TB ticks */
u64 startpurr; /* PURR/TB value snapshot */
u64 startspurr; /* SPURR value snapshot */
- u64 purrdelta; /* FIXME: document */
- u64 spurrdelta; /* FIXME: document */
};
extern struct paca_struct paca[];
Index: linux-2.6-ozlabs/include/asm-s390/cputime.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-s390/cputime.h
+++ linux-2.6-ozlabs/include/asm-s390/cputime.h
@@ -54,6 +54,7 @@ __div(unsigned long long n, unsigned int
#define cputime_lt(__a, __b) ((__a) < (__b))
#define cputime_le(__a, __b) ((__a) <= (__b))
#define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ))
+#define cputime_to_scaled(__ct) (__ct)
#define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ))
#define cputime64_zero (0ULL)
Index: linux-2.6-ozlabs/kernel/timer.c
===================================================================
--- linux-2.6-ozlabs.orig/kernel/timer.c
+++ linux-2.6-ozlabs/kernel/timer.c
@@ -825,14 +825,15 @@ void update_process_times(int user_tick)
{
struct task_struct *p = current;
int cpu = smp_processor_id();
+ cputime_t one_jiffy = jiffies_to_cputime(1);
/* Note: this timer irq context must be accounted for as well. */
if (user_tick) {
- account_user_time(p, jiffies_to_cputime(1));
- account_user_time_scaled(p, jiffies_to_cputime(1));
+ account_user_time(p, one_jiffy);
+ account_user_time_scaled(p, cputime_to_scaled(one_jiffy));
} else {
- account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
- account_system_time_scaled(p, jiffies_to_cputime(1));
+ account_system_time(p, HARDIRQ_OFFSET, one_jiffy);
+ account_system_time_scaled(p, cputime_to_scaled(one_jiffy));
}
run_local_timers();
if (rcu_pending(cpu))
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Michael Ellerman @ 2007-10-24 6:23 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linuxppc-dev
In-Reply-To: <471EE082.3090204@pobox.com>
[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]
On Wed, 2007-10-24 at 02:04 -0400, Jeff Garzik wrote:
> Benjamin Herrenschmidt wrote:
> > On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> >> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> >> children for a property, this is not safe WRT refcounting, so fix it
> >> to use of_get_next_child().
> >>
> >> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> >
> > Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >
> > (Pending you test boot it on one of our G5s first !)
> >
> >> ---
> >> drivers/ata/sata_svw.c | 5 ++++-
> >> 1 files changed, 4 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
> >> index 12d613c..64c3812 100644
> >> --- a/drivers/ata/sata_svw.c
> >> +++ b/drivers/ata/sata_svw.c
> >> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
> >>
> >> /* Match it to a port node */
> >> index = (ap == ap->host->ports[0]) ? 0 : 1;
> >> - for (np = np->child; np != NULL; np = np->sibling) {
> >> +
> >> + for (np = of_get_next_child(np, NULL);
> >> + np != NULL;
> >> + np = of_get_next_child(np, np)) {
> >> const u32 *reg = of_get_property(np, "reg", NULL);
>
> This sort of thing I would prefer to ACK (ACK!), and let it go upstream
> via the powerpc tree.
Sure thing, just ACK (ACK!) (ACK?) it, and I'll pester paulus to merge
it via his tree.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Jeff Garzik @ 2007-10-24 6:04 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev
In-Reply-To: <1193202117.2085.45.camel@pasglop>
Benjamin Herrenschmidt wrote:
> On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
>> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
>> children for a property, this is not safe WRT refcounting, so fix it
>> to use of_get_next_child().
>>
>> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> (Pending you test boot it on one of our G5s first !)
>
>> ---
>> drivers/ata/sata_svw.c | 5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
>> index 12d613c..64c3812 100644
>> --- a/drivers/ata/sata_svw.c
>> +++ b/drivers/ata/sata_svw.c
>> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
>>
>> /* Match it to a port node */
>> index = (ap == ap->host->ports[0]) ? 0 : 1;
>> - for (np = np->child; np != NULL; np = np->sibling) {
>> +
>> + for (np = of_get_next_child(np, NULL);
>> + np != NULL;
>> + np = of_get_next_child(np, np)) {
>> const u32 *reg = of_get_property(np, "reg", NULL);
This sort of thing I would prefer to ACK (ACK!), and let it go upstream
via the powerpc tree.
Jeff
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Michael Ellerman @ 2007-10-24 5:31 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, jgarzik
In-Reply-To: <1193202117.2085.45.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 845 bytes --]
On Wed, 2007-10-24 at 15:01 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> > k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> > children for a property, this is not safe WRT refcounting, so fix it
> > to use of_get_next_child().
> >
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> (Pending you test boot it on one of our G5s first !)
As if I'd send untested patches !!
...
It just booted and seems happy.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] mpc5200: psc-spi driver must not touch port_config or cdm registers
From: Grant Likely @ 2007-10-24 5:27 UTC (permalink / raw)
To: Domen Puncer; +Cc: linuxppc-dev, Dragos Carp, dbrownell, linux-kernel
In-Reply-To: <20071024050100.GA3369@nd47.coderock.org>
On 10/23/07, Domen Puncer <domen.puncer@telargo.com> wrote:
> On 23/10/07 21:39 -0600, Grant Likely wrote:
> > From: Grant Likely <grant.likely@secretlab.ca>
> >
> > port_config and the cdm are the responsibility of firmware; and if
> > firmware doesn't set it up correctly, it should be fixed up by
> > platform code on a per-board basis because it's a property of the
> > board.
> >
> > Drivers should never touch these registers. They are completely
> > unprotected and the platform may do odd things with them that the
> > driver must not interfere with.
> >
> > Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> > ---
> >
> > Domen, Dragos; can you please check your usage of this driver. None of
> > the in-tree board ports use it as-is, but they are of course just a
> > device tree change away from being usable on the lite5200b.
>
> My test cases were just a jumper on RX-TX line.
>
> It's not even allowed to set mclken_div_pscX?
> There can be different speed devices on same SPI
> (spi_board_info->max_speed_hz).
Nope; do it in the platform code or a cdm driver. Otherwise there is
no protection against collisions on the cdm registers. The driver
could call a platform hook to fiddle with clocking, but it must not
touch it directly.
(BTW, I don't intended to push this version of the patch; I just want
to get everyone's brain juices flowing to figure out the best way to
solve it.)
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [PATCH] mpc5200: psc-spi driver must not touch port_config or cdm registers
From: Domen Puncer @ 2007-10-24 5:01 UTC (permalink / raw)
To: Grant Likely
Cc: linuxppc-dev, Dragos Carp, dbrownell, linux-kernel, domen.puncer
In-Reply-To: <20071024033457.8657.8708.stgit@trillian.cg.shawcable.net>
On 23/10/07 21:39 -0600, Grant Likely wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> port_config and the cdm are the responsibility of firmware; and if
> firmware doesn't set it up correctly, it should be fixed up by
> platform code on a per-board basis because it's a property of the
> board.
>
> Drivers should never touch these registers. They are completely
> unprotected and the platform may do odd things with them that the
> driver must not interfere with.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
> Domen, Dragos; can you please check your usage of this driver. None of
> the in-tree board ports use it as-is, but they are of course just a
> device tree change away from being usable on the lite5200b.
My test cases were just a jumper on RX-TX line.
It's not even allowed to set mclken_div_pscX?
There can be different speed devices on same SPI
(spi_board_info->max_speed_hz).
>
> Board ports that use it need to be modified to make the cdm/port_config
> changes in firmware (prefered) or in arch/powerpc/platforms/52xx/<board>.c
>
> Cheers,
> g.
>
> drivers/spi/mpc52xx_psc_spi.c | 77 +----------------------------------------
> 1 files changed, 2 insertions(+), 75 deletions(-)
>
> diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
> index 7051e6c..ec3a618 100644
> --- a/drivers/spi/mpc52xx_psc_spi.c
> +++ b/drivers/spi/mpc52xx_psc_spi.c
> @@ -328,78 +328,15 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device *spi)
> kfree(spi->controller_state);
> }
>
> -static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
> +static void mpc52xx_psc_spi_config(int psc_id, struct mpc52xx_psc_spi *mps)
> {
> - struct mpc52xx_cdm __iomem *cdm;
> - struct mpc52xx_gpio __iomem *gpio;
> struct mpc52xx_psc __iomem *psc = mps->psc;
> - u32 ul;
> u32 mclken_div;
> - int ret = 0;
> -
> -#if defined(CONFIG_PPC_MERGE)
> - cdm = mpc52xx_find_and_map("mpc5200-cdm");
> - gpio = mpc52xx_find_and_map("mpc5200-gpio");
> -#else
> - cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
> - gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
> -#endif
> - if (!cdm || !gpio) {
> - printk(KERN_ERR "Error mapping CDM/GPIO\n");
> - ret = -EFAULT;
> - goto unmap_regs;
> - }
>
> /* default sysclk is 512MHz */
> mclken_div = 0x8000 |
> (((mps->sysclk ? mps->sysclk : 512000000) / MCLK) & 0x1FF);
It's actually 528e6, and mclken_div doesn't seem to be used anywhere anymore.
>
> - switch (psc_id) {
> - case 1:
...
Domen
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Benjamin Herrenschmidt @ 2007-10-24 5:01 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, jgarzik
In-Reply-To: <2576ec47fb43bd1f4464beb8b78adfa70bdde418.1193199877.git.michael@ellerman.id.au>
On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> children for a property, this is not safe WRT refcounting, so fix it
> to use of_get_next_child().
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
(Pending you test boot it on one of our G5s first !)
> ---
> drivers/ata/sata_svw.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
> index 12d613c..64c3812 100644
> --- a/drivers/ata/sata_svw.c
> +++ b/drivers/ata/sata_svw.c
> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
>
> /* Match it to a port node */
> index = (ap == ap->host->ports[0]) ? 0 : 1;
> - for (np = np->child; np != NULL; np = np->sibling) {
> +
> + for (np = of_get_next_child(np, NULL);
> + np != NULL;
> + np = of_get_next_child(np, np)) {
> const u32 *reg = of_get_property(np, "reg", NULL);
> if (!reg)
> continue;
^ permalink raw reply
* [PATCH] Use of_get_next_child() in riva_get_EDID_OF()
From: Michael Ellerman @ 2007-10-24 4:26 UTC (permalink / raw)
To: adaplas; +Cc: linuxppc-dev
riva_get_EDID_OF() uses its own hand-rolled loop to check a nodes
children for a property, this is not safe WRT refcounting, so fix it
to use of_get_next_child().
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
drivers/video/riva/fbdev.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 5c47968..07b6b2d 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1759,7 +1759,10 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
NVTRACE_ENTER();
dp = pci_device_to_OF_node(pd);
- for (; dp != NULL; dp = dp->child) {
+
+ for (dp = of_get_next_child(dp, NULL);
+ dp != NULL;
+ dp = of_get_next_child(dp, dp)) {
disptype = of_get_property(dp, "display-type", NULL);
if (disptype == NULL)
continue;
--
1.5.1.3.g7a33b
^ permalink raw reply related
* [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Michael Ellerman @ 2007-10-24 4:25 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, jgarzik
k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
children for a property, this is not safe WRT refcounting, so fix it
to use of_get_next_child().
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
drivers/ata/sata_svw.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 12d613c..64c3812 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
/* Match it to a port node */
index = (ap == ap->host->ports[0]) ? 0 : 1;
- for (np = np->child; np != NULL; np = np->sibling) {
+
+ for (np = of_get_next_child(np, NULL);
+ np != NULL;
+ np = of_get_next_child(np, np)) {
const u32 *reg = of_get_property(np, "reg", NULL);
if (!reg)
continue;
--
1.5.1.3.g7a33b
^ permalink raw reply related
* [PATCH] Use of_get_parent() in pci_dma_dev_setup_pSeriesLP()
From: Michael Ellerman @ 2007-10-24 4:24 UTC (permalink / raw)
To: linuxppc-dev
The loop to check parent nodes for a dma-window property in
pci_dma_dev_setup_pSeriesLP() does not use the of_* accessors and
does not properly manage refcounts, fix it to do so.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/iommu.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index be17d23..2c6fc3f 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -481,7 +481,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
{
- struct device_node *pdn, *dn;
+ struct device_node *pdn, *dn, *tmp;
struct iommu_table *tbl;
const void *dma_window = NULL;
struct pci_dn *pci;
@@ -497,18 +497,22 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
dn = pci_device_to_OF_node(dev);
DBG(" node is %s\n", dn->full_name);
- for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
- pdn = pdn->parent) {
+ pdn = of_node_get(dn);
+ while (pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table) {
dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
if (dma_window)
break;
+
+ tmp = of_get_parent(pdn);
+ of_node_put(pdn);
+ pdn = tmp;
}
if (!pdn || !PCI_DN(pdn)) {
printk(KERN_WARNING "pci_dma_dev_setup_pSeriesLP: "
"no DMA window found for pci dev=%s dn=%s\n",
pci_name(dev), dn? dn->full_name : "<null>");
- return;
+ goto out_put;
}
DBG(" parent is %s\n", pdn->full_name);
@@ -518,7 +522,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
if (dma_window == NULL || pdn->parent == NULL) {
DBG(" no dma window for device, linking to parent\n");
dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table;
- return;
+ goto out_put;
}
pci = PCI_DN(pdn);
@@ -538,6 +542,9 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
}
dev->dev.archdata.dma_data = pci->iommu_table;
+
+out_put:
+ of_node_put(pdn);
}
#else /* CONFIG_PCI */
#define pci_dma_bus_setup_pSeries NULL
--
1.5.1.3.g7a33b
^ permalink raw reply related
* [PATCH] mpc5200: psc-spi driver must not touch port_config or cdm registers
From: Grant Likely @ 2007-10-24 3:39 UTC (permalink / raw)
To: Dragos Carp, linux-kernel, dbrownell, domen.puncer, linuxppc-dev
From: Grant Likely <grant.likely@secretlab.ca>
port_config and the cdm are the responsibility of firmware; and if
firmware doesn't set it up correctly, it should be fixed up by
platform code on a per-board basis because it's a property of the
board.
Drivers should never touch these registers. They are completely
unprotected and the platform may do odd things with them that the
driver must not interfere with.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
Domen, Dragos; can you please check your usage of this driver. None of
the in-tree board ports use it as-is, but they are of course just a
device tree change away from being usable on the lite5200b.
Board ports that use it need to be modified to make the cdm/port_config
changes in firmware (prefered) or in arch/powerpc/platforms/52xx/<board>.c
Cheers,
g.
drivers/spi/mpc52xx_psc_spi.c | 77 +----------------------------------------
1 files changed, 2 insertions(+), 75 deletions(-)
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 7051e6c..ec3a618 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -328,78 +328,15 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device *spi)
kfree(spi->controller_state);
}
-static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
+static void mpc52xx_psc_spi_config(int psc_id, struct mpc52xx_psc_spi *mps)
{
- struct mpc52xx_cdm __iomem *cdm;
- struct mpc52xx_gpio __iomem *gpio;
struct mpc52xx_psc __iomem *psc = mps->psc;
- u32 ul;
u32 mclken_div;
- int ret = 0;
-
-#if defined(CONFIG_PPC_MERGE)
- cdm = mpc52xx_find_and_map("mpc5200-cdm");
- gpio = mpc52xx_find_and_map("mpc5200-gpio");
-#else
- cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
- gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
-#endif
- if (!cdm || !gpio) {
- printk(KERN_ERR "Error mapping CDM/GPIO\n");
- ret = -EFAULT;
- goto unmap_regs;
- }
/* default sysclk is 512MHz */
mclken_div = 0x8000 |
(((mps->sysclk ? mps->sysclk : 512000000) / MCLK) & 0x1FF);
- switch (psc_id) {
- case 1:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFFFFFFF8;
- ul |= 0x00000006;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc1, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000020;
- out_be32(&cdm->clk_enables, ul);
- break;
- case 2:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFFFFFF8F;
- ul |= 0x00000060;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc2, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000040;
- out_be32(&cdm->clk_enables, ul);
- break;
- case 3:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFFFFF0FF;
- ul |= 0x00000600;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc3, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000080;
- out_be32(&cdm->clk_enables, ul);
- break;
- case 6:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFF8FFFFF;
- ul |= 0x00700000;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc6, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000010;
- out_be32(&cdm->clk_enables, ul);
- break;
- default:
- ret = -EINVAL;
- goto unmap_regs;
- }
-
/* Reset the PSC into a known state */
out_8(&psc->command, MPC52xx_PSC_RST_RX);
out_8(&psc->command, MPC52xx_PSC_RST_TX);
@@ -421,14 +358,6 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
out_8(&psc->ctlr, 0x84);
mps->bits_per_word = 8;
-
-unmap_regs:
- if (cdm)
- iounmap(cdm);
- if (gpio)
- iounmap(gpio);
-
- return ret;
}
static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)
@@ -493,9 +422,7 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
if (ret)
goto free_master;
- ret = mpc52xx_psc_spi_port_config(master->bus_num, mps);
- if (ret < 0)
- goto free_irq;
+ mpc52xx_psc_spi_config(master->bus_num, mps);
spin_lock_init(&mps->lock);
init_completion(&mps->done);
^ permalink raw reply related
* Re: [PATCH] PowerPC: Add BCM5248 and Marvell 88E1111 PHY support to NEW EMAC.
From: Benjamin Herrenschmidt @ 2007-10-24 3:31 UTC (permalink / raw)
To: Valentine Barshak; +Cc: linuxppc-dev, jeff, netdev
In-Reply-To: <20071015175717.GA4602@ru.mvista.com>
On Tue, 2007-10-23 at 20:57 -0500, Valentine Barshak wrote:
> +static int m88e1111_init(struct mii_phy *phy)
> +{
> + printk("%s: Marvell 88E1111 Ethernet\n", __FUNCTION__);
> + phy_write(phy, 0x14, 0x0ce3);
> + phy_write(phy, 0x18, 0x4101);
> + phy_write(phy, 0x09, 0x0e00);
> + phy_write(phy, 0x04, 0x01e1);
> + phy_write(phy, 0x00, 0x9140);
> + phy_write(phy, 0x00, 0x1140);
> +
> + return 0;
> +}
Care to put a few comments on why the above is necessary and what it
does ?
Thanks !
Ben.
> +static struct mii_phy_ops m88e1111_phy_ops = {
> + .init = m88e1111_init,
> + .setup_aneg = genmii_setup_aneg,
> + .setup_forced = genmii_setup_forced,
> + .poll_link = genmii_poll_link,
> + .read_link = genmii_read_link
> +};
> +
> +static struct mii_phy_def m88e1111_phy_def = {
> +
> + .phy_id = 0x01410CC0,
> + .phy_id_mask = 0x0ffffff0,
> + .name = "Marvell 88E1111 Ethernet",
> + .ops = &m88e1111_phy_ops,
> +};
> +
> static struct mii_phy_def *mii_phy_table[] = {
> &cis8201_phy_def,
> + &bcm5248_phy_def,
> + &m88e1111_phy_def,
> &genmii_phy_def,
> NULL
> };
^ permalink raw reply
* Re: [PATCH 05/11] [POWERPC] TQM5200 DTS
From: David Gibson @ 2007-10-24 1:51 UTC (permalink / raw)
To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20071023231333.29359.35252.stgit@hekate.izotz.org>
On Wed, Oct 24, 2007 at 01:13:33AM +0200, Marian Balakowicz wrote:
> Add device tree source file for TQM5200 board.
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---
>
> arch/powerpc/boot/dts/tqm5200.dts | 236 +++++++++++++++++++++++++++++++++++++
> 1 files changed, 236 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/tqm5200.dts
>
>
> diff --git a/arch/powerpc/boot/dts/tqm5200.dts b/arch/powerpc/boot/dts/tqm5200.dts
> new file mode 100644
> index 0000000..01c7778
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/tqm5200.dts
> @@ -0,0 +1,236 @@
> +/*
> + * TQM5200 board Device Tree Source
[snip]
> + soc5200@f0000000 {
I thought we were moving towards calling these just /soc@address?
> + model = "fsl,mpc5200";
> + compatible = "mpc5200";
That should have a vendor prefix.
[snip]
> + serial@2000 { // PSC1
> + device_type = "serial";
> + compatible = "mpc5200-psc-uart";
> + port-number = <0>; // Logical port assignment
How are these port-number things used? The device tree shouldn't
generally contain information that isn't inherent to the hardware.
There can be reasons for hacks like this, but we should avoid them if
possible.
> + cell-index = <0>;
cell-index should only be used if the index number is used when
manipulating the hardware (e.g. if there's a global control register
which takes this number).
[snip]
> + ata@3a00 {
> + device_type = "ata";
No such thing as device_type = "ata", drop it. In general, never
include a device_type unless a binding explicitly says to do so.
[snip]
> + lpb@fc000000 {
> + model = "fsl,lpb";
> + compatible = "lpb";
Not nearly specific enough. Must include a vendor prefix at least,
and should have a lot more revision information. You should always be
able to pick the right driver with compatible alone, "model" should
generally be for human consumption, the driver shouldn't need it.
> + device_type = "lpb";
Drop this. Again, presence of a device_type property is the
exception, not the rule.
> + ranges = <0 fc000000 02000000>;
You need #address-cells and #size-cells properties, too.
[snip]
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [microblaze-uclinux] RE: [PATCH v3] Device tree bindings for Xilinx devices
From: David Gibson @ 2007-10-24 1:43 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: microblaze-uclinux, Michal Simek, Wolfgang Reissnegger,
linuxppc-dev
In-Reply-To: <20071024011525.5D8777B806D@mail165-dub.bigfish.com>
On Tue, Oct 23, 2007 at 06:15:22PM -0700, Stephen Neuendorffer wrote:
[snip]
> / {
> #address-cells = <1>;
> #size-cells = <1>;
> model = "system.mhs";
> chosen {
> bootargs = "root=/dev/xsysace/disc0/part2";
> interrupt-controller = <101>;
interrupt-controller in /chosen is obsolete. Drop it.
> } ;
> cpus {
> #address-cells = <1>;
> #cpus = <1>;
> #size-cells = <0>;
> microblaze,6.00.b@0 {
> 32-bit;
32-bit was never a specified property. Drop.
> clock-frequency = <5f5e1000>;
> d-cache-line-size = <10>;
> d-cache-size = <4000>;
> device_type = "cpu";
> i-cache-line-size = <10>;
> i-cache-size = <4000>;
> linux,boot-cpu;
linux,boot-cpu is long obsolete. Drop.
> reg = <0>;
> timebase-frequency = <1fca055>;
> xlnx,cache-byte-size = <4000>;
> xlnx,dcache-baseaddr = <50000000>;
> xlnx,dcache-byte-size = <4000>;
> xlnx,dcache-highaddr = <5fffffff>;
> xlnx,debug-enabled = <1>;
> xlnx,div-zero-exception = <1>;
> xlnx,dopb-bus-exception = <1>;
> xlnx,fpu-exception = <1>;
> xlnx,icache-baseaddr = <50000000>;
> xlnx,icache-highaddr = <5fffffff>;
> xlnx,ill-opcode-exception = <1>;
> xlnx,iopb-bus-exception = <1>;
> xlnx,number-of-pc-brk = <2>;
> xlnx,pvr = <2>;
> xlnx,unaligned-exceptions = <1>;
> xlnx,use-barrel = <1>;
> xlnx,use-dcache = <1>;
> xlnx,use-div = <1>;
> xlnx,use-fpu = <1>;
> xlnx,use-icache = <1>;
> xlnx,use-msr-instr = <1>;
> xlnx,use-pcmp-instr = <1>;
> } ;
> } ;
> memory {
> device_type = "memory";
> reg = < 50000000 10000000 >;
> } ;
> opb_v20 {
Any node with children must have #address-cells and #size-cells
properties. This one almost certainly needs 'ranges' too. If it has
any bridge control registers, it should have 'reg' also.
> compatible =
> "xlnx,opb-v20-1.10.c\0xlnx,opb-v20\0ibm,opb";
> ethernet@40c00000 {
> compatible =
> "xlnx,opb-ethernet-1.04.a\0xlnx,opb-ethernet";
> device_type = "network";
> interrupt-parent = <101>;
It would be kind of neat if you could get this to generate labels and
references, rather than explicit phandles for the interrupt tree.
> interrupts = < 1 0 >;
> reg = < 40c00000 10000 >;
> xlnx,cam-exist = <0>;
> xlnx,dev-blk-id = <0>;
> xlnx,dev-mir-enable = <0>;
> xlnx,dma-present = <1>;
> xlnx,edk-name = "Ethernet_MAC";
> xlnx,include-dev-pencoder = <0>;
> xlnx,ipif-rdfifo-depth = <4000>;
> xlnx,ipif-wrfifo-depth = <4000>;
> xlnx,jumbo-exist = <0>;
> xlnx,mac-fifo-depth = <10>;
> xlnx,mii-exist = <1>;
> xlnx,opb-clk-period-ps = <2710>;
> xlnx,reset-present = <1>;
> xlnx,rx-dre-type = <0>;
> xlnx,rx-include-csum = <0>;
> xlnx,tx-dre-type = <0>;
> xlnx,tx-include-csum = <0>;
> } ;
> interrupt-controller@41200000 {
> #interrupt-cells = <2>;
> compatible =
> "xlnx,opb-intc-1.00.c\0xlnx,opb-intc";
> interrupt-controller;
> linux,phandle = <101>;
> reg = < 41200000 10000 >;
> xlnx,edk-name = "opb_intc_0";
> } ;
> memory@50000000 {
Ok, I don't really understand why the memory node is duplicated here.
It seems to be covering the same range as the top-level /memory node.
> compatible =
> "xlnx,mch-opb-ddr2-1.02.a\0xlnx,mch-opb-ddr2";
> device_type = "memory";
> reg = < 50000000 10000000 >;
> xlnx,ddr-async-support = <1>;
> xlnx,ddr-awidth = <d>;
> xlnx,ddr-bank-awidth = <2>;
> xlnx,ddr-cas-lat = <3>;
> xlnx,ddr-col-awidth = <a>;
> xlnx,ddr-dwidth = <20>;
> xlnx,ddr-tfaw = <c350>;
> xlnx,ddr-tmrd = <61a8>;
> xlnx,ddr-tras = <15f90>;
> xlnx,ddr-trc = <fde8>;
> xlnx,ddr-trcd = <61a8>;
> xlnx,ddr-trefi = <7704c0>;
> xlnx,ddr-trfc = <1c138>;
> xlnx,ddr-trp = <4e20>;
> xlnx,ddr-trrd = <3a98>;
> xlnx,ddr-twr = <3a98>;
> xlnx,ddr-twtr = <1>;
> xlnx,edk-name = "DDR2_SDRAM_32Mx32";
> xlnx,extra-tsu = <0>;
> xlnx,idelayctrl-loc =
> "IDELAYCTRL_X0Y5-IDELAYCTRL_X0Y4-IDELAYCTRL_X0Y1-IDELAYCTRL_X0Y0";
> xlnx,include-opb-burst-support = <1>;
> xlnx,include-opb-ipif = <1>;
> xlnx,mch0-accessbuf-depth = <4>;
> xlnx,mch1-accessbuf-depth = <8>;
> xlnx,num-banks-mem = <1>;
> xlnx,num-channels = <2>;
> xlnx,num-clk-pairs = <2>;
> xlnx,num-idelayctrl = <4>;
> xlnx,reg-dimm = <0>;
> xlnx,xcl0-writexfer = <0>;
> } ;
> opb_hwicap@41300000 {
> compatible =
> "xlnx,opb-hwicap-1.10.a\0xlnx,opb-hwicap";
> reg = < 41300000 10000 >;
> xlnx,edk-name = "opb_hwicap_0";
> } ;
> opb_iic@40800000 {
> compatible =
> "xlnx,opb-iic-1.02.a\0xlnx,opb-iic";
> interrupt-parent = <101>;
> interrupts = < 2 0 >;
> reg = < 40800000 10000 >;
> xlnx,clk-freq = <5f5e100>;
> xlnx,edk-name = "IIC_EEPROM";
> xlnx,iic-freq = <186a0>;
> xlnx,ten-bit-adr = <0>;
> } ;
> opb_mdm@41400000 {
> compatible =
> "xlnx,opb-mdm-2.00.a\0xlnx,opb-mdm";
> reg = < 41400000 10000 >;
> xlnx,edk-name = "debug_module";
> xlnx,mb-dbg-ports = <1>;
> xlnx,uart-width = <8>;
> xlnx,use-uart = <1>;
> } ;
> opb_timer@41c00000 {
> compatible =
> "xlnx,opb-timer-1.00.b\0xlnx,opb-timer";
> interrupt-parent = <101>;
> interrupts = < 0 0 >;
> reg = < 41c00000 10000 >;
> xlnx,count-width = <20>;
> xlnx,edk-name = "opb_timer_1";
> xlnx,one-timer-only = <1>;
> } ;
> serial@40600000 {
> compatible =
> "xlnx,opb-uartlite-1.00.b\0xlnx,opb-uartlite";
> device_type = "serial";
> interrupt-parent = <101>;
> interrupts = < 3 0 >;
> reg = < 40600000 10000 >;
> xlnx,baudrate = <2580>;
Possibly this should be current-speed, in analogy with ns16550
devices.
> xlnx,clk-freq = <5f5e100>;
> xlnx,data-bits = <8>;
> xlnx,edk-name = "RS232_Uart_1";
> xlnx,odd-parity = <0>;
> xlnx,use-parity = <0>;
> } ;
> } ;
> } ;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox