* Re: [RFC/PATCH] Change 440GP platform to ppc440
From: Josh Boyer @ 2007-04-24 0:01 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <CE31BB28-E702-4425-A266-9D5D143A53DC@kernel.crashing.org>
On Mon, Apr 23, 2007 at 04:58:57PM -0500, Kumar Gala wrote:
>
> On Apr 20, 2007, at 7:20 PM, Paul Mackerras wrote:
>
> > Kumar Gala writes:
> >
> >> I don't see any reason the 440GP should its own platform. Posting
> >> this to
> >> see if anyone thinks otherwise.
> >
> > I recall dimly that there was some user-visible difference between the
> > 440GP and the other 440 processors, and that's why we made the
> > platform string different. I don't recall what the difference was.
>
> The 440GP seems to be a book-e userspace w/o FP. Not sure how it
> differs from other 440's. It seems like the 440EP are the only ones
> with FPUs.
Right. I don't recall ever distinguishing 440GP from any other 440 chip
without an FPU.
josh
^ permalink raw reply
* Re: [PATCH 08/10] cell: add support for proper device-tree
From: Arnd Bergmann @ 2007-04-23 23:16 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Christian Krafft, paulus, David Woodhouse
In-Reply-To: <20070423193913.253050755@arndb.de>
On Monday 23 April 2007, Arnd Bergmann wrote:
> From: Christian Krafft <krafft@de.ibm.com>
>
> This patch adds support for a proper device-tree.
> A porper device-tree on cell contains be nodes
> for each CBE containg nodes for SPEs and all the
> other special devices on it.
> Ofcourse oldschool devicetree is still supported.
>
> Signed-off-by: Christian Krafft <krafft@de.ibm.com>
> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Christian, I only now saw that there is this rather important
patch left, it never stood out as something for 2.6.21 and now
it's too late for that.
This might explain why people could not boot some hardware
with Fedora 7.
Should we try to get this in as a hotfix?
Arnd <><
^ permalink raw reply
* Re: [Cbe-oss-dev] [PATCH] 64K page support for kexec
From: Arnd Bergmann @ 2007-04-23 23:08 UTC (permalink / raw)
To: cbe-oss-dev; +Cc: paulus, linuxppc-dev
In-Reply-To: <1177365051.14873.23.camel@localhost.localdomain>
On Monday 23 April 2007, Benjamin Herrenschmidt wrote:
> On Mon, 2007-04-23 at 14:53 -0300, Luke Browning wrote:
> > This patch fixes a couple of kexec problems related to 64K page=20
> > support in the kernel. =A0kexec issues a tlbie for each pte. =A0The=20
> > parameters for the tlbie are the page size and the virtual address.
> > Support was missing for the computation of these two parameters
> > for 64K pages. =A0This patch adds that support. =A0
> >=20
> > Signed-off-by: Luke Browning <lukebrowning@us.ibm.com>
>=20
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>=20
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
It's probably more appropriate to submit the patch to=20
paulus@samba.org and linuxppc-dev@ozlabs.org since it's
not cell specific.
When you resumbmit the patch with the correct line breaks,
just add the two Acked-by: lines to your Signed-off-by:
(in case that wasn't obvious).
Arnd <><
^ permalink raw reply
* [PATCH 2/2] POWERPC: Remove global CPM mappings
From: Vitaly Bordug @ 2007-04-23 22:39 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20070423223649.4955.77579.stgit@localhost.localdomain>
Gets rid or direct IMMR accesses/dereferences for PQ SoC targets and
relevant drivers.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
---
arch/powerpc/sysdev/commproc.c | 13 +++----------
drivers/net/fs_enet/fs_enet-main.c | 7 +------
drivers/net/fs_enet/mac-scc.c | 2 +-
drivers/serial/cpm_uart/cpm_uart_cpm1.c | 6 +++++-
drivers/serial/cpm_uart/cpm_uart_cpm1.h | 2 +-
include/asm-powerpc/fs_pd.h | 9 ++++++---
include/asm-ppc/fs_pd.h | 8 ++++++++
7 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index 9b4fafd..44e63e8 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -39,15 +39,11 @@
#include <asm/tlbflush.h>
#include <asm/rheap.h>
#include <asm/prom.h>
-
#include <asm/fs_pd.h>
-#define CPM_MAP_SIZE (0x4000)
-
static void m8xx_cpm_dpinit(void);
static uint host_buffer; /* One page of host buffer */
static uint host_end; /* end + 1 */
-cpm8xx_t *cpmp; /* Pointer to comm processor space */
cpic8xx_t *cpic_reg;
static struct device_node *cpm_pic_node;
@@ -200,7 +196,7 @@ void cpm_reset(void)
cpm8xx_t *commproc;
sysconf8xx_t *siu_conf;
- commproc = (cpm8xx_t *)ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE);
+ commproc = (cpm8xx_t *)immr_map(im_cpm);
#ifdef CONFIG_UCODE_PATCH
/* Perform a reset.
@@ -213,6 +209,7 @@ void cpm_reset(void)
cpm_load_patch(commproc);
#endif
+ immr_unmap(commproc);
/* Set SDMA Bus Request priority 5.
* On 860T, this also enables FEC priority 6. I am not sure
@@ -226,10 +223,6 @@ void cpm_reset(void)
/* Reclaim the DP memory for our use. */
m8xx_cpm_dpinit();
-
- /* Tell everyone where the comm processor resides.
- */
- cpmp = commproc;
}
/* We used to do this earlier, but have to postpone as long as possible
@@ -283,7 +276,7 @@ cpm_setbrg(uint brg, uint rate)
/* This is good enough to get SMCs running.....
*/
- bp = (uint *)&cpmp->cp_brgc1;
+ bp = immr_map_size(im_cpm.cp_brgc1, 16);
bp += brg;
/* The BRG has a 12-bit counter. For really slow baud rates (or
* really fast processors), we may have to further divide by 16.
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 5bd99c6..ddf4570 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1131,13 +1131,8 @@ void *fs_enet_immap = NULL;
static int setup_immap(void)
{
- phys_addr_t paddr = 0;
- unsigned long size = 0;
-
#ifdef CONFIG_CPM1
- paddr = IMAP_ADDR;
- size = 0x10000; /* map 64K */
- fs_enet_immap = ioremap(paddr, size);
+ fs_enet_immap = immr_map(im_cpm);
#endif
#ifdef CONFIG_CPM2
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 65925b5..775f92f 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -90,7 +90,7 @@
static inline int scc_cr_cmd(struct fs_enet_private *fep, u32 op)
{
- cpm8xx_t *cpmp = &((immap_t *)fs_enet_immap)->im_cpm;
+ cpm8xx_t *cpmp = fs_enet_immap;
u32 v, ch;
int i = 0;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 925fb60..64a52c5 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -52,7 +52,9 @@
void cpm_line_cr_cmd(int line, int cmd)
{
ushort val;
- volatile cpm8xx_t *cp = cpmp;
+ volatile cpm8xx_t *cp;
+
+ cp = (cpm8xx_t *)immr_map(im_cpm);
switch (line) {
case UART_SMC1:
@@ -187,6 +189,8 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
/* Setup any dynamic params in the uart desc */
int __init cpm_uart_init_portdesc(void)
{
+ cpm8xx_t *cpmp = (cpm8xx_t *)immr_map(im_cpm);
+
pr_debug("CPM uart[-]:init portdesc\n");
cpm_uart_nr = 0;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
index a99e45e..2a64778 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.h
@@ -37,6 +37,6 @@ static inline void cpm_set_smc_fcr(volatile smc_uart_t * up)
up->smc_tfcr = SMC_EB;
}
-#define DPRAM_BASE ((unsigned char *)&cpmp->cp_dpmem[0])
+#define DPRAM_BASE ((unsigned char *)cpm_dpram_addr(0))
#endif
diff --git a/include/asm-powerpc/fs_pd.h b/include/asm-powerpc/fs_pd.h
index 77a44f9..bc75442 100644
--- a/include/asm-powerpc/fs_pd.h
+++ b/include/asm-powerpc/fs_pd.h
@@ -37,12 +37,11 @@
#ifdef CONFIG_8xx
#include <asm/8xx_immap.h>
-#include <asm/mpc8xx.h>
#define immr_map(member) \
({ \
u32 offset = offsetof(immap_t, member); \
- void *addr = ioremap (IMAP_ADDR + offset, \
+ void *addr = ioremap (get_immrbase() + offset, \
sizeof( ((immap_t*)0)->member)); \
addr; \
})
@@ -50,13 +49,17 @@
#define immr_map_size(member, size) \
({ \
u32 offset = offsetof(immap_t, member); \
- void *addr = ioremap (IMAP_ADDR + offset, size); \
+ void *addr = ioremap (get_immrbase() + offset, size); \
addr; \
})
#define immr_unmap(addr) iounmap(addr)
#endif
+#ifndef CPM_IRQ_OFFSET
+#define CPM_IRQ_OFFSET 0 /* Backword-compatibility stuff for the drivers */
+#endif
+
static inline int uart_baudrate(void)
{
return get_baudrate();
diff --git a/include/asm-ppc/fs_pd.h b/include/asm-ppc/fs_pd.h
index 8691327..b3ec063 100644
--- a/include/asm-ppc/fs_pd.h
+++ b/include/asm-ppc/fs_pd.h
@@ -29,8 +29,16 @@ static inline int uart_clock(void)
return (((bd_t *) __res)->bi_intfreq);
}
+#ifdef CONFIG_CPM2
#define cpm2_map(member) (&cpm2_immr->member)
#define cpm2_map_size(member, size) (&cpm2_immr->member)
#define cpm2_unmap(addr) do {} while(0)
+#endif
+
+#ifdef CONFIG_8xx
+#define immr_map(member) (&((immap_t *)IMAP_ADDR)->member)
+#define immr_map_size(member, size) (&((immap_t *)IMAP_ADDR)->member)
+#define immr_unmap(addr) do {} while(0)
+#endif
#endif
^ permalink raw reply related
* [PATCH 1/2] POWERPC: Remove global CPM2 mappings
From: Vitaly Bordug @ 2007-04-23 22:39 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <20070423223649.4955.77579.stgit@localhost.localdomain>
Gets rid or direct IMMR accesses/dereferences for PQ2 SoC targets and
relevant drivers.
Previous approach was to setup the specific immr offset early and make whole immr structure open via global variable/define. Now in order to access some specific immr part it has to be mapped. Along with the clarity, it deprecates many board-specific ifdefs from common drivers code as well as platform header files.
Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>
---
arch/powerpc/platforms/82xx/mpc82xx_ads.c | 6 +++-
arch/powerpc/platforms/82xx/pq2ads.h | 4 ---
arch/powerpc/sysdev/cpm2_common.c | 17 +-----------
arch/powerpc/sysdev/fsl_soc.c | 42 ++++++++++++++++++++++++-----
arch/powerpc/sysdev/fsl_soc.h | 1 +
drivers/net/fs_enet/fs_enet-main.c | 8 +++---
drivers/net/fs_enet/mac-fcc.c | 3 +-
drivers/serial/cpm_uart/cpm_uart_cpm2.h | 12 ++++----
include/asm-powerpc/fs_pd.h | 14 ++++------
9 files changed, 58 insertions(+), 49 deletions(-)
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
index 47cb09f..4902e70 100644
--- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c
@@ -46,6 +46,7 @@
#include <asm/cpm2.h>
#include <asm/udbg.h>
#include <asm/i8259.h>
+#include <asm/fs_pd.h>
#include <linux/fs_enet_pd.h>
#include <sysdev/fsl_soc.h>
@@ -615,13 +616,14 @@ static int __init mpc82xx_ads_probe(void)
static void m82xx_restart(char *cmd)
{
__volatile__ unsigned char dummy;
+ car_cpm2_t *clk = cpm2_map(im_clkrst);
local_irq_disable();
- ((cpm2_map_t *) cpm2_immr)->im_clkrst.car_rmr |= RMR_CSRE;
+ setbits32(&clk->car_rmr, RMR_CSRE);
/* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
- dummy = ((cpm2_map_t *) cpm2_immr)->im_clkrst.res[0];
+ dummy = in_8(&clk->res[0]);
printk("Restart failed\n");
while (1) ;
}
diff --git a/arch/powerpc/platforms/82xx/pq2ads.h b/arch/powerpc/platforms/82xx/pq2ads.h
index 5b5cca6..f0cd179 100644
--- a/arch/powerpc/platforms/82xx/pq2ads.h
+++ b/arch/powerpc/platforms/82xx/pq2ads.h
@@ -29,10 +29,6 @@
#define CPUINFO_VENDOR "Freescale Semiconductor"
#define CPUINFO_MACHINE "PQ2 ADS PowerPC"
-/* Backword-compatibility stuff for the drivers */
-#define CPM_MAP_ADDR ((uint)0xf0000000)
-#define CPM_IRQ_OFFSET 0
-
/* The ADS8260 has 16, 32-bit wide control/status registers, accessed
* only on word boundaries.
* Not all are used (yet), or are interesting to us (yet).
diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c
index ec26599..229a4c0 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -45,31 +45,16 @@
#include <sysdev/fsl_soc.h>
static void cpm2_dpinit(void);
-cpm_cpm2_t *cpmp; /* Pointer to comm processor space */
-
-/* We allocate this here because it is used almost exclusively for
- * the communication processor devices.
- */
-cpm2_map_t *cpm2_immr;
intctl_cpm2_t *cpm2_intctl;
-#define CPM_MAP_SIZE (0x40000) /* 256k - the PQ3 reserve this amount
- of space for CPM as it is larger
- than on PQ2 */
-
void
cpm2_reset(void)
{
- cpm2_immr = (cpm2_map_t *)ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE);
cpm2_intctl = cpm2_map(im_intctl);
/* Reclaim the DP memory for our use.
*/
cpm2_dpinit();
-
- /* Tell everyone where the comm processor resides.
- */
- cpmp = &cpm2_immr->im_cpm;
}
/* Set a baud rate generator. This needs lots of work. There are
@@ -234,7 +219,7 @@ static void cpm2_dpinit(void)
{
spin_lock_init(&cpm_dpmem_lock);
- im_dprambase = ioremap(CPM_MAP_ADDR, CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE);
+ im_dprambase = ioremap(get_cpmbase(), FCC_MEM_OFFSET(4));
/* initialize the info header */
rh_init(&cpm_dpmem_info, 1,
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 8a123c7..3c09b28 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -35,7 +35,7 @@
#include <asm/prom.h>
#include <sysdev/fsl_soc.h>
#include <mm/mmu_decl.h>
-#include <asm/cpm2.h>
+#include <asm/fs_pd.h>
extern void init_fcc_ioports(struct fs_platform_info*);
extern void init_fec_ioports(struct fs_platform_info*);
@@ -66,6 +66,30 @@ EXPORT_SYMBOL(get_immrbase);
#if defined(CONFIG_CPM2) || defined(CONFIG_8xx)
+static phys_addr_t cpmbase = -1;
+
+phys_addr_t get_cpmbase(void)
+{
+ struct device_node *cpm;
+
+ if (cpmbase != -1)
+ return cpmbase;
+
+ cpm = of_find_node_by_type(NULL, "cpm");
+ if (cpm) {
+ unsigned int size;
+ const void *prop = get_property(cpm, "reg", &size);
+
+ if (prop)
+ cpmbase = of_translate_address(cpm, prop);
+ of_node_put(cpm);
+ };
+
+ return cpmbase;
+}
+
+EXPORT_SYMBOL(get_cpmbase);
+
static u32 brgfreq = -1;
u32 get_brgfreq(void)
@@ -115,6 +139,7 @@ u32 get_baudrate(void)
}
EXPORT_SYMBOL(get_baudrate);
+
#endif /* CONFIG_CPM2 */
static int __init gfar_mdio_of_init(void)
@@ -593,6 +618,7 @@ static int __init fs_enet_of_init(void)
struct platform_device *fs_enet_dev;
struct resource res;
int ret;
+ int configured = 0;
for (np = NULL, i = 0;
(np = of_find_compatible_node(np, "network", "fs_enet")) != NULL;
@@ -693,14 +719,15 @@ static int __init fs_enet_of_init(void)
fs_enet_data.bus_id = (char*)&bus_id[(*id)];
fs_enet_data.init_ioports = init_fcc_ioports;
- mdio_bb_prop = of_get_property(phy, "bitbang", NULL);
- if (mdio_bb_prop) {
+ mdio_bb_prop = get_property(phy, "bitbang", NULL);
+ if (mdio_bb_prop && !configured) {
struct platform_device *fs_enet_mdio_bb_dev;
struct fs_mii_bb_platform_info fs_enet_mdio_bb_data;
+ struct io_port *io = cpm2_map(im_ioport);
fs_enet_mdio_bb_dev =
platform_device_register_simple("fsl-bb-mdio",
- i, NULL, 0);
+ res.start, NULL, 0);
memset(&fs_enet_mdio_bb_data, 0,
sizeof(struct fs_mii_bb_platform_info));
fs_enet_mdio_bb_data.mdio_dat.bit =
@@ -723,11 +750,11 @@ static int __init fs_enet_of_init(void)
fs_enet_mdio_bb_data.irq[31] = -1;
fs_enet_mdio_bb_data.mdio_dat.offset =
- (u32)&cpm2_immr->im_ioport.iop_pdatc;
+ (u32)&io->iop_pdatc;
fs_enet_mdio_bb_data.mdio_dir.offset =
- (u32)&cpm2_immr->im_ioport.iop_pdirc;
+ (u32)&io->iop_pdirc;
fs_enet_mdio_bb_data.mdc_dat.offset =
- (u32)&cpm2_immr->im_ioport.iop_pdatc;
+ (u32)&io->iop_pdatc;
ret = platform_device_add_data(
fs_enet_mdio_bb_dev,
@@ -735,6 +762,7 @@ static int __init fs_enet_of_init(void)
sizeof(struct fs_mii_bb_platform_info));
if (ret)
goto unreg;
+ configured++;
}
of_node_put(phy);
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 04e145b..debcfdb 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -5,6 +5,7 @@
#include <asm/mmu.h>
extern phys_addr_t get_immrbase(void);
+extern phys_addr_t get_cpmbase(void);
extern u32 get_brgfreq(void);
extern u32 get_baudrate(void);
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 4a05c14..5bd99c6 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -1136,14 +1136,14 @@ static int setup_immap(void)
#ifdef CONFIG_CPM1
paddr = IMAP_ADDR;
- size = 0x10000; /* map 64K */
+ size = 0x10000; /* map 64K */
+ fs_enet_immap = ioremap(paddr, size);
#endif
#ifdef CONFIG_CPM2
- paddr = CPM_MAP_ADDR;
- size = 0x40000; /* map 256 K */
+ fs_enet_immap = cpm2_map(im_cpm);
#endif
- fs_enet_immap = ioremap(paddr, size);
+
if (fs_enet_immap == NULL)
return -EBADF; /* XXX ahem; maybe just BUG_ON? */
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 8545e84..bd803ba 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -88,8 +88,7 @@ static inline int fcc_cr_cmd(struct fs_enet_private *fep, u32 mcn, u32 op)
{
const struct fs_platform_info *fpi = fep->fpi;
- cpm2_map_t *immap = fs_enet_immap;
- cpm_cpm2_t *cpmp = &immap->im_cpm;
+ cpm_cpm2_t *cpmp = fs_enet_immap;
u32 v;
int i;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.h b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
index 1b3219f..34978fc 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
@@ -13,12 +13,12 @@
#include <asm/cpm2.h>
/* defines for IRQs */
-#define SMC1_IRQ SIU_INT_SMC1
-#define SMC2_IRQ SIU_INT_SMC2
-#define SCC1_IRQ SIU_INT_SCC1
-#define SCC2_IRQ SIU_INT_SCC2
-#define SCC3_IRQ SIU_INT_SCC3
-#define SCC4_IRQ SIU_INT_SCC4
+#define SMC1_IRQ (CPM_IRQ_OFFSET + 0x04)
+#define SMC2_IRQ (CPM_IRQ_OFFSET + 0x05)
+#define SCC1_IRQ (CPM_IRQ_OFFSET + 0x28)
+#define SCC2_IRQ (CPM_IRQ_OFFSET + 0x29)
+#define SCC3_IRQ (CPM_IRQ_OFFSET + 0x2a)
+#define SCC4_IRQ (CPM_IRQ_OFFSET + 0x2b)
static inline void cpm_set_brg(int brg, int baud)
{
diff --git a/include/asm-powerpc/fs_pd.h b/include/asm-powerpc/fs_pd.h
index c624915..77a44f9 100644
--- a/include/asm-powerpc/fs_pd.h
+++ b/include/asm-powerpc/fs_pd.h
@@ -17,16 +17,10 @@
#ifdef CONFIG_CPM2
#include <asm/cpm2.h>
-#if defined(CONFIG_8260)
-#include <asm/mpc8260.h>
-#elif defined(CONFIG_85xx)
-#include <asm/mpc85xx.h>
-#endif
-
#define cpm2_map(member) \
({ \
u32 offset = offsetof(cpm2_map_t, member); \
- void *addr = ioremap (CPM_MAP_ADDR + offset, \
+ void *addr = ioremap (get_cpmbase() + offset, \
sizeof( ((cpm2_map_t*)0)->member)); \
addr; \
})
@@ -34,7 +28,7 @@
#define cpm2_map_size(member, size) \
({ \
u32 offset = offsetof(cpm2_map_t, member); \
- void *addr = ioremap (CPM_MAP_ADDR + offset, size); \
+ void *addr = ioremap (get_cpmbase() + offset, \
addr; \
})
@@ -73,4 +67,8 @@ static inline int uart_clock(void)
return ppc_proc_freq;
}
+#ifndef CPM_IRQ_OFFSET
+#define CPM_IRQ_OFFSET 0 /* Backword-compatibility stuff for the drivers */
+#endif
+
#endif
^ permalink raw reply related
* Re: Kernel Panic booting cdrom
From: Linas Vepstas @ 2007-04-23 22:35 UTC (permalink / raw)
To: David Huffman; +Cc: linuxppc-dev, Nathan Lynch
In-Reply-To: <46292B07.3030907@storix.com>
On Fri, Apr 20, 2007 at 02:05:11PM -0700, David Huffman wrote:
> there may be power and cooling daemons that are not running and try to
> limit the system resources by limiting the number of cpus. Does this
> sound right?
As Michael Ellerman points out, the answer is no.
The idle loop specifically uses instructions that put the
cpu into low-power mode. If you don't call the idle loop, the
cpu probably won't go into low-power mode!
> The maxcpus=1 argument was something we added to our install boot
> media years ago and few here remember why it was such a great idea. The
> power/resource management was the only thing we could come up with.
Ooh, this is worthy of tatooing onto a cluestick.
--linas
^ permalink raw reply
* Re: [RFC/PATCH] Change 440GP platform to ppc440
From: Kumar Gala @ 2007-04-23 21:58 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17961.22721.462194.785356@cargo.ozlabs.ibm.com>
On Apr 20, 2007, at 7:20 PM, Paul Mackerras wrote:
> Kumar Gala writes:
>
>> I don't see any reason the 440GP should its own platform. Posting
>> this to
>> see if anyone thinks otherwise.
>
> I recall dimly that there was some user-visible difference between the
> 440GP and the other 440 processors, and that's why we made the
> platform string different. I don't recall what the difference was.
The 440GP seems to be a book-e userspace w/o FP. Not sure how it
differs from other 440's. It seems like the 440EP are the only ones
with FPUs.
- k
^ permalink raw reply
* [PATCH 2/4 v4] powerpc: replace undocumented interface properties in dts files
From: Kim Phillips @ 2007-04-23 21:26 UTC (permalink / raw)
To: linuxppc-dev
phy-connection-type now supercedes the interface property.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
moved phy-connection-type below phy-handle
arch/powerpc/boot/dts/mpc832x_mds.dts | 2 --
arch/powerpc/boot/dts/mpc832x_rdb.dts | 2 --
arch/powerpc/boot/dts/mpc836x_mds.dts | 4 ++--
arch/powerpc/boot/dts/mpc8568mds.dts | 6 ++----
4 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index c798491..93b7606 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -306,14 +306,12 @@
interrupts = <11 8>;
reg = <3>;
device_type = "ethernet-phy";
- interface = <3>; //ENET_100_MII
};
phy4: ethernet-phy@04 {
interrupt-parent = < &ipic >;
interrupts = <12 8>;
reg = <4>;
device_type = "ethernet-phy";
- interface = <3>;
};
};
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index b55bced..be4c357 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -265,14 +265,12 @@
interrupts = <0>;
reg = <0>;
device_type = "ethernet-phy";
- interface = <3>; //ENET_100_MII
};
phy04:ethernet-phy@04 {
interrupt-parent = <&pic>;
interrupts = <0>;
reg = <4>;
device_type = "ethernet-phy";
- interface = <3>;
};
};
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 7f578eb..38c8594 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -305,6 +305,7 @@
rx-clock = <0>;
tx-clock = <19>;
phy-handle = < &phy0 >;
+ phy-connection-type = "rgmii-id";
pio-handle = < &pio1 >;
};
@@ -320,6 +321,7 @@
rx-clock = <0>;
tx-clock = <14>;
phy-handle = < &phy1 >;
+ phy-connection-type = "rgmii-id";
pio-handle = < &pio2 >;
};
@@ -335,14 +337,12 @@
interrupts = <11 8>;
reg = <0>;
device_type = "ethernet-phy";
- interface = <6>; //ENET_1000_GMII
};
phy1: ethernet-phy@01 {
interrupt-parent = < &ipic >;
interrupts = <12 8>;
reg = <1>;
device_type = "ethernet-phy";
- interface = <6>;
};
};
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 7361b36..948a3b6 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -288,6 +288,7 @@
rx-clock = <0>;
tx-clock = <19>;
phy-handle = <&qe_phy0>;
+ phy-connection-type = "gmii";
pio-handle = <&pio1>;
};
@@ -303,6 +304,7 @@
rx-clock = <0>;
tx-clock = <14>;
phy-handle = <&qe_phy1>;
+ phy-connection-type = "gmii";
pio-handle = <&pio2>;
};
@@ -320,28 +322,24 @@
interrupts = <31 1>;
reg = <0>;
device_type = "ethernet-phy";
- interface = <6>; //ENET_1000_GMII
};
qe_phy1: ethernet-phy@01 {
interrupt-parent = <&mpic>;
interrupts = <32 1>;
reg = <1>;
device_type = "ethernet-phy";
- interface = <6>;
};
qe_phy2: ethernet-phy@02 {
interrupt-parent = <&mpic>;
interrupts = <31 1>;
reg = <2>;
device_type = "ethernet-phy";
- interface = <6>; //ENET_1000_GMII
};
qe_phy3: ethernet-phy@03 {
interrupt-parent = <&mpic>;
interrupts = <32 1>;
reg = <3>;
device_type = "ethernet-phy";
- interface = <6>; //ENET_1000_GMII
};
};
--
1.5.0.3
^ permalink raw reply related
* [PATCH 1/4 v5] powerpc: document phy-connection-type property
From: Kim Phillips @ 2007-04-23 21:26 UTC (permalink / raw)
To: linuxppc-dev
Since ucc_geth is being migrated to use the phylib, the existing
(undocumented) 'interface' property is being deprecated in favour
of 'phy-connection-type'.
phy-connection-type is now maintained one-to-one with definitions
in include/linux/phy.h, albeit in the form of a string.
If not specified, "mii" is assumed.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
moved phy-connection-type below phy-handle
Documentation/powerpc/booting-without-of.txt | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 88cdb59..76b4fa0 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1562,6 +1562,9 @@ platforms are moved over to use the flattened-device-tree model.
network device. This is used by the bootwrapper to interpret
MAC addresses passed by the firmware when no information other
than indices is available to associate an address with a device.
+ - phy-connection-type : a string naming the controller/PHY interface type,
+ i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "tbi",
+ or "rtbi".
Example:
ucc@2000 {
@@ -1576,6 +1579,7 @@ platforms are moved over to use the flattened-device-tree model.
rx-clock = "none";
tx-clock = "clk9";
phy-handle = <212000>;
+ phy-connection-type = "gmii";
pio-handle = <140001>;
};
--
1.5.0.3
^ permalink raw reply related
* Re: [PATCH 1/4 v2] powerpc: document max-speed and interface-type properties
From: Segher Boessenkool @ 2007-04-23 21:24 UTC (permalink / raw)
To: Andy Fleming; +Cc: linuxppc-dev
In-Reply-To: <3C290CCE-1B71-448A-8454-0C08BCF93279@freescale.com>
>> On some configurations, what PHY to use is a runtime
>> decision, not a static thing. No device tree change
>> is necessary then.
>
> 1) Could you give me an example?
Some older (plugin) cards are like that. I don't have
model numbers handy, sorry.
> 2) So you'd be having Linux ignore the phandle, then?
No, Linux would find all the PHYs connected, via the
device tree, and handle them all within the driver.
Segher
^ permalink raw reply
* Re: [PATCH 1/4 v4] powerpc: document phy-connection-type property
From: Segher Boessenkool @ 2007-04-23 21:19 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <5c96dd623e3a6737db48ab17c3550610@kernel.crashing.org>
>> Since ucc_geth is being migrated to use the phylib, the existing
>> (undocumented) 'interface' property is being deprecated in favour
>> of 'phy-connection-type'.
>
> Okay.
To be perfectly clear about this -- the only reason to
not have it in the PHY node instead is that supposedly
a PHY can be connected on multiple different kinds of
interface at the same time (physically). Don't ask me
who designs boards like that, but there you have it.
Segher
^ permalink raw reply
* Re: [PATCH 1/4 v4] powerpc: document phy-connection-type property
From: Segher Boessenkool @ 2007-04-23 21:16 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
In-Reply-To: <20070423160621.329d1a08.kim.phillips@freescale.com>
>>> + - phy-connection-type : a string naming the controller/PHY
>>> interface type,
>>> + i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id",
>>> "tbi",
>>> + or "rtbi".
>>
>> Could you put this right after the "phy-handle" definition
>> please?
>
> phy-handle is a required property, whereas phy-connection-type is not
> (it's recommended). Are you suggesting phy-connection-type be a
> required
> property?
Oh okay, I didn't see that from context -- no, it
shouldn't be required, most controllers / PHYs don't
need that information.
Segher
^ permalink raw reply
* Re: [PATCH][RFC] PCMCIA support for 8xx using platform devices
From: Segher Boessenkool @ 2007-04-23 21:12 UTC (permalink / raw)
To: Vitaly Bordug
Cc: Christoph Hellwig, linuxppc-dev, linux-pcmcia, lkml,
Arnd Bergmann
In-Reply-To: <20070423235502.734e6e67@localhost.localdomain>
>> That's a horrible argument. Please do it properly, and let arch/ppc
>> die as it should. We shouldn't be adding anything to it anymore
>> anyway.
>>
> I understand your point, but we shouldn't trash existing bits either.
Why not? The things that haven't been ported over yet
obviously are unmaintained. If we can make the few
remaining board ports in there utterly broken, we
can finally remove arch/ppc/ completely :-)
Since nothing new gets added to arch/ppc/ anymore,
anyone who wants it can get it from an older kernel
tree, no?
[Yes, I'm half joking. No, not fully.]
Segher
^ permalink raw reply
* Re: [PATCH 1/4 v4] powerpc: document phy-connection-type property
From: Kim Phillips @ 2007-04-23 21:06 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <5c96dd623e3a6737db48ab17c3550610@kernel.crashing.org>
On Mon, 23 Apr 2007 22:59:43 +0200
Segher Boessenkool <segher@kernel.crashing.org> wrote:
> > phy-connection-type is now maintained one-to-one with definitions
> > in include/linux/phy.h, albeit in the form of a string.
>
> That's sort-of accidental though :-)
>
sure..
> > --- a/Documentation/powerpc/booting-without-of.txt
> > +++ b/Documentation/powerpc/booting-without-of.txt
> > @@ -1562,6 +1562,9 @@ platforms are moved over to use the
> > flattened-device-tree model.
> > network device. This is used by the bootwrapper to interpret
> > MAC addresses passed by the firmware when no information other
> > than indices is available to associate an address with a device.
> > + - phy-connection-type : a string naming the controller/PHY
> > interface type,
> > + i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id",
> > "tbi",
> > + or "rtbi".
>
> Could you put this right after the "phy-handle" definition
> please?
phy-handle is a required property, whereas phy-connection-type is not
(it's recommended). Are you suggesting phy-connection-type be a required
property?
>
> > @@ -1573,6 +1576,7 @@ platforms are moved over to use the
> > flattened-device-tree model.
> > interrupts = <a0 0>;
> > interrupt-parent = <700>;
> > mac-address = [ 00 04 9f 00 23 23 ];
> > + phy-connection-type = "gmii";
> > rx-clock = "none";
> > tx-clock = "clk9";
> > phy-handle = <212000>;
>
> Same here. It's nice to keep things grouped, it
> improves understanding ;-)
That's understandable. Lemme know about the above though.
Kim
^ permalink raw reply
* Re: [PATCH 1/4 v4] powerpc: document phy-connection-type property
From: Segher Boessenkool @ 2007-04-23 20:59 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
In-Reply-To: <20070423144052.261f68ad.kim.phillips@freescale.com>
> Since ucc_geth is being migrated to use the phylib, the existing
> (undocumented) 'interface' property is being deprecated in favour
> of 'phy-connection-type'.
Okay.
> phy-connection-type is now maintained one-to-one with definitions
> in include/linux/phy.h, albeit in the form of a string.
That's sort-of accidental though :-)
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
> @@ -1562,6 +1562,9 @@ platforms are moved over to use the
> flattened-device-tree model.
> network device. This is used by the bootwrapper to interpret
> MAC addresses passed by the firmware when no information other
> than indices is available to associate an address with a device.
> + - phy-connection-type : a string naming the controller/PHY
> interface type,
> + i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id",
> "tbi",
> + or "rtbi".
Could you put this right after the "phy-handle" definition
please?
> @@ -1573,6 +1576,7 @@ platforms are moved over to use the
> flattened-device-tree model.
> interrupts = <a0 0>;
> interrupt-parent = <700>;
> mac-address = [ 00 04 9f 00 23 23 ];
> + phy-connection-type = "gmii";
> rx-clock = "none";
> tx-clock = "clk9";
> phy-handle = <212000>;
Same here. It's nice to keep things grouped, it
improves understanding ;-)
Segher
^ permalink raw reply
* Re: [PATCH] powerpc pseries eeh: Convert to kthread API
From: Linas Vepstas @ 2007-04-23 20:50 UTC (permalink / raw)
To: Christoph Hellwig, Eric W. Biederman, <Andrew Morton,
containers, Oleg Nesterov, linux-kernel, Paul Mackerras,
linux-s390, linuxppc-dev
In-Reply-To: <20070422123155.GF20763@infradead.org>
On Sun, Apr 22, 2007 at 01:31:55PM +0100, Christoph Hellwig wrote:
> On Thu, Apr 19, 2007 at 01:58:45AM -0600, Eric W. Biederman wrote:
> > From: Eric W. Biederman <ebiederm@xmission.com>
> >
> > This patch modifies the startup of eehd to use kthread_run
> > not a combination of kernel_thread and daemonize. Making
> > the code slightly simpler and more maintainable.
>
> This one has the same scheme as the various s390 drivers where a thread
> is spawned using a workqueue on demand. I think we should not blindly
> convert it but think a litte more about it.
>
> The first question is obviously, is this really something we want?
> spawning kernel thread on demand without reaping them properly seems
> quite dangerous.
I'm not quite sure what the intent of this patch really is, being
at most a somewhat passing and casual user of kernel threads.
Some background may be useful: (this in reply to some comments from
Andrew Morton)
EEH events are supposed to be very rare, as they correspond to
hardware failures, typically PCI bus parity errors, but also
things like wild DMA's. The code that generates these will limit
them to no more than 6 per hour per pci device. Any more than that,
and the PCI device is permanently disabled (the sysadmin would
need to do something to recover).
The only reason for using threads here is to get the error recovery
out of an interrupt context (where errors may be detected), and then,
an hour later, decrement a counter (which is how we limit these to
6 per hour). Thread reaping is "trivial", the thread just exits
after an hour.
Since these are events rare, I've no particular concern about
performance or resource consumption. The current code seems
to work just fine. :-)
--linas
^ permalink raw reply
* Re: [PATCH][RFC] PCMCIA support for 8xx using platform devices
From: Vitaly Bordug @ 2007-04-23 19:55 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linuxppc-dev, linux-pcmcia, lkml, Arnd Bergmann
In-Reply-To: <20070423075957.GA22811@infradead.org>
On Mon, 23 Apr 2007 08:59:57 +0100
Christoph Hellwig wrote:
> On Mon, Apr 23, 2007 at 10:14:27AM +0400, Vitaly Bordug wrote:
> > On Sun, 22 Apr 2007 23:49:41 +0200
> > Arnd Bergmann wrote:
> >
> > > On Sunday 22 April 2007, Vitaly Bordug wrote:
> > > > This utilizes PCMCIA on mpc885ads and mpc866ads from
> > > > arch/powerpc. In the new approach, direct IMMR accesses from
> > > > within drivers/ were totally eliminated, that requires
> > > > hardware_enable, hardware_disable, voltage_set board-specific
> > > > functions to be moved over to BSP code section
> > > > (arch/powerpc/platforms/8xx in 885 case). There is just no way
> > > > to have both arch/ppc and arch/powerpc approaches to work
> > > > simultaneously because of that.
> > >
> > > Maybe I'm missing a key issue here, but what's the point of adding
> > > more platform_devices for stuff that is already in the device
> > > tree? Shouldn't this be made an of_platform_driver instead so you
> > > can use the existing of_device directly?
> > >
> > Was thinking of it but platform_device is better for migration
> > purposes. Hence, assuming somebody would want to have pcmcia
> > working not bothering to add whole arch/powerpc support, it can be
> > accomplished quickly.
>
> That's a horrible argument. Please do it properly, and let arch/ppc
> die as it should. We shouldn't be adding anything to it anymore
> anyway.
>
I understand your point, but we shouldn't trash existing bits either. Things are a bit different with embedded
stuff, and especially in case of 8xx, there are targets without OF-powered uboot. Bootwrapper thing might be helpful in resolving it, but not a holy tablet after all.
The main point is: current 8xx pcmcia code is a holy mess of ifdefs, direct immr accesses (assuming it is io_block_mapped 1:1) etc. And limiting pcmcia to 885ads only (the only 8xx that supports OF so far) is not good.
We have to admit, that many 8xx boards will remain in ppc/ for a while, and instead of just dropping BSP bits
I'm going to let them be refactored via pdevs (with announcement in feature removal reference) as it would take couple of hrs only. If nobody will care, then the whole 8xx pcmcia driver will be cleaned up and switched
to of_device.
Does that make sense?
--
Sincerely, Vitaly
^ permalink raw reply
* [PATCH 10/10] update cell_defconfig
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Arnd Bergmann, linuxppc-dev
In-Reply-To: <20070423193538.576702568@arndb.de>
Sync with the Kconfig changes, and enable some options for celleb
Cc: Ishizaki Kou <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Jens Osterkamp <jens@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/configs/cell_defconfig
===================================================================
--- linux-2.6.orig/arch/powerpc/configs/cell_defconfig
+++ linux-2.6/arch/powerpc/configs/cell_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-rc3
-# Fri Mar 9 23:34:53 2007
+# Linux kernel version: 2.6.21-rc6
+# Mon Apr 23 20:46:48 2007
#
CONFIG_PPC64=y
CONFIG_64BIT=y
@@ -139,11 +139,31 @@ CONFIG_PPC_MULTIPLATFORM=y
# CONFIG_PPC_PMAC is not set
# CONFIG_PPC_MAPLE is not set
# CONFIG_PPC_PASEMI is not set
+CONFIG_PPC_CELLEB=y
+CONFIG_PPC_PS3=y
+
+#
+# PS3 Platform Options
+#
+# CONFIG_PS3_ADVANCED is not set
+CONFIG_PS3_HTAB_SIZE=20
+# CONFIG_PS3_DYNAMIC_DMA is not set
+CONFIG_PS3_USE_LPAR_ADDR=y
+CONFIG_PS3_VUART=y
+CONFIG_PS3_PS3AV=y
+CONFIG_PS3_SYS_MANAGER=y
CONFIG_PPC_CELL=y
CONFIG_PPC_CELL_NATIVE=y
CONFIG_PPC_IBM_CELL_BLADE=y
-CONFIG_PPC_PS3=y
-CONFIG_PPC_CELLEB=y
+
+#
+# Cell Broadband Engine options
+#
+CONFIG_SPU_FS=m
+CONFIG_SPU_BASE=y
+CONFIG_CBE_RAS=y
+CONFIG_CBE_THERM=m
+CONFIG_CBE_CPUFREQ=m
CONFIG_PPC_NATIVE=y
CONFIG_UDBG_RTAS_CONSOLE=y
CONFIG_PPC_UDBG_BEAT=y
@@ -175,26 +195,6 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_MPIC=y
#
-# Cell Broadband Engine options
-#
-CONFIG_SPU_FS=m
-CONFIG_SPU_BASE=y
-CONFIG_CBE_RAS=y
-CONFIG_CBE_THERM=m
-CONFIG_CBE_CPUFREQ=m
-
-#
-# PS3 Platform Options
-#
-# CONFIG_PS3_ADVANCED is not set
-CONFIG_PS3_HTAB_SIZE=20
-# CONFIG_PS3_DYNAMIC_DMA is not set
-CONFIG_PS3_USE_LPAR_ADDR=y
-CONFIG_PS3_VUART=y
-CONFIG_PS3_PS3AV=y
-CONFIG_PS3_SYS_MANAGER=y
-
-#
# Kernel options
#
# CONFIG_HZ_100 is not set
@@ -534,7 +534,6 @@ CONFIG_BLK_DEV_GENERIC=y
# CONFIG_BLK_DEV_OPTI621 is not set
CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-CONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not set
CONFIG_BLK_DEV_AEC62XX=y
# CONFIG_BLK_DEV_ALI15X3 is not set
@@ -561,11 +560,10 @@ CONFIG_BLK_DEV_SIIMAGE=y
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_TC86C001 is not set
-CONFIG_BLK_DEV_IDE_CELLEB=y
+CONFIG_BLK_DEV_CELLEB=y
# CONFIG_IDE_ARM is not set
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_IVB is not set
-CONFIG_IDEDMA_AUTO=y
# CONFIG_BLK_DEV_HD is not set
#
@@ -937,7 +935,7 @@ CONFIG_UNIX98_PTYS=y
# CONFIG_LEGACY_PTYS is not set
CONFIG_HVC_DRIVER=y
CONFIG_HVC_RTAS=y
-# CONFIG_HVC_BEAT is not set
+CONFIG_HVC_BEAT=y
#
# IPMI
@@ -1482,6 +1480,8 @@ CONFIG_NLS_ISO8859_15=m
# Distributed Lock Manager
#
# CONFIG_DLM is not set
+# CONFIG_UCC_SLOW is not set
+# CONFIG_UCC_FAST is not set
#
# Library routines
@@ -1540,6 +1540,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_FAULT_INJECTION is not set
# CONFIG_DEBUG_STACKOVERFLOW is not set
# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_DEBUGGER=y
CONFIG_XMON=y
CONFIG_XMON_DEFAULT=y
--
^ permalink raw reply
* [PATCH 06/10] pmi probe device by device-type
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann, Christian Krafft
In-Reply-To: <20070423193538.576702568@arndb.de>
From: Christian Krafft <krafft@de.ibm.com>
At the moment the pmi device driver is probing for devices with
a given type and a given name. As there may be devices of
the same type but with a different name, probing should be
done also for device type only.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/sysdev/pmi.c
===================================================================
--- linux-2.6.orig/arch/powerpc/sysdev/pmi.c
+++ linux-2.6/arch/powerpc/sysdev/pmi.c
@@ -118,6 +118,7 @@ out:
static struct of_device_id pmi_match[] = {
{ .type = "ibm,pmi", .name = "ibm,pmi" },
+ { .type = "ibm,pmi" },
{},
};
--
^ permalink raw reply
* [PATCH 02/10] cbe_thermal: clean up computation of temperature
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann, Christian Krafft
In-Reply-To: <20070423193538.576702568@arndb.de>
From: Christian Krafft <krafft@de.ibm.com>
This patch introduces a little function for transforming
register values into temperature.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/cbe_thermal.c
+++ linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -31,6 +31,11 @@
#include "cbe_regs.h"
#include "spu_priv1_mmio.h"
+static inline u8 reg_to_temp(u8 reg_value)
+{
+ return ((reg_value & 0x3f) << 1) + 65;
+}
+
static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev)
{
struct spu *spu;
@@ -58,20 +63,14 @@ static u8 spu_read_register_value(struct
static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf)
{
- int value;
+ u8 value;
struct cbe_pmd_regs __iomem *pmd_regs;
pmd_regs = get_pmd_regs(sysdev);
value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1);
- /* clear all other bits */
- value &= 0x3F;
- /* temp is stored in steps of 2 degrees */
- value *= 2;
- /* base temp is 65 degrees */
- value += 65;
- return sprintf(buf, "%d\n", (int) value);
+ return sprintf(buf, "%d\n", reg_to_temp(value));
}
static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos)
@@ -82,16 +81,9 @@ static ssize_t ppe_show_temp(struct sys_
pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id);
value = in_be64(&pmd_regs->ts_ctsr2);
- /* access the corresponding byte */
- value >>= pos;
- /* clear all other bits */
- value &= 0x3F;
- /* temp is stored in steps of 2 degrees */
- value *= 2;
- /* base temp is 65 degrees */
- value += 65;
+ value = (value >> pos) & 0x3f;
- return sprintf(buf, "%d\n", (int) value);
+ return sprintf(buf, "%d\n", reg_to_temp(value));
}
--
^ permalink raw reply
* [PATCH 05/10] add check for initialized driver data to pmi driver
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann, Christian Krafft
In-Reply-To: <20070423193538.576702568@arndb.de>
From: Christian Krafft <krafft@de.ibm.com>
This patch adds a check for the private driver data to be initialized.
The bug showed up, as the caller found a pmi device by it's type.
Whereas the pmi driver probes for the type and the name.
Since the name was not as the driver expected, it did not initialize.
A more relaxed probing will be supplied with an extra patch, too.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/sysdev/pmi.c
===================================================================
--- linux-2.6.orig/arch/powerpc/sysdev/pmi.c
+++ linux-2.6/arch/powerpc/sysdev/pmi.c
@@ -279,6 +279,9 @@ void pmi_register_handler(struct of_devi
struct pmi_data *data;
data = device->dev.driver_data;
+ if (!data)
+ return;
+
spin_lock(&data->handler_spinlock);
list_add_tail(&handler->node, &data->handler);
spin_unlock(&data->handler_spinlock);
@@ -289,10 +292,12 @@ void pmi_unregister_handler(struct of_de
struct pmi_handler *handler)
{
struct pmi_data *data;
+ data = device->dev.driver_data;
- pr_debug("pmi: unregistering handler %p\n", handler);
+ if (!data)
+ return;
- data = device->dev.driver_data;
+ pr_debug("pmi: unregistering handler %p\n", handler);
spin_lock(&data->handler_spinlock);
list_del(&handler->node);
--
^ permalink raw reply
* [PATCH 08/10] cell: add support for proper device-tree
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann, Christian Krafft
In-Reply-To: <20070423193538.576702568@arndb.de>
From: Christian Krafft <krafft@de.ibm.com>
This patch adds support for a proper device-tree.
A porper device-tree on cell contains be nodes
for each CBE containg nodes for SPEs and all the
other special devices on it.
Ofcourse oldschool devicetree is still supported.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/platforms/cell/cbe_regs.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/cbe_regs.c
+++ linux-2.6/arch/powerpc/platforms/cell/cbe_regs.c
@@ -14,6 +14,8 @@
#include <asm/pgtable.h>
#include <asm/prom.h>
#include <asm/ptrace.h>
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
#include "cbe_regs.h"
@@ -27,6 +29,7 @@
static struct cbe_regs_map
{
struct device_node *cpu_node;
+ struct device_node *be_node;
struct cbe_pmd_regs __iomem *pmd_regs;
struct cbe_iic_regs __iomem *iic_regs;
struct cbe_mic_tm_regs __iomem *mic_tm_regs;
@@ -37,6 +40,7 @@ static int cbe_regs_map_count;
static struct cbe_thread_map
{
struct device_node *cpu_node;
+ struct device_node *be_node;
struct cbe_regs_map *regs;
unsigned int thread_id;
unsigned int cbe_id;
@@ -50,22 +54,29 @@ static struct cbe_regs_map *cbe_find_map
int i;
struct device_node *tmp_np;
- if (strcasecmp(np->type, "spe") == 0) {
- if (np->data == NULL) {
- /* walk up path until cpu node was found */
- tmp_np = np->parent;
- while (tmp_np != NULL && strcasecmp(tmp_np->type, "cpu") != 0)
- tmp_np = tmp_np->parent;
+ if (strcasecmp(np->type, "spe")) {
+ for (i = 0; i < cbe_regs_map_count; i++)
+ if (cbe_regs_maps[i].cpu_node == np ||
+ cbe_regs_maps[i].be_node == np)
+ return &cbe_regs_maps[i];
+ return NULL;
+ }
- np->data = cbe_find_map(tmp_np);
- }
+ if (np->data)
return np->data;
- }
- for (i = 0; i < cbe_regs_map_count; i++)
- if (cbe_regs_maps[i].cpu_node == np)
- return &cbe_regs_maps[i];
- return NULL;
+ /* walk up path until cpu or be node was found */
+ tmp_np = np;
+ do {
+ tmp_np = tmp_np->parent;
+ /* on a correct devicetree we wont get up to root */
+ BUG_ON(!tmp_np);
+ } while (strcasecmp(tmp_np->type, "cpu") &&
+ strcasecmp(tmp_np->type, "be"));
+
+ np->data = cbe_find_map(tmp_np);
+
+ return np->data;
}
struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np)
@@ -153,6 +164,67 @@ u32 cbe_node_to_cpu(int node)
}
EXPORT_SYMBOL_GPL(cbe_node_to_cpu);
+static struct device_node *cbe_get_be_node(int cpu_id)
+{
+ struct device_node *np;
+
+ for_each_node_by_type (np, "be") {
+ int len,i;
+ const phandle *cpu_handle;
+
+ cpu_handle = of_get_property(np, "cpus", &len);
+
+ for (i=0; i<len; i++)
+ if (of_find_node_by_phandle(cpu_handle[i]) == of_get_cpu_node(cpu_id, NULL))
+ return np;
+ }
+
+ return NULL;
+}
+
+void __init cbe_fill_regs_map(struct cbe_regs_map *map)
+{
+ if(map->be_node) {
+ struct device_node *be, *np;
+
+ be = map->be_node;
+
+ for_each_node_by_type(np, "pervasive")
+ if (of_get_parent(np) == be)
+ map->pmd_regs = of_iomap(np, 0);
+
+ for_each_node_by_type(np, "CBEA-Internal-Interrupt-Controller")
+ if (of_get_parent(np) == be)
+ map->iic_regs = of_iomap(np, 2);
+
+ for_each_node_by_type(np, "mic-tm")
+ if (of_get_parent(np) == be)
+ map->mic_tm_regs = of_iomap(np, 0);
+ } else {
+ struct device_node *cpu;
+ /* That hack must die die die ! */
+ const struct address_prop {
+ unsigned long address;
+ unsigned int len;
+ } __attribute__((packed)) *prop;
+
+ cpu = map->cpu_node;
+
+ prop = of_get_property(cpu, "pervasive", NULL);
+ if (prop != NULL)
+ map->pmd_regs = ioremap(prop->address, prop->len);
+
+ prop = of_get_property(cpu, "iic", NULL);
+ if (prop != NULL)
+ map->iic_regs = ioremap(prop->address, prop->len);
+
+ prop = of_get_property(cpu, "mic-tm", NULL);
+ if (prop != NULL)
+ map->mic_tm_regs = ioremap(prop->address, prop->len);
+ }
+}
+
+
void __init cbe_regs_init(void)
{
int i;
@@ -162,6 +234,7 @@ void __init cbe_regs_init(void)
/* Build local fast map of CPUs */
for_each_possible_cpu(i) {
cbe_thread_map[i].cpu_node = of_get_cpu_node(i, &thread_id);
+ cbe_thread_map[i].be_node = cbe_get_be_node(i);
cbe_thread_map[i].thread_id = thread_id;
}
@@ -170,12 +243,6 @@ void __init cbe_regs_init(void)
struct cbe_regs_map *map;
unsigned int cbe_id;
- /* That hack must die die die ! */
- const struct address_prop {
- unsigned long address;
- unsigned int len;
- } __attribute__((packed)) *prop;
-
cbe_id = cbe_regs_map_count++;
map = &cbe_regs_maps[cbe_id];
@@ -193,23 +260,14 @@ void __init cbe_regs_init(void)
if (thread->cpu_node == cpu) {
thread->regs = map;
thread->cbe_id = cbe_id;
+ map->be_node = thread->be_node;
cpu_set(i, cbe_local_mask[cbe_id]);
if(thread->thread_id == 0)
cpu_set(i, cbe_first_online_cpu);
}
}
- prop = of_get_property(cpu, "pervasive", NULL);
- if (prop != NULL)
- map->pmd_regs = ioremap(prop->address, prop->len);
-
- prop = of_get_property(cpu, "iic", NULL);
- if (prop != NULL)
- map->iic_regs = ioremap(prop->address, prop->len);
-
- prop = of_get_property(cpu, "mic-tm", NULL);
- if (prop != NULL)
- map->mic_tm_regs = ioremap(prop->address, prop->len);
+ cbe_fill_regs_map(map);
}
}
--
^ permalink raw reply
* [PATCH 03/10] cbe_thermal: add throttling attributes to cpu and spu nodes
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann, Christian Krafft
In-Reply-To: <20070423193538.576702568@arndb.de>
From: Christian Krafft <krafft@de.ibm.com>
This patch adds some attributes the cpu and spu nodes:
/sys/devices/system/[c|s]pu/[c|s]pu*/thermal/throttle_begin
/sys/devices/system/[c|s]pu/[c|s]pu*/thermal/throttle_end
/sys/devices/system/[c|s]pu/[c|s]pu*/thermal/throttle_full_stop
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/cbe_thermal.c
+++ linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c
@@ -1,6 +1,31 @@
/*
* thermal support for the cell processor
*
+ * This module adds some sysfs attributes to cpu and spu nodes.
+ * Base for measurements are the digital thermal sensors (DTS)
+ * located on the chip.
+ * The accuracy is 2 degrees, starting from 65 up to 125 degrees celsius
+ * The attributes can be found under
+ * /sys/devices/system/cpu/cpuX/thermal
+ * /sys/devices/system/spu/spuX/thermal
+ *
+ * The following attributes are added for each node:
+ * temperature:
+ * contains the current temperature measured by the DTS
+ * throttle_begin:
+ * throttling begins when temperature is greater or equal to
+ * throttle_begin. Setting this value to 125 prevents throttling.
+ * throttle_end:
+ * throttling is being ceased, if the temperature is lower than
+ * throttle_end. Due to a delay between applying throttling and
+ * a reduced temperature this value should be less than throttle_begin.
+ * A value equal to throttle_begin provides only a very little hysteresis.
+ * throttle_full_stop:
+ * If the temperatrue is greater or equal to throttle_full_stop,
+ * full throttling is applied to the cpu or spu. This value should be
+ * greater than throttle_begin and throttle_end. Setting this value to
+ * 65 prevents the unit from running code at all.
+ *
* (C) Copyright IBM Deutschland Entwicklung GmbH 2005
*
* Author: Christian Krafft <krafft@de.ibm.com>
@@ -31,9 +56,24 @@
#include "cbe_regs.h"
#include "spu_priv1_mmio.h"
+#define TEMP_MIN 65
+#define TEMP_MAX 125
+
+#define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \
+struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \
+ .attr = { .name = __stringify(_name), .mode = _mode }, \
+ .show = _prefix ## _show_ ## _name, \
+ .store = _prefix ## _store_ ## _name, \
+};
+
static inline u8 reg_to_temp(u8 reg_value)
{
- return ((reg_value & 0x3f) << 1) + 65;
+ return ((reg_value & 0x3f) << 1) + TEMP_MIN;
+}
+
+static inline u8 temp_to_reg(u8 temp)
+{
+ return ((temp - TEMP_MIN) >> 1) & 0x3f;
}
static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev)
@@ -73,6 +113,73 @@ static ssize_t spu_show_temp(struct sys_
return sprintf(buf, "%d\n", reg_to_temp(value));
}
+static ssize_t show_throttle(struct cbe_pmd_regs __iomem *pmd_regs, char *buf, int pos)
+{
+ u64 value;
+
+ value = in_be64(&pmd_regs->tm_tpr.val);
+ /* access the corresponding byte */
+ value >>= pos;
+ value &= 0x3F;
+
+ return sprintf(buf, "%d\n", reg_to_temp(value));
+}
+
+static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos)
+{
+ u64 reg_value;
+ int temp;
+ u64 new_value;
+ int ret;
+
+ ret = sscanf(buf, "%u", &temp);
+
+ if (ret != 1 || temp < TEMP_MIN || temp > TEMP_MAX)
+ return -EINVAL;
+
+ new_value = temp_to_reg(temp);
+
+ reg_value = in_be64(&pmd_regs->tm_tpr.val);
+
+ /* zero out bits for new value */
+ reg_value &= ~(0xffull << pos);
+ /* set bits to new value */
+ reg_value |= new_value << pos;
+
+ out_be64(&pmd_regs->tm_tpr.val, reg_value);
+ return size;
+}
+
+static ssize_t spu_show_throttle_end(struct sys_device *sysdev, char *buf)
+{
+ return show_throttle(get_pmd_regs(sysdev), buf, 0);
+}
+
+static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, char *buf)
+{
+ return show_throttle(get_pmd_regs(sysdev), buf, 8);
+}
+
+static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, char *buf)
+{
+ return show_throttle(get_pmd_regs(sysdev), buf, 16);
+}
+
+static ssize_t spu_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size)
+{
+ return store_throttle(get_pmd_regs(sysdev), buf, size, 0);
+}
+
+static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size)
+{
+ return store_throttle(get_pmd_regs(sysdev), buf, size, 8);
+}
+
+static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size)
+{
+ return store_throttle(get_pmd_regs(sysdev), buf, size, 16);
+}
+
static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos)
{
struct cbe_pmd_regs __iomem *pmd_regs;
@@ -100,13 +207,52 @@ static ssize_t ppe_show_temp1(struct sys
return ppe_show_temp(sysdev, buf, 0);
}
+static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, char *buf)
+{
+ return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32);
+}
+
+static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, char *buf)
+{
+ return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40);
+}
+
+static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, char *buf)
+{
+ return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48);
+}
+
+static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size)
+{
+ return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32);
+}
+
+static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size)
+{
+ return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40);
+}
+
+static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size)
+{
+ return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48);
+}
+
+
static struct sysdev_attribute attr_spu_temperature = {
.attr = {.name = "temperature", .mode = 0400 },
.show = spu_show_temp,
};
+static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600);
+static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600);
+static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600);
+
+
static struct attribute *spu_attributes[] = {
&attr_spu_temperature.attr,
+ &attr_spu_throttle_end.attr,
+ &attr_spu_throttle_begin.attr,
+ &attr_spu_throttle_full_stop.attr,
NULL,
};
@@ -125,9 +271,16 @@ static struct sysdev_attribute attr_ppe_
.show = ppe_show_temp1,
};
+static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600);
+static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600);
+static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600);
+
static struct attribute *ppe_attributes[] = {
&attr_ppe_temperature0.attr,
&attr_ppe_temperature1.attr,
+ &attr_ppe_throttle_end.attr,
+ &attr_ppe_throttle_begin.attr,
+ &attr_ppe_throttle_full_stop.attr,
NULL,
};
--
^ permalink raw reply
* [PATCH 04/10] cell: use pmi in cpufreq driver
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann, Christian Krafft
In-Reply-To: <20070423193538.576702568@arndb.de>
From: Christian Krafft <krafft@de.ibm.com>
The new PMI driver was added in order to support
cpufreq on blades that require the frequency to
be controlled by the service processor, so use it
on those.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
---
Index: linux-2.6/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ linux-2.6/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -28,6 +28,8 @@
#include <asm/processor.h>
#include <asm/prom.h>
#include <asm/time.h>
+#include <asm/pmi.h>
+#include <asm/of_platform.h>
#include "cbe_regs.h"
@@ -68,6 +70,38 @@ static u64 MIC_Slow_Next_Timer_table[] =
* hardware specific functions
*/
+static struct of_device *pmi_dev;
+
+static int set_pmode_pmi(int cpu, unsigned int pmode)
+{
+ int ret;
+ pmi_message_t pmi_msg;
+#ifdef DEBUG
+ u64 time;
+#endif
+
+ pmi_msg.type = PMI_TYPE_FREQ_CHANGE;
+ pmi_msg.data1 = cbe_cpu_to_node(cpu);
+ pmi_msg.data2 = pmode;
+
+#ifdef DEBUG
+ time = (u64) get_cycles();
+#endif
+
+ pmi_send_message(pmi_dev, pmi_msg);
+ ret = pmi_msg.data2;
+
+ pr_debug("PMI returned slow mode %d\n", ret);
+
+#ifdef DEBUG
+ time = (u64) get_cycles() - time; /* actual cycles (not cpu cycles!) */
+ time = 1000000000 * time / CLOCK_TICK_RATE; /* time in ns (10^-9) */
+ pr_debug("had to wait %lu ns for a transition\n", time);
+#endif
+ return ret;
+}
+
+
static int get_pmode(int cpu)
{
int ret;
@@ -79,7 +113,7 @@ static int get_pmode(int cpu)
return ret;
}
-static int set_pmode(int cpu, unsigned int pmode)
+static int set_pmode_reg(int cpu, unsigned int pmode)
{
struct cbe_pmd_regs __iomem *pmd_regs;
struct cbe_mic_tm_regs __iomem *mic_tm_regs;
@@ -120,6 +154,39 @@ static int set_pmode(int cpu, unsigned i
return 0;
}
+static int set_pmode(int cpu, unsigned int slow_mode) {
+ if(pmi_dev)
+ return set_pmode_pmi(cpu, slow_mode);
+ else
+ return set_pmode_reg(cpu, slow_mode);
+}
+
+static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
+{
+ struct cpufreq_policy policy;
+ u8 cpu;
+ u8 cbe_pmode_new;
+
+ BUG_ON (pmi_msg.type != PMI_TYPE_FREQ_CHANGE);
+
+ cpu = cbe_node_to_cpu(pmi_msg.data1);
+ cbe_pmode_new = pmi_msg.data2;
+
+ cpufreq_get_policy(&policy, cpu);
+
+ policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency);
+ policy.min = min(policy.min, policy.max);
+
+ pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max);
+ cpufreq_set_policy(&policy);
+}
+
+static struct pmi_handler cbe_pmi_handler = {
+ .type = PMI_TYPE_FREQ_CHANGE,
+ .handle_pmi_message = cbe_cpufreq_handle_pmi,
+};
+
+
/*
* cpufreq functions
*/
@@ -234,11 +301,23 @@ static struct cpufreq_driver cbe_cpufreq
static int __init cbe_cpufreq_init(void)
{
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "ibm,pmi");
+
+ pmi_dev = of_find_device_by_node(np);
+
+ if (pmi_dev)
+ pmi_register_handler(pmi_dev, &cbe_pmi_handler);
+
return cpufreq_register_driver(&cbe_cpufreq_driver);
}
static void __exit cbe_cpufreq_exit(void)
{
+ if(pmi_dev)
+ pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
+
cpufreq_unregister_driver(&cbe_cpufreq_driver);
}
--
^ permalink raw reply
* [PATCH 07/10] add of_iomap function
From: Arnd Bergmann @ 2007-04-23 19:35 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, Arnd Bergmann, Christian Krafft
In-Reply-To: <20070423193538.576702568@arndb.de>
From: Christian Krafft <krafft@de.ibm.com>
The of_iomap function maps memory for a given
device_node and returns a pointer to that memory.
This is used at some places, so it makes sense to
a seperate function.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linux-2.6/arch/powerpc/sysdev/pmi.c
===================================================================
--- linux-2.6.orig/arch/powerpc/sysdev/pmi.c
+++ linux-2.6/arch/powerpc/sysdev/pmi.c
@@ -33,7 +33,7 @@
#include <asm/of_platform.h>
#include <asm/io.h>
#include <asm/pmi.h>
-
+#include <asm/prom.h>
struct pmi_data {
struct list_head handler;
@@ -49,21 +49,6 @@ struct pmi_data {
};
-
-static void __iomem *of_iomap(struct device_node *np)
-{
- struct resource res;
-
- if (of_address_to_resource(np, 0, &res))
- return NULL;
-
- pr_debug("Resource start: 0x%lx\n", res.start);
- pr_debug("Resource end: 0x%lx\n", res.end);
-
- return ioremap(res.start, 1 + res.end - res.start);
-}
-
-
static int pmi_irq_handler(int irq, void *dev_id)
{
struct pmi_data *data;
@@ -154,7 +139,7 @@ static int pmi_of_probe(struct of_device
goto out;
}
- data->pmi_reg = of_iomap(np);
+ data->pmi_reg = of_iomap(np, 0);
if (!data->pmi_reg) {
printk(KERN_ERR "pmi: invalid register address.\n");
rc = -EFAULT;
Index: linux-2.6/include/asm-powerpc/prom.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/prom.h
+++ linux-2.6/include/asm-powerpc/prom.h
@@ -20,6 +20,7 @@
#include <linux/platform_device.h>
#include <asm/irq.h>
#include <asm/atomic.h>
+#include <asm/io.h>
/* Definitions used by the flattened device tree */
#define OF_DT_HEADER 0xd00dfeed /* marker */
@@ -355,6 +356,16 @@ static inline int of_irq_to_resource(str
return irq;
}
+static inline void __iomem *of_iomap(struct device_node *np, int index)
+{
+ struct resource res;
+
+ if (of_address_to_resource(np, index, &res))
+ return NULL;
+
+ return ioremap(res.start, 1 + res.end - res.start);
+}
+
#endif /* __KERNEL__ */
#endif /* _POWERPC_PROM_H */
--
^ 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