* Small cleanups to the cuboot bootwrapper code
From: David Gibson @ 2007-04-27 2:01 UTC (permalink / raw)
To: Paul Mackerras, Scott Wood; +Cc: linuxppc-dev
This patch makes a few small cleanups to the cuboot code.
- It removes the double layered selection of images, via
cuboot-plat-y, instead having the cuboot platforms directly select a
suitable image-y (this changes the name of the final cuboot image from
plain cuImage to cuImage.<platform>).
- Factors out some code in the wrapper that's potentially
useful to platforms other than uboot.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
arch/powerpc/boot/Makefile | 13 +++++--------
arch/powerpc/boot/wrapper | 28 +++++++++++++---------------
2 files changed, 18 insertions(+), 23 deletions(-)
Scott, I don't have the boards to test this patch with, though I think
it should be ok. If it seems ok to you, please ack, then Paul can
apply.
Index: working-2.6/arch/powerpc/boot/Makefile
===================================================================
--- working-2.6.orig/arch/powerpc/boot/Makefile 2007-04-27 11:48:56.000000000 +1000
+++ working-2.6/arch/powerpc/boot/Makefile 2007-04-27 11:57:41.000000000 +1000
@@ -129,7 +129,8 @@ image-$(CONFIG_PPC_CELLEB) += zImage.ps
image-$(CONFIG_PPC_CHRP) += zImage.chrp
image-$(CONFIG_PPC_EFIKA) += zImage.chrp
image-$(CONFIG_PPC_PMAC) += zImage.pmac
-image-$(CONFIG_DEFAULT_UIMAGE) += uImage cuImage
+image-$(CONFIG_PPC_83xx) += cuImage.83xx
+image-$(CONFIG_DEFAULT_UIMAGE) += uImage
# For 32-bit powermacs, build the COFF and miboot images
# as well as the ELF images.
@@ -162,14 +163,11 @@ $(obj)/zImage.initrd.ps3: vmlinux
$(obj)/uImage: vmlinux $(wrapperbits)
$(call if_changed,wrap,uboot)
-cuboot-plat-$(CONFIG_83xx) += 83xx
-cuboot-plat-y += unknown-platform
-
dts = $(if $(shell echo $(CONFIG_) | grep '^/'),\
,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE)
-$(obj)/cuImage: vmlinux $(wrapperbits)
- $(call if_changed,wrap,cuboot-$(word 1,$(cuboot-plat-y)),$(dts))
+$(obj)/cuImage.%: vmlinux $(wrapperbits)
+ $(call if_changed,wrap,cuboot-$*,$(dts))
$(obj)/zImage: $(addprefix $(obj)/, $(image-y))
@rm -f $@; ln $< $@
@@ -180,8 +178,7 @@ install: $(CONFIGURE) $(image-y)
sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" $<
# anything not in $(targets)
-clean-files += $(image-) $(initrd-) zImage zImage.initrd \
- cuImage.elf cuImage.bin.gz
+clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.*
# clean up files cached by wrapper
clean-kernel := vmlinux.strip vmlinux.bin
Index: working-2.6/arch/powerpc/boot/wrapper
===================================================================
--- working-2.6.orig/arch/powerpc/boot/wrapper 2007-04-26 13:57:24.000000000 +1000
+++ working-2.6/arch/powerpc/boot/wrapper 2007-04-27 11:57:41.000000000 +1000
@@ -163,20 +163,19 @@ fi
vmz="$vmz$gzip"
-case "$platform" in
-uboot|cuboot*)
- version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
- cut -d' ' -f3`
- if [ -n "$version" ]; then
- version="-n Linux-$version"
- fi
-esac
+# Extract kernel version information, some platforms want to include
+# it in the image header
+version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
+ cut -d' ' -f3`
+if [ -n "$version" ]; then
+ uboot_version="-n Linux-$version"
+fi
case "$platform" in
uboot)
rm -f "$ofile"
mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
- $version -d "$vmz" "$ofile"
+ $uboot_version -d "$vmz" "$ofile"
if [ -z "$cacheit" ]; then
rm -f "$vmz"
fi
@@ -212,25 +211,24 @@ if [ "$platform" != "miboot" ]; then
rm $tmp
fi
+# Some platforms need the zImage's entry point and base address
+base=0x`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
+entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | cut -d' ' -f3`
+
# post-processing needed for some platforms
case "$platform" in
pseries|chrp)
$object/addnote "$ofile"
;;
pmaccoff)
- entry=`objdump -f "$ofile" | grep '^start address ' | \
- cut -d' ' -f3`
${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
$object/hack-coff "$ofile"
;;
cuboot*)
- base=`${CROSS}nm "$ofile" | grep ' _start$' | cut -d' ' -f1`
- entry=`${CROSS}objdump -f "$ofile" | grep '^start address ' | \
- cut -d' ' -f3`
mv "$ofile" "$ofile".elf
${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin
gzip -f -9 "$ofile".bin
mkimage -A ppc -O linux -T kernel -C gzip -a "$base" -e "$entry" \
- $version -d "$ofile".bin.gz "$ofile"
+ $uboot_version -d "$ofile".bin.gz "$ofile"
;;
esac
--
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] [POWERPC] Rename get_property to of_get_property: partial drivers
From: Stephen Rothwell @ 2007-04-27 3:41 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
In-Reply-To: <20070403224205.807cffe0.sfr@canb.auug.org.au>
This does dirvers/machintosh and the hvc code.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/char/hvc_iseries.c | 2 +-
drivers/char/hvc_vio.c | 2 +-
drivers/char/hvsi.c | 4 ++--
drivers/macintosh/macio_asic.c | 2 +-
drivers/macintosh/macio_sysfs.c | 4 ++--
drivers/macintosh/rack-meter.c | 2 +-
drivers/macintosh/smu.c | 6 +++---
drivers/macintosh/therm_adt746x.c | 8 ++++----
drivers/macintosh/therm_pm72.c | 8 ++++----
drivers/macintosh/therm_windtunnel.c | 2 +-
drivers/macintosh/via-cuda.c | 2 +-
drivers/macintosh/via-pmu-led.c | 2 +-
drivers/macintosh/via-pmu.c | 6 +++---
drivers/macintosh/windfarm_lm75_sensor.c | 2 +-
drivers/macintosh/windfarm_max6690_sensor.c | 2 +-
drivers/macintosh/windfarm_smu_controls.c | 8 ++++----
drivers/macintosh/windfarm_smu_sat.c | 8 ++++----
drivers/macintosh/windfarm_smu_sensors.c | 6 +++---
18 files changed, 38 insertions(+), 38 deletions(-)
Paul,
This is on top of your reversion of
d05c7a80cf39ae7d0f8d0c3e47c93d51fcd393d3.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c
index f144a94..ec420fe 100644
--- a/drivers/char/hvc_iseries.c
+++ b/drivers/char/hvc_iseries.c
@@ -575,7 +575,7 @@ static int hvc_find_vtys(void)
(num_found >= VTTY_PORTS))
break;
- vtermno = get_property(vty, "reg", NULL);
+ vtermno = of_get_property(vty, "reg", NULL);
if (!vtermno)
continue;
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c
index f9c0084..94a542e 100644
--- a/drivers/char/hvc_vio.c
+++ b/drivers/char/hvc_vio.c
@@ -153,7 +153,7 @@ static int hvc_find_vtys(void)
if (num_found >= MAX_NR_HVC_CONSOLES)
break;
- vtermno = get_property(vty, "reg", NULL);
+ vtermno = of_get_property(vty, "reg", NULL);
if (!vtermno)
continue;
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index 50315d6..d5a752d 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1279,8 +1279,8 @@ static int __init hvsi_console_init(void)
struct hvsi_struct *hp;
const uint32_t *vtermno, *irq;
- vtermno = get_property(vty, "reg", NULL);
- irq = get_property(vty, "interrupts", NULL);
+ vtermno = of_get_property(vty, "reg", NULL);
+ irq = of_get_property(vty, "interrupts", NULL);
if (!vtermno || !irq)
continue;
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index e851266..c96b7fe 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -395,7 +395,7 @@ static struct macio_dev * macio_add_one_device(struct macio_chip *chip,
#endif
MAX_NODE_NAME_SIZE, np->name);
} else {
- reg = get_property(np, "reg", NULL);
+ reg = of_get_property(np, "reg", NULL);
sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s",
chip->lbus.index,
reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index 0a5647f..cc82679 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -21,7 +21,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
int length = 0;
of = &to_macio_device (dev)->ofdev;
- compat = get_property(of->node, "compatible", &cplen);
+ compat = of_get_property(of->node, "compatible", &cplen);
if (!compat) {
*buf = '\0';
return 0;
@@ -47,7 +47,7 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
int length;
of = &to_macio_device (dev)->ofdev;
- compat = get_property(of->node, "compatible", &cplen);
+ compat = of_get_property(of->node, "compatible", &cplen);
if (!compat) compat = "", cplen = 1;
length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type);
buf += length;
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index f83fad2..4177ff0 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -387,7 +387,7 @@ static int __devinit rackmeter_probe(struct macio_dev* mdev,
if (strcmp(np->name, "lightshow") == 0)
break;
if ((strcmp(np->name, "sound") == 0) &&
- get_property(np, "virtual", NULL) != NULL)
+ of_get_property(np, "virtual", NULL) != NULL)
break;
}
if (np == NULL) {
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 45bb3c1..135f22e 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -491,7 +491,7 @@ int __init smu_init (void)
printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n");
goto fail;
}
- data = get_property(smu->db_node, "reg", NULL);
+ data = of_get_property(smu->db_node, "reg", NULL);
if (data == NULL) {
of_node_put(smu->db_node);
smu->db_node = NULL;
@@ -512,7 +512,7 @@ int __init smu_init (void)
smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt");
if (smu->msg_node == NULL)
break;
- data = get_property(smu->msg_node, "reg", NULL);
+ data = of_get_property(smu->msg_node, "reg", NULL);
if (data == NULL) {
of_node_put(smu->msg_node);
smu->msg_node = NULL;
@@ -1004,7 +1004,7 @@ const struct smu_sdbp_header *__smu_get_sdb_partition(int id,
} else
mutex_lock(&smu_part_access);
- part = get_property(smu->of_node, pname, size);
+ part = of_get_property(smu->of_node, pname, size);
if (part == NULL) {
DPRINTK("trying to extract from SMU ...\n");
part = smu_create_sdb_partition(id);
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
index a7ce559..2289034 100644
--- a/drivers/macintosh/therm_adt746x.c
+++ b/drivers/macintosh/therm_adt746x.c
@@ -567,13 +567,13 @@ thermostat_init(void)
else
return -ENODEV;
- prop = get_property(np, "hwsensor-params-version", NULL);
+ prop = of_get_property(np, "hwsensor-params-version", NULL);
printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop,
(*prop == 1)?"":"un");
if (*prop != 1)
return -ENODEV;
- prop = get_property(np, "reg", NULL);
+ prop = of_get_property(np, "reg", NULL);
if (!prop)
return -ENODEV;
@@ -591,9 +591,9 @@ thermostat_init(void)
"limit_adjust: %d, fan_speed: %d\n",
therm_bus, therm_address, limit_adjust, fan_speed);
- if (get_property(np, "hwsensor-location", NULL)) {
+ if (of_get_property(np, "hwsensor-location", NULL)) {
for (i = 0; i < 3; i++) {
- sensor_location[i] = get_property(np,
+ sensor_location[i] = of_get_property(np,
"hwsensor-location", NULL) + offset;
if (sensor_location[i] == NULL)
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index 2e4ad44..78ff186 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -674,7 +674,7 @@ static int read_eeprom(int cpu, struct mpu_data *out)
printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n");
return -ENODEV;
}
- data = get_property(np, "cpuid", &len);
+ data = of_get_property(np, "cpuid", &len);
if (data == NULL) {
printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n");
of_node_put(np);
@@ -1337,7 +1337,7 @@ static int init_backside_state(struct backside_pid_state *state)
*/
u3 = of_find_node_by_path("/u3@0,f8000000");
if (u3 != NULL) {
- const u32 *vers = get_property(u3, "device-rev", NULL);
+ const u32 *vers = of_get_property(u3, "device-rev", NULL);
if (vers)
if (((*vers) & 0x3f) < 0x34)
u3h = 0;
@@ -2129,8 +2129,8 @@ static void fcu_lookup_fans(struct device_node *fcu_node)
continue;
/* Lookup for a matching location */
- loc = get_property(np, "location", NULL);
- reg = get_property(np, "reg", NULL);
+ loc = of_get_property(np, "location", NULL);
+ reg = of_get_property(np, "reg", NULL);
if (loc == NULL || reg == NULL)
continue;
DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg);
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c
index a1d3a98..35233de 100644
--- a/drivers/macintosh/therm_windtunnel.c
+++ b/drivers/macintosh/therm_windtunnel.c
@@ -492,7 +492,7 @@ g4fan_init( void )
if( !(np=of_find_node_by_name(NULL, "power-mgt")) )
return -ENODEV;
- info = get_property(np, "thermal-info", NULL);
+ info = of_get_property(np, "thermal-info", NULL);
of_node_put(np);
if( !info || !machine_is_compatible("PowerMac3,6") )
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index d58fcf6..76d2177 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -131,7 +131,7 @@ int __init find_via_cuda(void)
if (vias == 0)
return 0;
- reg = get_property(vias, "reg", NULL);
+ reg = of_get_property(vias, "reg", NULL);
if (reg == NULL) {
printk(KERN_ERR "via-cuda: No \"reg\" property !\n");
goto fail;
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index f8d7a46..fc89a70 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -118,7 +118,7 @@ static int __init via_pmu_led_init(void)
dt = of_find_node_by_path("/");
if (dt == NULL)
return -ENODEV;
- model = get_property(dt, "model", NULL);
+ model = of_get_property(dt, "model", NULL);
if (model == NULL)
return -ENODEV;
if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 8470210..1729d3f 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -289,7 +289,7 @@ int __init find_via_pmu(void)
if (vias == NULL)
return 0;
- reg = get_property(vias, "reg", NULL);
+ reg = of_get_property(vias, "reg", NULL);
if (reg == NULL) {
printk(KERN_ERR "via-pmu: No \"reg\" property !\n");
goto fail;
@@ -334,7 +334,7 @@ int __init find_via_pmu(void)
gpiop = of_find_node_by_name(NULL, "gpio");
if (gpiop) {
- reg = get_property(gpiop, "reg", NULL);
+ reg = of_get_property(gpiop, "reg", NULL);
if (reg)
gaddr = of_translate_address(gpiop, reg);
if (gaddr != OF_BAD_ADDR)
@@ -491,7 +491,7 @@ static int __init via_pmu_dev_init(void)
of_find_node_by_name(NULL, "power-mgt");
const u32 *prim_info = NULL;
if (prim)
- prim_info = get_property(prim, "prim-info", NULL);
+ prim_info = of_get_property(prim, "prim-info", NULL);
if (prim_info) {
/* Other stuffs here yet unknown */
pmu_battery_count = (prim_info[6] >> 16) & 0xff;
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index 3f7967f..ab4d1b6 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -176,7 +176,7 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
for (dev = NULL;
(dev = of_get_next_child(busnode, dev)) != NULL;) {
const char *loc =
- get_property(dev, "hwsensor-location", NULL);
+ of_get_property(dev, "hwsensor-location", NULL);
u8 addr;
/* We must re-match the adapter in order to properly check
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
index eae1189..eaa74af 100644
--- a/drivers/macintosh/windfarm_max6690_sensor.c
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -134,7 +134,7 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
if (!device_is_compatible(dev, "max6690"))
continue;
addr = pmac_i2c_get_dev_addr(dev);
- loc = get_property(dev, "hwsensor-location", NULL);
+ loc = of_get_property(dev, "hwsensor-location", NULL);
if (loc == NULL || addr == 0)
continue;
printk("found max6690, loc=%s addr=0x%02x\n", loc, addr);
diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
index 31b750d..ff398ad 100644
--- a/drivers/macintosh/windfarm_smu_controls.c
+++ b/drivers/macintosh/windfarm_smu_controls.c
@@ -167,7 +167,7 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
if (fct == NULL)
return NULL;
fct->ctrl.ops = &smu_fan_ops;
- l = get_property(node, "location", NULL);
+ l = of_get_property(node, "location", NULL);
if (l == NULL)
goto fail;
@@ -224,17 +224,17 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
goto fail;
/* Get min & max values*/
- v = get_property(node, "min-value", NULL);
+ v = of_get_property(node, "min-value", NULL);
if (v == NULL)
goto fail;
fct->min = *v;
- v = get_property(node, "max-value", NULL);
+ v = of_get_property(node, "max-value", NULL);
if (v == NULL)
goto fail;
fct->max = *v;
/* Get "reg" value */
- reg = get_property(node, "reg", NULL);
+ reg = of_get_property(node, "reg", NULL);
if (reg == NULL)
goto fail;
fct->reg = *reg;
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c
index 83f79de..9a6c2cf 100644
--- a/drivers/macintosh/windfarm_smu_sat.c
+++ b/drivers/macintosh/windfarm_smu_sat.c
@@ -241,7 +241,7 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
char *name;
int vsens[2], isens[2];
- reg = get_property(dev, "reg", NULL);
+ reg = of_get_property(dev, "reg", NULL);
if (reg == NULL)
return;
addr = *reg;
@@ -268,9 +268,9 @@ static void wf_sat_create(struct i2c_adapter *adapter, struct device_node *dev)
isens[0] = isens[1] = -1;
child = NULL;
while ((child = of_get_next_child(dev, child)) != NULL) {
- reg = get_property(child, "reg", NULL);
- type = get_property(child, "device_type", NULL);
- loc = get_property(child, "location", NULL);
+ reg = of_get_property(child, "reg", NULL);
+ type = of_get_property(child, "device_type", NULL);
+ loc = of_get_property(child, "location", NULL);
if (reg == NULL || loc == NULL)
continue;
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c
index 01b4c50..9c567b9 100644
--- a/drivers/macintosh/windfarm_smu_sensors.c
+++ b/drivers/macintosh/windfarm_smu_sensors.c
@@ -204,8 +204,8 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL);
if (ads == NULL)
return NULL;
- c = get_property(node, "device_type", NULL);
- l = get_property(node, "location", NULL);
+ c = of_get_property(node, "device_type", NULL);
+ l = of_get_property(node, "location", NULL);
if (c == NULL || l == NULL)
goto fail;
@@ -255,7 +255,7 @@ static struct smu_ad_sensor *smu_ads_create(struct device_node *node)
} else
goto fail;
- v = get_property(node, "reg", NULL);
+ v = of_get_property(node, "reg", NULL);
if (v == NULL)
goto fail;
ads->reg = *v;
--
1.5.1.2
^ permalink raw reply related
* [PATCH] Partialially revert a7edd0e676d51145ae634a2acf7a447e319200fa
From: Stephen Rothwell @ 2007-04-27 4:32 UTC (permalink / raw)
To: paulus; +Cc: ppc-dev
In-Reply-To: <20070403105217.7b9fea08.sfr@canb.auug.org.au>
Due to conflicts with the network drivers tree.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/net/ehea/ehea_main.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index d1a8134..0e4042b 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2320,7 +2320,7 @@ static int ehea_setup_single_port(struct ehea_port *port,
struct net_device *dev = port->netdev;
struct ehea_adapter *adapter = port->adapter;
struct hcp_ehea_port_cb4 *cb4;
- const u32 *dn_log_port_id;
+ u32 *dn_log_port_id;
int jumbo = 0;
sema_init(&port->port_lock, 1);
@@ -2336,7 +2336,7 @@ static int ehea_setup_single_port(struct ehea_port *port,
port->of_dev_node = dn;
/* Determine logical port id */
- dn_log_port_id = get_property(dn, "ibm,hea-port-no", NULL);
+ dn_log_port_id = (u32*)get_property(dn, "ibm,hea-port-no", NULL);
if (!dn_log_port_id) {
ehea_error("bad device node: dn_log_port_id=%p",
@@ -2492,7 +2492,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
const struct of_device_id *id)
{
struct ehea_adapter *adapter;
- const u64 *adapter_handle;
+ u64 *adapter_handle;
int ret;
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
@@ -2502,7 +2502,7 @@ static int __devinit ehea_probe(struct ibmebus_dev *dev,
goto out;
}
- adapter_handle = get_property(dev->ofdev.node, "ibm,hea-handle",
+ adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle",
NULL);
if (adapter_handle)
adapter->handle = *adapter_handle;
--
1.5.1.2
^ permalink raw reply related
* Re: [PATCH v3] powerpc: 64K page support for kexec
From: Milton Miller @ 2007-04-27 4:36 UTC (permalink / raw)
To: Luke Browning
Cc: Arnd Bergmann, linuxppc-dev, Paul Mackerras, Olof Johansson,
cbe-oss-dev
In-Reply-To: <1177601310.24866.94.camel@luke-laptop>
On Apr 26, 2007, at 5:23 PM, Luke Browning wrote:
> This patch fixes a couple of kexec problems related to 64K page
> support in the kernel. kexec issues a tlbie for each pte. The
> 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. This patch adds that support.
>
> Signed-off-by: Luke Browning <lukebrowning@us.ibm.com>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> - va |= vpi << PAGE_SHIFT;
> + /*
> + * FIXME, the code below works for 16M, 64K, and 4K pages as these
> + * fall under the p<=23 rules for calculating the virtual address.
> + * In the case of 16M pages, an extra bit is stolen from the AVPN
> + * field to achieve the requisite 24 bits.
> + *
> + * 16G pages are not supported by the code below.
> + */
> + BUG_ON(hpte_v & 0x4000000000000000UL); /* 1T segment */
> + BUG_ON(size == MMU_PAGE_16G);
> + BUG_ON(size == MMU_PAGE_64K_AP);
> +
> + shift = mmu_psize_defs[size].shift;
> + if (mmu_psize_defs[size].avpnm)
> + avpnm_bits = __ilog2_u64(mmu_psize_defs[size].avpnm) + 1;
> + else
> + avpnm_bits = 0;
>
I have to continue to disagree on the above BUG_ONs.
> /*
> @@ -374,15 +417,14 @@ static unsigned long slot2va(unsigned lo
> *
> * TODO: add batching support when enabled. remember, no dynamic
> memory here,
> * athough there is the control page available...
> - *
> - * XXX FIXME: 4k only for now !
> */
> static void native_hpte_clear(void)
> {
> unsigned long slot, slots, flags;
> hpte_t *hptep = htab_address;
> - unsigned long hpte_v;
> + unsigned long hpte_v, va;
> unsigned long pteg_count;
> + int psize;
>
> pteg_count = htab_hash_mask + 1;
>
> @@ -408,8 +450,9 @@ static void native_hpte_clear(void)
> * already hold the native_tlbie_lock.
> */
> if (hpte_v & HPTE_V_VALID) {
> + hpte_decode(hptep, slot, &psize, &va);
> hptep->v = 0;
> - __tlbie(slot2va(hpte_v, slot), MMU_PAGE_4K);
> + __tlbie(va, psize);
> }
> }
>
<speculation severity=minor>
I'm guessing hpte_decode is not inlined by gcc anymore? (I
didn't get a chance to try it). I believed you said
hpte_decode is basically doing two things, (1) calculating
the page size, and (2) using that additional information to
calculate the va. If we split those two functions apart,
does it change the inlining decsions?
Actually this is all optimizing an infrequent path, although
it is a path that counts as downtime.
</speculation>
Luke later wrote:
> Ben H Wrote:
>> (Have you added some debug to check we get the 16M case right ?)
>>
>> Note that Milton is against using BUG_ON's in here since that code is
>> used for crash dumps.
>
> I would prefer to leave BUG_ON()s in the code as they work in many
> cases. It depends on how far you have get in the algorithm. I added
> BUG_ON(size == 16M) which is hit after a hundred entries or so have
> been
> processed. See output below.
BUG_ON will fail as soon as you invalidate the page
containing the program_check handler, or anything leading up
to it. Since the kernel text is normally mapped with 16M
pages, it doesn't surprise me when you BUG before unmapping
any 16M pages.
It also depends on your output device. Your cell blade has
this nice real mode RTAS. Go to a real serial port and try
to debug the mess (recursive faults) when the port iomap is
unmapped.
> I also put a BUG_ON() at the end of the
> table scan but no output was presented so there are limitations, but I
> don't believe that there is a downside. The BUG_ON() at the end of the
> sequence presented the original symptom so there is no difference from
> a
> user perspective when the algorithm was completely broken.
I have had very different experiences when stopping execution, loading
a new kernel, setting the entrypoint, and starting the new kernel. I
usually die when starting init, but get through all of the kernel init
without incident. This is going from a 4k kernel to 4k kernel, with
most used drivers built in. In effect, this is doing a kexec without
any hash table clear. I've even gotten away with it when I do this
because I forgot the initramfs the first time or a driver init paniced.
> During the
> development of this feature, we encountered a lot of false hits though
> as the system continued and experienced a bunch of false symptoms. This
> is worse as it is better to have the system fail in a deterministic way
> than to fail in random way. Some of the failures that we experienced
> were dma, timer, and module initialization problems. These were all
> red
> herrings.
Was your development testing going from 64k to 64k base
kernel? Or 64k to 4k or 4k to 64k? Did your development
break 4k pages along the way?
The reason I ask is because when starting a similar kernel,
I expect any failures of invalidating the kernel linear
mapping to be mapped with the same mapping the next time.
If you were going to a dissimilar kernel, or possibly a
modular kernel with modules loaded in random order, I would
expect incorrect io-mapping and vmalloc could also pose
problems you mentioned.
It appears the distros want to use a similar kernel for
their dump kernel. The would prefer it be the same binary;
I'm trying to influence people that it is a softer requirement
than not slowing down the primary kernel.
> Having BUG_ONs in the code allows developers to make
> assertions about the code which is important when diagnosing strange
> system crashes and provides a clue to future developers that they need
> to add support for something. Comments are fine, but asserts are
> better
> in that they show up in cscope and other development tools. So all
> things considered I think it is better to include them.
I think a better way to debug this code is to call it from a
debugfs hook or xmon dump command to scan the table and do
the computation. That code would have the full debugger to
notice and print the assert.
Having a xmon function to dump the hash table or a slot
might be useful for other purposes.
If you think you need the assert, then I ask it be put under
an ifdef or it not be triggered when kexec is called with
panic=1 (ie BUG_ON(x && !panic). Alternatively you could
run the table with dry-run sometime between cpu_down and the
kernel copy.
> > Appart from that,
> >
> > Acked-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> >
milton
^ permalink raw reply
* [PATCH 1/2] get_property returns const
From: Stephen Rothwell @ 2007-04-27 4:51 UTC (permalink / raw)
To: Jeff Garzik; +Cc: ppc-dev, akpm, paulus, netdev
This is left over from a previous cleanup of get_property.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/net/ehea/ehea_main.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
Jeff,
This patch is on top of your upstream branch from today. This change was
in Paulus' for-2.6.22 tree but has been reverted from there because of a
problematic clash with your tree. This can be applied before or after
the other changes in Paulus' tree.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index a36a023..ece9159 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2519,14 +2519,14 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
struct device_node *lhea_dn;
struct device_node *eth_dn = NULL;
- u32 *dn_log_port_id;
+ const u32 *dn_log_port_id;
int port_setup_ok = 0;
int i = 0;
lhea_dn = adapter->ebus_dev->ofdev.node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
- dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no",
+ dn_log_port_id = get_property(eth_dn, "ibm,hea-port-no",
NULL);
if (!dn_log_port_id) {
ehea_error("bad device node: eth_dn name=%s",
@@ -2560,12 +2560,12 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
{
struct device_node *lhea_dn;
struct device_node *eth_dn = NULL;
- u32 *dn_log_port_id;
+ const u32 *dn_log_port_id;
lhea_dn = adapter->ebus_dev->ofdev.node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
- dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no",
+ dn_log_port_id = get_property(eth_dn, "ibm,hea-port-no",
NULL);
if (dn_log_port_id)
if (*dn_log_port_id == logical_port_id)
@@ -2680,7 +2680,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
const struct of_device_id *id)
{
struct ehea_adapter *adapter;
- u64 *adapter_handle;
+ const u64 *adapter_handle;
int ret;
if (!dev || !dev->ofdev.node) {
@@ -2697,7 +2697,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
adapter->ebus_dev = dev;
- adapter_handle = (u64*)get_property(dev->ofdev.node, "ibm,hea-handle",
+ adapter_handle = get_property(dev->ofdev.node, "ibm,hea-handle",
NULL);
if (adapter_handle)
adapter->handle = *adapter_handle;
--
1.5.1.2
^ permalink raw reply related
* [PATCH 2/2] Rename get_property to of_get_property: drivers/net
From: Stephen Rothwell @ 2007-04-27 4:55 UTC (permalink / raw)
To: Jeff Garzik; +Cc: ppc-dev, akpm, paulus, netdev
In-Reply-To: <20070427145107.4f73e436.sfr@canb.auug.org.au>
This is part of the consolidation of the OpenFirmware code ebtween
PowerPC and Sparc.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
drivers/net/bmac.c | 5 +++--
drivers/net/ehea/ehea_main.c | 6 +++---
drivers/net/mace.c | 4 ++--
drivers/net/pasemi_mac.c | 2 +-
drivers/net/spider_net.c | 4 ++--
drivers/net/sungem.c | 2 +-
drivers/net/sungem_phy.c | 2 +-
drivers/net/ucc_geth.c | 18 +++++++++---------
drivers/net/ucc_geth_mii.c | 4 ++--
9 files changed, 24 insertions(+), 23 deletions(-)
Jeff,
This patch is based on a merge between Paulus' for-2.6.22 tree and your
upstream tree. As such it depends on changes in Paulus' tree to be
merged first. This patch was originally in Paulus' tree but has been
reverted from there.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index c143304..aa01ba3 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1261,9 +1261,10 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n");
return -ENODEV;
}
- prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL);
+ prop_addr = of_get_property(macio_get_of_node(mdev),
+ "mac-address", NULL);
if (prop_addr == NULL) {
- prop_addr = get_property(macio_get_of_node(mdev),
+ prop_addr = of_get_property(macio_get_of_node(mdev),
"local-mac-address", NULL);
if (prop_addr == NULL) {
printk(KERN_ERR "BMAC: Can't get mac-address\n");
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index ece9159..a091887 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2526,7 +2526,7 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
lhea_dn = adapter->ebus_dev->ofdev.node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
- dn_log_port_id = get_property(eth_dn, "ibm,hea-port-no",
+ dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
NULL);
if (!dn_log_port_id) {
ehea_error("bad device node: eth_dn name=%s",
@@ -2565,7 +2565,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
lhea_dn = adapter->ebus_dev->ofdev.node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
- dn_log_port_id = get_property(eth_dn, "ibm,hea-port-no",
+ dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
NULL);
if (dn_log_port_id)
if (*dn_log_port_id == logical_port_id)
@@ -2697,7 +2697,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
adapter->ebus_dev = dev;
- adapter_handle = get_property(dev->ofdev.node, "ibm,hea-handle",
+ adapter_handle = of_get_property(dev->ofdev.node, "ibm,hea-handle",
NULL);
if (adapter_handle)
adapter->handle = *adapter_handle;
diff --git a/drivers/net/mace.c b/drivers/net/mace.c
index 9ec24f0..7018ba9 100644
--- a/drivers/net/mace.c
+++ b/drivers/net/mace.c
@@ -110,9 +110,9 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_device_i
return -ENODEV;
}
- addr = get_property(mace, "mac-address", NULL);
+ addr = of_get_property(mace, "mac-address", NULL);
if (addr == NULL) {
- addr = get_property(mace, "local-mac-address", NULL);
+ addr = of_get_property(mace, "local-mac-address", NULL);
if (addr == NULL) {
printk(KERN_ERR "Can't get mac-address for MACE %s\n",
mace->full_name);
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index d670ac7..cb7a8e7 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -80,7 +80,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
return -ENOENT;
}
- maddr = get_property(dn, "mac-address", NULL);
+ maddr = of_get_property(dn, "mac-address", NULL);
if (maddr == NULL) {
dev_warn(&pdev->dev,
"no mac address in device tree, not configuring\n");
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index e3019d5..1c4a69e 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1831,7 +1831,7 @@ try_host_fw:
if (!dn)
goto out_err;
- fw_prop = get_property(dn, "firmware", &fw_size);
+ fw_prop = of_get_property(dn, "firmware", &fw_size);
if (!fw_prop)
goto out_err;
@@ -2237,7 +2237,7 @@ spider_net_setup_netdev(struct spider_net_card *card)
if (!dn)
return -EIO;
- mac = get_property(dn, "local-mac-address", NULL);
+ mac = of_get_property(dn, "local-mac-address", NULL);
if (!mac)
return -EIO;
memcpy(addr.sa_data, mac, ETH_ALEN);
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 08ea61d..6b1cd74 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -2929,7 +2929,7 @@ static int __devinit gem_get_device_address(struct gem *gp)
#elif defined(CONFIG_PPC_PMAC)
const unsigned char *addr;
- addr = get_property(gp->of_node, "local-mac-address", NULL);
+ addr = of_get_property(gp->of_node, "local-mac-address", NULL);
if (addr == NULL) {
printk("\n");
printk(KERN_ERR "%s: can't get mac-address\n", dev->name);
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index 56a110c..61843fd 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -451,7 +451,7 @@ static int bcm5421_init(struct mii_phy* phy)
if (phy->platform_data) {
struct device_node *np = of_get_parent(phy->platform_data);
int can_low_power = 1;
- if (np == NULL || get_property(np, "no-autolowpower", NULL))
+ if (np == NULL || of_get_property(np, "no-autolowpower", NULL))
can_low_power = 0;
if (can_low_power) {
/* Enable automatic low-power */
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 16b9acd..d7aff81 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3787,7 +3787,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ugeth_vdbg("%s: IN", __FUNCTION__);
- prop = get_property(np, "device-id", NULL);
+ prop = of_get_property(np, "device-id", NULL);
ucc_num = *prop - 1;
if ((ucc_num < 0) || (ucc_num > 7))
return -ENODEV;
@@ -3795,9 +3795,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info = &ugeth_info[ucc_num];
ug_info->uf_info.ucc_num = ucc_num;
- prop = get_property(np, "rx-clock", NULL);
+ prop = of_get_property(np, "rx-clock", NULL);
ug_info->uf_info.rx_clock = *prop;
- prop = get_property(np, "tx-clock", NULL);
+ prop = of_get_property(np, "tx-clock", NULL);
ug_info->uf_info.tx_clock = *prop;
err = of_address_to_resource(np, 0, &res);
if (err)
@@ -3806,23 +3806,23 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->uf_info.regs = res.start;
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
- ph = get_property(np, "phy-handle", NULL);
+ ph = of_get_property(np, "phy-handle", NULL);
phy = of_find_node_by_phandle(*ph);
if (phy == NULL)
return -ENODEV;
/* set the PHY address */
- prop = get_property(phy, "reg", NULL);
+ prop = of_get_property(phy, "reg", NULL);
if (prop == NULL)
return -1;
ug_info->phy_address = *prop;
/* get the phy interface type, or default to MII */
- prop = get_property(np, "interface-type", NULL);
+ prop = of_get_property(np, "interface-type", NULL);
if (!prop) {
/* handle interface property present in old trees */
- prop = get_property(phy, "interface", NULL);
+ prop = of_get_property(phy, "interface", NULL);
if (prop != NULL)
phy_interface = enet_to_phy_interface[*prop];
else
@@ -3832,10 +3832,10 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
}
/* get speed, or derive from interface */
- prop = get_property(np, "max-speed", NULL);
+ prop = of_get_property(np, "max-speed", NULL);
if (!prop) {
/* handle interface property present in old trees */
- prop = get_property(phy, "interface", NULL);
+ prop = of_get_property(phy, "interface", NULL);
if (prop != NULL)
max_speed = enet_to_speed[*prop];
} else {
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 73b5a53..27a1ef3 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -172,7 +172,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
while ((child = of_get_next_child(np, child)) != NULL) {
int irq = irq_of_parse_and_map(child, 0);
if (irq != NO_IRQ) {
- const u32 *id = get_property(child, "reg", NULL);
+ const u32 *id = of_get_property(child, "reg", NULL);
new_bus->irq[*id] = irq;
}
}
@@ -203,7 +203,7 @@ static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *ma
if ((res.start >= tempres.start) &&
(res.end <= tempres.end)) {
/* set this UCC to be the MII master */
- const u32 *id = get_property(tempnp, "device-id", NULL);
+ const u32 *id = of_get_property(tempnp, "device-id", NULL);
if (id == NULL)
goto bus_register_fail;
--
1.5.1.2
^ permalink raw reply related
* Re: [Cbe-oss-dev] [PATCH] cell: cbe_cpufreq cleanup and crash fix
From: Akinobu Mita @ 2007-04-27 5:22 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
In-Reply-To: <20070426230754.GB30000@lixom.net>
On Thu, Apr 26, 2007 at 06:07:54PM -0500, Olof Johansson wrote:
> @@ -303,6 +303,9 @@ static int __init cbe_cpufreq_init(void)
> {
> struct device_node *np;
>
> + if (!machine_is(cell))
> + return 0;
> +
Please return -ENODEV to prevent loading module.
Otherwise it will cause crash when unloading the module
because of cpufreq_unregister_driver() with unregistered driver.
> @@ -315,7 +318,7 @@ static int __init cbe_cpufreq_init(void)
>
> static void __exit cbe_cpufreq_exit(void)
> {
> - if(pmi_dev)
> + if (pmi_dev)
> pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
>
> cpufreq_unregister_driver(&cbe_cpufreq_driver);
^ permalink raw reply
* Re: [Cbe-oss-dev] [PATCH] cell: cbe_cpufreq cleanup and crash fix
From: Olof Johansson @ 2007-04-27 5:32 UTC (permalink / raw)
To: Akinobu Mita; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
In-Reply-To: <20070427052206.GA5486@localhost.localdomain>
On Fri, Apr 27, 2007 at 02:22:06PM +0900, Akinobu Mita wrote:
> On Thu, Apr 26, 2007 at 06:07:54PM -0500, Olof Johansson wrote:
> > @@ -303,6 +303,9 @@ static int __init cbe_cpufreq_init(void)
> > {
> > struct device_node *np;
> >
> > + if (!machine_is(cell))
> > + return 0;
> > +
>
> Please return -ENODEV to prevent loading module.
>
> Otherwise it will cause crash when unloading the module
> because of cpufreq_unregister_driver() with unregistered driver.
It won't crash due to the checks in cpufreq_unregister_driver(), but
it's still better to return failure.
Thanks,
-Olof
^ permalink raw reply
* [PATCH v2] cell: cbe_cpufreq cleanup and crash fix
From: Olof Johansson @ 2007-04-27 5:33 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, cbe-oss-dev, Christian Krafft
In-Reply-To: <20070426230754.GB30000@lixom.net>
cbe_cpufreq cleanups:
* comment format
* whitespace
* don't init on non-cell platforms
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: powerpc/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ powerpc/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -155,7 +155,7 @@ static int set_pmode_reg(int cpu, unsign
}
static int set_pmode(int cpu, unsigned int slow_mode) {
- if(pmi_dev)
+ if (pmi_dev)
return set_pmode_pmi(cpu, slow_mode);
else
return set_pmode_reg(cpu, slow_mode);
@@ -167,7 +167,7 @@ static void cbe_cpufreq_handle_pmi(struc
u8 cpu;
u8 cbe_pmode_new;
- BUG_ON (pmi_msg.type != PMI_TYPE_FREQ_CHANGE);
+ BUG_ON(pmi_msg.type != PMI_TYPE_FREQ_CHANGE);
cpu = cbe_node_to_cpu(pmi_msg.data1);
cbe_pmode_new = pmi_msg.data2;
@@ -191,7 +191,7 @@ static struct pmi_handler cbe_pmi_handle
* cpufreq functions
*/
-static int cbe_cpufreq_cpu_init (struct cpufreq_policy *policy)
+static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
const u32 *max_freqp;
u32 max_freq;
@@ -200,7 +200,7 @@ static int cbe_cpufreq_cpu_init (struct
cpu = of_get_cpu_node(policy->cpu, NULL);
- if(!cpu)
+ if (!cpu)
return -ENODEV;
pr_debug("init cpufreq on CPU %d\n", policy->cpu);
@@ -210,13 +210,13 @@ static int cbe_cpufreq_cpu_init (struct
if (!max_freqp)
return -EINVAL;
- // we need the freq in kHz
+ /* we need the freq in kHz */
max_freq = *max_freqp / 1000;
pr_debug("max clock-frequency is at %u kHz\n", max_freq);
pr_debug("initializing frequency table\n");
- // initialize frequency table
+ /* initialize frequency table */
for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
cbe_freqs[i].frequency = max_freq / cbe_freqs[i].index;
pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
@@ -235,10 +235,10 @@ static int cbe_cpufreq_cpu_init (struct
policy->cpus = cpu_sibling_map[policy->cpu];
#endif
- cpufreq_frequency_table_get_attr (cbe_freqs, policy->cpu);
+ cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
/* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */
- return cpufreq_frequency_table_cpuinfo (policy, cbe_freqs);
+ return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
}
static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
@@ -270,7 +270,7 @@ static int cbe_cpufreq_target(struct cpu
freqs.new = cbe_freqs[cbe_pmode_new].frequency;
freqs.cpu = policy->cpu;
- mutex_lock (&cbe_switch_mutex);
+ mutex_lock(&cbe_switch_mutex);
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
@@ -303,6 +303,9 @@ static int __init cbe_cpufreq_init(void)
{
struct device_node *np;
+ if (!machine_is(cell))
+ return -ENODEV;
+
np = of_find_node_by_type(NULL, "ibm,pmi");
pmi_dev = of_find_device_by_node(np);
@@ -315,7 +318,7 @@ static int __init cbe_cpufreq_init(void)
static void __exit cbe_cpufreq_exit(void)
{
- if(pmi_dev)
+ if (pmi_dev)
pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
cpufreq_unregister_driver(&cbe_cpufreq_driver);
^ permalink raw reply
* [PATCH v3] [2.6.22] pasemi: cpufreq driver
From: Olof Johansson @ 2007-04-27 5:46 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev, egor, arnd, cpufreq
In-Reply-To: <20070426053700.GA23922@lixom.net>
Cpufreq driver for PA Semi PWRficient processors.
Signed-off-by: Egor Martovetsky <egor@pasemi.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
---
v3:
* use cpu_online_map instead of possible_map
* fix CPU_FREQ dependency
* return -ENODEV instead of 0 on unsupported platforms
v2:
* Attributed copyright correctly to cbe_cpufreq.c and adjust license
to match (this was my mistake)
* Lookup the SDC and Gizmo device nodes to get register bases
* machine_is_compatible checks
* Cleanups as suggested by Arnd + misc whitespace
I chose not to do this as an of_platform driver since it doesn't fit
that well with the cpufreq driver model; having 3 levels of init/probe
functions is excessive.
Index: powerpc/arch/powerpc/platforms/pasemi/Makefile
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pasemi/Makefile
+++ powerpc/arch/powerpc/platforms/pasemi/Makefile
@@ -1,2 +1,3 @@
obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o
obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o
+obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o
Index: powerpc/arch/powerpc/platforms/pasemi/cpufreq.c
===================================================================
--- /dev/null
+++ powerpc/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -0,0 +1,307 @@
+/*
+ * Copyright (C) 2007 PA Semi, Inc
+ *
+ * Authors: Egor Martovetsky <egor@pasemi.com>
+ * Olof Johansson <olof@lixom.net>
+ *
+ * Maintained by: Olof Johansson <olof@lixom.net>
+ *
+ * Based on arch/powerpc/platforms/cell/cbe_cpufreq.c:
+ * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <linux/cpufreq.h>
+#include <linux/timer.h>
+
+#include <asm/hw_irq.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+
+#define SDCASR_REG 0x0100
+#define SDCASR_REG_STRIDE 0x1000
+#define SDCPWR_CFGA0_REG 0x0100
+#define SDCPWR_PWST0_REG 0x0000
+#define SDCPWR_GIZTIME_REG 0x0440
+
+/* SDCPWR_GIZTIME_REG fields */
+#define SDCPWR_GIZTIME_GR 0x80000000
+#define SDCPWR_GIZTIME_LONGLOCK 0x000000ff
+
+/* Offset of ASR registers from SDC base */
+#define SDCASR_OFFSET 0x120000
+
+static void __iomem *sdcpwr_mapbase;
+static void __iomem *sdcasr_mapbase;
+
+static DEFINE_MUTEX(pas_switch_mutex);
+
+/* Current astate, is used when waking up from power savings on
+ * one core, in case the other core has switched states during
+ * the idle time.
+ */
+static int current_astate;
+
+/* We support 5(A0-A4) power states excluding turbo(A5-A6) modes */
+static struct cpufreq_frequency_table pas_freqs[] = {
+ {0, 0},
+ {1, 0},
+ {2, 0},
+ {3, 0},
+ {4, 0},
+ {0, CPUFREQ_TABLE_END},
+};
+
+static struct freq_attr *pas_cpu_freqs_attr[] = {
+ &cpufreq_freq_attr_scaling_available_freqs,
+ NULL,
+};
+
+/*
+ * hardware specific functions
+ */
+
+static int get_astate_freq(int astate)
+{
+ u32 ret;
+ ret = in_le32(sdcpwr_mapbase + SDCPWR_CFGA0_REG + (astate * 0x10));
+
+ return ret & 0x3f;
+}
+
+static int get_cur_astate(int cpu)
+{
+ u32 ret;
+
+ ret = in_le32(sdcpwr_mapbase + SDCPWR_PWST0_REG);
+ ret = (ret >> (cpu * 4)) & 0x7;
+
+ return ret;
+}
+
+static int get_gizmo_latency(void)
+{
+ u32 giztime, ret;
+
+ giztime = in_le32(sdcpwr_mapbase + SDCPWR_GIZTIME_REG);
+
+ /* just provide the upper bound */
+ if (giztime & SDCPWR_GIZTIME_GR)
+ ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 128000;
+ else
+ ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 1000;
+
+ return ret;
+}
+
+static void set_astate(int cpu, unsigned int astate)
+{
+ u64 flags;
+
+ /* Return if called before init has run */
+ if (unlikely(!sdcasr_mapbase))
+ return;
+
+ local_irq_save(flags);
+
+ out_le32(sdcasr_mapbase + SDCASR_REG + SDCASR_REG_STRIDE*cpu, astate);
+
+ local_irq_restore(flags);
+}
+
+void restore_astate(int cpu)
+{
+ set_astate(cpu, current_astate);
+}
+
+/*
+ * cpufreq functions
+ */
+
+static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+ u32 *max_freq;
+ int i, cur_astate;
+ struct resource res;
+ struct device_node *cpu, *dn;
+ int err = -ENODEV;
+
+ cpu = of_get_cpu_node(policy->cpu, NULL);
+
+ if (!cpu)
+ goto out;
+
+ dn = of_find_compatible_node(NULL, "sdc", "1682m-sdc");
+ if (!dn)
+ goto out;
+ err = of_address_to_resource(dn, 0, &res);
+ of_node_put(dn);
+ if (err)
+ goto out;
+ sdcasr_mapbase = ioremap(res.start + SDCASR_OFFSET, 0x2000);
+ if (!sdcasr_mapbase) {
+ err = -EINVAL;
+ goto out;
+ }
+
+ dn = of_find_compatible_node(NULL, "gizmo", "1682m-gizmo");
+ if (!dn) {
+ err = -ENODEV;
+ goto out_unmap_sdcasr;
+ }
+ err = of_address_to_resource(dn, 0, &res);
+ of_node_put(dn);
+ if (err)
+ goto out_unmap_sdcasr;
+ sdcpwr_mapbase = ioremap(res.start, 0x1000);
+ if (!sdcpwr_mapbase) {
+ err = -EINVAL;
+ goto out_unmap_sdcasr;
+ }
+
+ pr_debug("init cpufreq on CPU %d\n", policy->cpu);
+
+ max_freq = (u32*) get_property(cpu, "clock-frequency", NULL);
+ if (!max_freq) {
+ err = -EINVAL;
+ goto out_unmap_sdcpwr;
+ }
+
+ /* we need the freq in kHz */
+ *max_freq /= 1000;
+
+ pr_debug("max clock-frequency is at %u kHz\n", *max_freq);
+ pr_debug("initializing frequency table\n");
+
+ /* initialize frequency table */
+ for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
+ pas_freqs[i].frequency = get_astate_freq(pas_freqs[i].index) * 100000;
+ pr_debug("%d: %d\n", i, pas_freqs[i].frequency);
+ }
+
+ policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
+
+ policy->cpuinfo.transition_latency = get_gizmo_latency();
+
+ cur_astate = get_cur_astate(policy->cpu);
+ pr_debug("current astate is at %d\n",cur_astate);
+
+ policy->cur = pas_freqs[cur_astate].frequency;
+ policy->cpus = cpu_online_map;
+
+ cpufreq_frequency_table_get_attr(pas_freqs, policy->cpu);
+
+ /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max
+ * are set correctly
+ */
+ return cpufreq_frequency_table_cpuinfo(policy, pas_freqs);
+
+out_unmap_sdcpwr:
+ iounmap(sdcpwr_mapbase);
+
+out_unmap_sdcasr:
+ iounmap(sdcasr_mapbase);
+out:
+ return err;
+}
+
+static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy)
+{
+ if (sdcasr_mapbase)
+ iounmap(sdcasr_mapbase);
+ if (sdcpwr_mapbase)
+ iounmap(sdcpwr_mapbase);
+
+ cpufreq_frequency_table_put_attr(policy->cpu);
+ return 0;
+}
+
+static int pas_cpufreq_verify(struct cpufreq_policy *policy)
+{
+ return cpufreq_frequency_table_verify(policy, pas_freqs);
+}
+
+static int pas_cpufreq_target(struct cpufreq_policy *policy,
+ unsigned int target_freq,
+ unsigned int relation)
+{
+ struct cpufreq_freqs freqs;
+ int pas_astate_new;
+ int i;
+
+ cpufreq_frequency_table_target(policy,
+ pas_freqs,
+ target_freq,
+ relation,
+ &pas_astate_new);
+
+ freqs.old = policy->cur;
+ freqs.new = pas_freqs[pas_astate_new].frequency;
+ freqs.cpu = policy->cpu;
+
+ mutex_lock(&pas_switch_mutex);
+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+
+ pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
+ policy->cpu,
+ pas_freqs[pas_astate_new].frequency,
+ pas_freqs[pas_astate_new].index);
+
+ current_astate = pas_astate_new;
+
+ for_each_online_cpu(i)
+ set_astate(i, pas_astate_new);
+
+ cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
+ mutex_unlock(&pas_switch_mutex);
+
+ return 0;
+}
+
+static struct cpufreq_driver pas_cpufreq_driver = {
+ .name = "pas-cpufreq",
+ .owner = THIS_MODULE,
+ .flags = CPUFREQ_CONST_LOOPS,
+ .init = pas_cpufreq_cpu_init,
+ .exit = pas_cpufreq_cpu_exit,
+ .verify = pas_cpufreq_verify,
+ .target = pas_cpufreq_target,
+ .attr = pas_cpu_freqs_attr,
+};
+
+/*
+ * module init and destoy
+ */
+
+static int __init pas_cpufreq_init(void)
+{
+ if (!machine_is_compatible("PA6T-1682M"))
+ return -ENODEV;
+
+ return cpufreq_register_driver(&pas_cpufreq_driver);
+}
+
+static void __exit pas_cpufreq_exit(void)
+{
+ cpufreq_unregister_driver(&pas_cpufreq_driver);
+}
+
+module_init(pas_cpufreq_init);
+module_exit(pas_cpufreq_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>, Olof Johansson <olof@lixom.net>");
Index: powerpc/arch/powerpc/platforms/pasemi/idle.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pasemi/idle.c
+++ powerpc/arch/powerpc/platforms/pasemi/idle.c
@@ -61,6 +61,10 @@ static int pasemi_system_reset_exception
/* do system reset */
return 0;
}
+
+ /* Set higher astate since we come out of power savings at 0 */
+ restore_astate(hard_smp_processor_id());
+
/* everything handled */
regs->msr |= MSR_RI;
return 1;
@@ -68,6 +72,11 @@ static int pasemi_system_reset_exception
void __init pasemi_idle_init(void)
{
+#ifndef CONFIG_PPC_PASEMI_CPUFREQ
+ printk(KERN_WARNING "No cpufreq driver, powersavings modes disabled\n");
+ current_mode = 0;
+#endif
+
ppc_md.system_reset_exception = pasemi_system_reset_exception;
ppc_md.power_save = modes[current_mode].entry;
printk(KERN_INFO "Using PA6T idle loop (%s)\n", modes[current_mode].name);
Index: powerpc/arch/powerpc/platforms/pasemi/pasemi.h
===================================================================
--- powerpc.orig/arch/powerpc/platforms/pasemi/pasemi.h
+++ powerpc/arch/powerpc/platforms/pasemi/pasemi.h
@@ -14,6 +14,14 @@ extern void __init pasemi_idle_init(void
extern void idle_spin(void);
extern void idle_doze(void);
+/* Restore astate to last set */
+#ifdef CONFIG_PPC_PASEMI_CPUFREQ
+extern void restore_astate(int cpu);
+#else
+static inline void restore_astate(int cpu)
+{
+}
+#endif
#endif /* _PASEMI_PASEMI_H */
Index: powerpc/arch/powerpc/platforms/Kconfig
===================================================================
--- powerpc.orig/arch/powerpc/platforms/Kconfig
+++ powerpc/arch/powerpc/platforms/Kconfig
@@ -169,6 +169,16 @@ config CPU_FREQ_PMAC64
help
This adds support for frequency switching on Apple iMac G5,
and some of the more recent desktop G5 machines as well.
+
+config PPC_PASEMI_CPUFREQ
+ bool "Support for PA Semi PWRficient"
+ depends on CPU_FREQ && PPC_PASEMI
+ default y
+ select CPU_FREQ_TABLE
+ help
+ This adds the support for frequency switching on PA Semi
+ PWRficient processors.
+
endmenu
config PPC601_SYNC_FIX
^ permalink raw reply
* [PATCH] powerpc: clean up cpufreq Kconfig dependencies
From: Olof Johansson @ 2007-04-27 5:52 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
Shuffle Kconfig order, making the platform drivers menu depend on the global
option instead of each driver being dependent on it.
Also fix dependency of PPC_PMAC on the G5 one.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: powerpc/arch/powerpc/platforms/Kconfig
===================================================================
--- powerpc.orig/arch/powerpc/platforms/Kconfig
+++ powerpc/arch/powerpc/platforms/Kconfig
@@ -148,14 +148,14 @@ config GENERIC_IOMAP
bool
default n
-menu "CPU Frequency support"
- depends on PPC64 || CLASSIC32
-
source "drivers/cpufreq/Kconfig"
+menu "CPU Frequency drivers"
+ depends on CPU_FREQ
+
config CPU_FREQ_PMAC
bool "Support for Apple PowerBooks"
- depends on CPU_FREQ && ADB_PMU && PPC32
+ depends on ADB_PMU && PPC32
select CPU_FREQ_TABLE
help
This adds support for frequency switching on Apple PowerBooks,
@@ -164,7 +164,7 @@ config CPU_FREQ_PMAC
config CPU_FREQ_PMAC64
bool "Support for some Apple G5s"
- depends on CPU_FREQ && PPC64
+ depends on PPC_PMAC && PPC64
select CPU_FREQ_TABLE
help
This adds support for frequency switching on Apple iMac G5,
@@ -172,7 +172,7 @@ config CPU_FREQ_PMAC64
config PPC_PASEMI_CPUFREQ
bool "Support for PA Semi PWRficient"
- depends on CPU_FREQ && PPC_PASEMI
+ depends on PPC_PASEMI
default y
select CPU_FREQ_TABLE
help
^ permalink raw reply
* Re: [PATCH 2/13] powerpc: Add dt_xlate_addr() to bootwrapper
From: Paul Mackerras @ 2007-04-27 5:55 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev
In-Reply-To: <20070425235543.GD4046@mag.az.mvista.com>
Mark A. Greer writes:
> dt_xlate_reg() looks up the 'reg' property in the specified node
> to get the address and size to translate. Add dt_xlate_addr()
> which is passed in the address and size to translate.
Could you rebase on top of Scott Wood's patch fixing bugs in
dt_xlate_reg please?
Paul.
^ permalink raw reply
* Re: [PATCH 3/13] powerpc: Add bootwrapper support for Marvell/mv64x60 hostbridge
From: Paul Mackerras @ 2007-04-27 6:01 UTC (permalink / raw)
To: Mark A. Greer; +Cc: linuxppc-dev
In-Reply-To: <20070425235619.GE4046@mag.az.mvista.com>
Mark A. Greer writes:
> Makefile | 2
> mv64x60.c | 581 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> mv64x60.h | 70 +++++++
> 3 files changed, 652 insertions(+), 1 deletion(-)
650 lines just to set up a hostbridge - that seems like rather a lot.
Why do we have to do this here? Isn't there some firmware that should
do this for us?
Paul.
^ permalink raw reply
* Re: [RFC] add 8-bit bus support to the Xilinx SystemACE device driver + minor clean-ups
From: Grant Likely @ 2007-04-27 6:28 UTC (permalink / raw)
To: Andrei Konovalov; +Cc: linuxppc-embedded
In-Reply-To: <4627B5AE.5060109@ru.mvista.com>
On 4/19/07, Andrei Konovalov <akonovalov@ru.mvista.com> wrote:
> Hello,
>
> The attached patch should be applied on top of the SystemACE device
> driver patch by Grant.
I just realized I never replyed to you on this one. Sorry!
Thanks for the patch. I'm getting the driver ready for mainline
submission now and I'll make sure 8 bit support is included. I'll
also need your help with some more testing as I'm doing a fair bit of
rework on the bus attachment and error handling.
Thanks again,
g.
--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [RFC] SystemACE driver - abstract register ops
From: Grant Likely @ 2007-04-27 6:48 UTC (permalink / raw)
To: John Williams; +Cc: linuxppc-embedded
In-Reply-To: <463199EF.3090900@itee.uq.edu.au>
On 4/27/07, John Williams <jwilliams@itee.uq.edu.au> wrote:
> Grant,
>
> Thanks for your work on the SystemACE driver - I'll be porting/merging
> this across to MicroBlaze very shortly.
>
> Given that SysACE can be hooked up in any number of ways, bit widths,
> endians, PPC/Microblaze, can you please offer your comments on the
> attached patch?
HAHAHAHAHAHAHA! Guess what I just finished writing before receiving your email.
I've got something very similar that I'm testing now, but thanks for
the patch. I feel better that someone else has the same opinion on
how to hook up the bus.
Cheers,
g.
>
> It introduce a private ace_reg_ops structure, with various member
> functions for the different kinds of accesses to the HW.
>
> This patch should not change the functionality of your original driver
> at all, it's just groundwork for what's to come.
>
> I recognise that it adds indirection into the various access paths, and
> potentially a little bloat. Whether this is better than #if
> 1...#else...#endif is debatable.
>
> Similar issues will arise for most (all?) of the Xilinx drivers that we
> will share between PPC and MicroBlaze. Hopefully we can converge on a
> nice consistent and clean way of handling these dual arch drivers.
>
> Cheers,
>
> John
>
> Index: linux-2.6.x-petalogix/drivers/block/xsysace.c
> ===================================================================
> --- linux-2.6.x-petalogix/drivers/block/xsysace.c (revision 2628)
> +++ linux-2.6.x-petalogix/drivers/block/xsysace.c (working copy)
> @@ -73,6 +73,11 @@
> * interrupt, then the kernel timer will expire and the driver can
> * continue where it left off.
> *
> + * SystemACE can be wired up in different endian orders and data widths.
> + * It works on both PPC and MicroBlaze architectures. For this reason,
> + * an ace_reg_ops structure is used that abstracts away low level
> + * endian/width/arch access to the HW registers.
> +
> * To Do:
> * - Add FPGA configuration control interface.
> * - Request major number from lanana
> @@ -161,32 +166,120 @@
> /* ---------------------------------------------------------------------
> * Low level register access
> */
> +struct reg_ops {
> + u8 (*read8)(void *addr);
> + u16 (*read16)(void *addr);
> + u32 (*read32)(void *addr);
> + u32 (*readdata)(void *addr);
>
> -/* register access macros */
> + void (*write16)(void *addr, u16 val);
> + void (*write32)(void *addr, u32 val);
> + void (*writedata)(void *addr, u32 val);
> +};
> +
> +#define ace_reg_read8(ace, reg) (ace->ops->read8(ace->baseaddr + reg))
> +#define ace_reg_read16(ace, reg) (ace->ops->read16(ace->baseaddr + reg))
> +#define ace_reg_readdata(ace, reg) (ace->ops->readdata(ace->baseaddr + reg))
> +#define ace_reg_read32(ace, reg) (ace->ops->read32(ace->baseaddr+reg))
> +#define ace_reg_write16(ace, reg, val) (ace->ops->write16(ace->baseaddr+reg, val))
> +#define ace_reg_writedata(ace, reg, val) (ace->ops->writedata(ace->baseaddr + reg, val))
> +#define ace_reg_write32(ace, reg, val) (ace->ops->write32(ace->baseaddr+reg, val))
> +
> +/* register access functions */
> #if 1 /* Little endian 16-bit regs */
> -#define ace_reg_read8(ace, reg) in_8(ace->baseaddr + reg)
> -#define ace_reg_read16(ace, reg) in_le16(ace->baseaddr + reg)
> -#define ace_reg_readdata(ace, reg) in_be16(ace->baseaddr + reg)
> -#define ace_reg_read32(ace, reg) ((in_le16(ace->baseaddr + reg+2) << 16) | \
> - (in_le16(ace->baseaddr + reg)))
> -#define ace_reg_write16(ace, reg, val) out_le16(ace->baseaddr + reg, val)
> -#define ace_reg_writedata(ace, reg, val) out_be16(ace->baseaddr + reg, val)
> -#define ace_reg_write32(ace, reg, val) { \
> - out_le16(ace->baseaddr + reg+2, (val) >> 16); \
> - out_le16(ace->baseaddr + reg, val); \
> - }
> +static u8 ace_le16_read8(void *addr)
> +{
> + return in_8(addr);
> +}
> +
> +static u16 ace_le16_read16(void *addr)
> +{
> + return in_le16(addr);
> +}
> +
> +static u32 ace_le16_read32(void *addr)
> +{
> + return ((in_le16(addr+2) << 16) | (in_le16(addr)));
> +}
> +
> +static u32 ace_le16_readdata(void *addr)
> +{
> + return in_be16(addr);
> +}
> +
> +static void ace_le16_write16(void *addr, u16 val)
> +{
> + out_le16(addr, val);
> +}
> +
> +static void ace_le16_write32(void *addr, u32 val)
> +{
> + out_le16(addr+2,(val) >> 16); \
> + out_le16(addr, val);
> +}
> +
> +static void ace_le16_writedata(void *addr, u32 val)
> +{
> + out_be16(addr, val);
> +}
> +
> +static struct reg_ops ace_ops = {
> + .read8 = ace_le16_read8,
> + .read16 = ace_le16_read16,
> + .read32 = ace_le16_read32,
> + .readdata = ace_le16_readdata,
> + .write16 = ace_le16_write16,
> + .write32 = ace_le16_write32,
> + .writedata = ace_le16_writedata
> +} ;
> +
> #else /* Big endian 16-bit regs */
> -#define ace_reg_read8(ace, reg) in_8(ace->baseaddr + reg)
> -#define ace_reg_read16(ace, reg) in_be16(ace->baseaddr + reg)
> -#define ace_reg_readdata(ace, reg) in_le16(ace->baseaddr + reg)
> -#define ace_reg_read32(ace, reg) ((in_be16(ace->baseaddr + reg+2) << 16) | \
> - (in_be16(ace->baseaddr + reg)))
> -#define ace_reg_write16(ace, reg, val) out_be16(ace->baseaddr + reg, val)
> -#define ace_reg_writedata(ace, reg, val) out_le16(ace->baseaddr + reg, val)
> -#define ace_reg_write32(ace, reg, val) { \
> - out_be16(ace->baseaddr + reg+2, (val) >> 16); \
> - out_be16(ace->baseaddr + reg, val); \
> - }
> +static u8 ace_be16_read8(void *addr)
> +{
> + return in_8(addr);
> +}
> +
> +static u16 ace_be16_read16(void *addr)
> +{
> + return in_be16(addr);
> +}
> +
> +static u32 ace_be16_read32(void *addr)
> +{
> + return ((in_be16(addr+2) << 16) | (in_be16(addr)));
> +}
> +
> +static u32 ace_be16_readdata(void *addr)
> +{
> + return in_le16(addr);
> +}
> +
> +static void ace_be16_write16(void *addr, u16 val)
> +{
> + out_be16(addr, val);
> +}
> +
> +static void ace_be16_write32(void *addr, u32 val)
> +{
> + out_be16(addr+2,(val) >> 16); \
> + out_be16(addr, val);
> +}
> +
> +static void ace_be16_writedata(void *addr, u32 val)
> +{
> + out_le16(addr, val);
> +}
> +
> +static struct reg_ops ace_ops = {
> + .read8 = ace_be16_read8,
> + .read16 = ace_be16_read16,
> + .read32 = ace_be16_read32,
> + .readdata = ace_be16_readdata,
> + .write16 = ace_be16_write16,
> + .write32 = ace_be16_write32,
> + .writedata = ace_be16_writedata
> +} ;
> +
> #endif
>
> struct ace_device {
> @@ -222,6 +315,9 @@
> int bus_width; /* 0 := 8 bit; 1 := 16 bit */
> int lock_count;
>
> + /* Register access ops */
> + struct reg_ops *ops;
> +
> /* Block device data structures */
> spinlock_t lock;
> struct device *dev;
> @@ -995,6 +1091,8 @@
> ace->id = dev->id;
> ace->irq = NO_IRQ;
>
> + ace->ops=&ace_ops;
> +
> for (i = 0; i < dev->num_resources; i++) {
> if (dev->resource[i].flags & IORESOURCE_MEM)
> ace->physaddr = dev->resource[i].start;
>
>
--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [RFC] SystemACE driver - abstract register ops
From: Grant Likely @ 2007-04-27 7:31 UTC (permalink / raw)
To: John Williams
Cc: Andrei Konovalov, Stefan Roese, Rick Moleres, linuxppc-embedded
In-Reply-To: <463199EF.3090900@itee.uq.edu.au>
[-- Attachment #1: Type: text/plain, Size: 1880 bytes --]
On 4/27/07, John Williams <jwilliams@itee.uq.edu.au> wrote:
> Grant,
>
> Thanks for your work on the SystemACE driver - I'll be porting/merging
> this across to MicroBlaze very shortly.
Very cool; I hope it works well.
> Given that SysACE can be hooked up in any number of ways, bit widths,
> endians, PPC/Microblaze, can you please offer your comments on the
> attached patch?
Okay, after getting over my initial mirth about working on the *exact*
same thing and finishing it at the *exact* time that you sent me your
patch, I think I'm ready to make useful comments. :-)
>
> It introduce a private ace_reg_ops structure, with various member
> functions for the different kinds of accesses to the HW.
>
> This patch should not change the functionality of your original driver
> at all, it's just groundwork for what's to come.
>
> I recognise that it adds indirection into the various access paths, and
> potentially a little bloat. Whether this is better than #if
> 1...#else...#endif is debatable.
I'm not to concerned with the added redirection. On my 405 designs, I
find that bus overhead has a far greater impact than any of the
processing paths in the driver, so this shouldn't be a problem.
Besides, when we finally move to arch/powerpc, it will become very
feasable to have a single kernel image that will boot on multiple
ppc405 FPGA configurations; just change the device tree passed in.
> Similar issues will arise for most (all?) of the Xilinx drivers that we
> will share between PPC and MicroBlaze. Hopefully we can converge on a
> nice consistent and clean way of handling these dual arch drivers.
I agree 100%
For your reading pleasure, I've attached the bus attachment changes
that I've made in my tree. I hope to get this driver accepted into
mainline during the 2.6.22 merge window; so please get any comments
you have back to me ASAP.
Cheers,
g.
[-- Attachment #2: 0001-SYSACE-Make-bus-binding-selectable-at-runtime.patch --]
[-- Type: application/x-patch, Size: 10652 bytes --]
^ permalink raw reply
* Re: [PATCH v2] cell: cbe_cpufreq cleanup and crash fix
From: Christian Krafft @ 2007-04-27 7:55 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
In-Reply-To: <20070427053347.GA7755@lixom.net>
[-- Attachment #1: Type: text/plain, Size: 633 bytes --]
On Fri, 27 Apr 2007 00:33:47 -0500
olof@lixom.net (Olof Johansson) wrote:
> cbe_cpufreq cleanups:
>
> * comment format
> * whitespace
> * don't init on non-cell platforms
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Christian Krafft <krafft@de.ibm.com>
Thx for fixing ;-)
--
Mit freundlichen Gruessen,
kind regards,
Christian Krafft
IBM Systems & Technology Group,
Linux Kernel Development
IT Specialist
Vorsitzender des Aufsichtsrats: Johann Weihen
Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen
Registriergericht: Amtsgericht Stuttgart, HRB 243294
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [RFC] SystemACE driver - abstract register ops
From: John Williams @ 2007-04-27 6:36 UTC (permalink / raw)
To: linuxppc-embedded, grant.likely
[-- Attachment #1: Type: text/plain, Size: 920 bytes --]
Grant,
Thanks for your work on the SystemACE driver - I'll be porting/merging
this across to MicroBlaze very shortly.
Given that SysACE can be hooked up in any number of ways, bit widths,
endians, PPC/Microblaze, can you please offer your comments on the
attached patch?
It introduce a private ace_reg_ops structure, with various member
functions for the different kinds of accesses to the HW.
This patch should not change the functionality of your original driver
at all, it's just groundwork for what's to come.
I recognise that it adds indirection into the various access paths, and
potentially a little bloat. Whether this is better than #if
1...#else...#endif is debatable.
Similar issues will arise for most (all?) of the Xilinx drivers that we
will share between PPC and MicroBlaze. Hopefully we can converge on a
nice consistent and clean way of handling these dual arch drivers.
Cheers,
John
[-- Attachment #2: xsysace-regops.patch --]
[-- Type: text/plain, Size: 5430 bytes --]
Index: linux-2.6.x-petalogix/drivers/block/xsysace.c
===================================================================
--- linux-2.6.x-petalogix/drivers/block/xsysace.c (revision 2628)
+++ linux-2.6.x-petalogix/drivers/block/xsysace.c (working copy)
@@ -73,6 +73,11 @@
* interrupt, then the kernel timer will expire and the driver can
* continue where it left off.
*
+ * SystemACE can be wired up in different endian orders and data widths.
+ * It works on both PPC and MicroBlaze architectures. For this reason,
+ * an ace_reg_ops structure is used that abstracts away low level
+ * endian/width/arch access to the HW registers.
+
* To Do:
* - Add FPGA configuration control interface.
* - Request major number from lanana
@@ -161,32 +166,120 @@
/* ---------------------------------------------------------------------
* Low level register access
*/
+struct reg_ops {
+ u8 (*read8)(void *addr);
+ u16 (*read16)(void *addr);
+ u32 (*read32)(void *addr);
+ u32 (*readdata)(void *addr);
-/* register access macros */
+ void (*write16)(void *addr, u16 val);
+ void (*write32)(void *addr, u32 val);
+ void (*writedata)(void *addr, u32 val);
+};
+
+#define ace_reg_read8(ace, reg) (ace->ops->read8(ace->baseaddr + reg))
+#define ace_reg_read16(ace, reg) (ace->ops->read16(ace->baseaddr + reg))
+#define ace_reg_readdata(ace, reg) (ace->ops->readdata(ace->baseaddr + reg))
+#define ace_reg_read32(ace, reg) (ace->ops->read32(ace->baseaddr+reg))
+#define ace_reg_write16(ace, reg, val) (ace->ops->write16(ace->baseaddr+reg, val))
+#define ace_reg_writedata(ace, reg, val) (ace->ops->writedata(ace->baseaddr + reg, val))
+#define ace_reg_write32(ace, reg, val) (ace->ops->write32(ace->baseaddr+reg, val))
+
+/* register access functions */
#if 1 /* Little endian 16-bit regs */
-#define ace_reg_read8(ace, reg) in_8(ace->baseaddr + reg)
-#define ace_reg_read16(ace, reg) in_le16(ace->baseaddr + reg)
-#define ace_reg_readdata(ace, reg) in_be16(ace->baseaddr + reg)
-#define ace_reg_read32(ace, reg) ((in_le16(ace->baseaddr + reg+2) << 16) | \
- (in_le16(ace->baseaddr + reg)))
-#define ace_reg_write16(ace, reg, val) out_le16(ace->baseaddr + reg, val)
-#define ace_reg_writedata(ace, reg, val) out_be16(ace->baseaddr + reg, val)
-#define ace_reg_write32(ace, reg, val) { \
- out_le16(ace->baseaddr + reg+2, (val) >> 16); \
- out_le16(ace->baseaddr + reg, val); \
- }
+static u8 ace_le16_read8(void *addr)
+{
+ return in_8(addr);
+}
+
+static u16 ace_le16_read16(void *addr)
+{
+ return in_le16(addr);
+}
+
+static u32 ace_le16_read32(void *addr)
+{
+ return ((in_le16(addr+2) << 16) | (in_le16(addr)));
+}
+
+static u32 ace_le16_readdata(void *addr)
+{
+ return in_be16(addr);
+}
+
+static void ace_le16_write16(void *addr, u16 val)
+{
+ out_le16(addr, val);
+}
+
+static void ace_le16_write32(void *addr, u32 val)
+{
+ out_le16(addr+2,(val) >> 16); \
+ out_le16(addr, val);
+}
+
+static void ace_le16_writedata(void *addr, u32 val)
+{
+ out_be16(addr, val);
+}
+
+static struct reg_ops ace_ops = {
+ .read8 = ace_le16_read8,
+ .read16 = ace_le16_read16,
+ .read32 = ace_le16_read32,
+ .readdata = ace_le16_readdata,
+ .write16 = ace_le16_write16,
+ .write32 = ace_le16_write32,
+ .writedata = ace_le16_writedata
+} ;
+
#else /* Big endian 16-bit regs */
-#define ace_reg_read8(ace, reg) in_8(ace->baseaddr + reg)
-#define ace_reg_read16(ace, reg) in_be16(ace->baseaddr + reg)
-#define ace_reg_readdata(ace, reg) in_le16(ace->baseaddr + reg)
-#define ace_reg_read32(ace, reg) ((in_be16(ace->baseaddr + reg+2) << 16) | \
- (in_be16(ace->baseaddr + reg)))
-#define ace_reg_write16(ace, reg, val) out_be16(ace->baseaddr + reg, val)
-#define ace_reg_writedata(ace, reg, val) out_le16(ace->baseaddr + reg, val)
-#define ace_reg_write32(ace, reg, val) { \
- out_be16(ace->baseaddr + reg+2, (val) >> 16); \
- out_be16(ace->baseaddr + reg, val); \
- }
+static u8 ace_be16_read8(void *addr)
+{
+ return in_8(addr);
+}
+
+static u16 ace_be16_read16(void *addr)
+{
+ return in_be16(addr);
+}
+
+static u32 ace_be16_read32(void *addr)
+{
+ return ((in_be16(addr+2) << 16) | (in_be16(addr)));
+}
+
+static u32 ace_be16_readdata(void *addr)
+{
+ return in_le16(addr);
+}
+
+static void ace_be16_write16(void *addr, u16 val)
+{
+ out_be16(addr, val);
+}
+
+static void ace_be16_write32(void *addr, u32 val)
+{
+ out_be16(addr+2,(val) >> 16); \
+ out_be16(addr, val);
+}
+
+static void ace_be16_writedata(void *addr, u32 val)
+{
+ out_le16(addr, val);
+}
+
+static struct reg_ops ace_ops = {
+ .read8 = ace_be16_read8,
+ .read16 = ace_be16_read16,
+ .read32 = ace_be16_read32,
+ .readdata = ace_be16_readdata,
+ .write16 = ace_be16_write16,
+ .write32 = ace_be16_write32,
+ .writedata = ace_be16_writedata
+} ;
+
#endif
struct ace_device {
@@ -222,6 +315,9 @@
int bus_width; /* 0 := 8 bit; 1 := 16 bit */
int lock_count;
+ /* Register access ops */
+ struct reg_ops *ops;
+
/* Block device data structures */
spinlock_t lock;
struct device *dev;
@@ -995,6 +1091,8 @@
ace->id = dev->id;
ace->irq = NO_IRQ;
+ ace->ops=&ace_ops;
+
for (i = 0; i < dev->num_resources; i++) {
if (dev->resource[i].flags & IORESOURCE_MEM)
ace->physaddr = dev->resource[i].start;
^ permalink raw reply
* [PATCH] powerpc: Show current speed in /proc/cpuinfo
From: Olof Johansson @ 2007-04-27 8:41 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
On other architectures, the frequency in /proc/cpuinfo moves with cpufreq
changes. It makes sense to do the same on powerpc to keep users from
getting confused. Fall back to old ppc_proc_freq for non-cpufreq systems.
Also change the format to three decimals, having full Hz granularity is
silly these days.
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: powerpc/arch/powerpc/kernel/setup-common.c
===================================================================
--- powerpc.orig/arch/powerpc/kernel/setup-common.c
+++ powerpc/arch/powerpc/kernel/setup-common.c
@@ -29,6 +29,7 @@
#include <linux/root_dev.h>
#include <linux/notifier.h>
#include <linux/cpu.h>
+#include <linux/cpufreq.h>
#include <linux/unistd.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
@@ -160,6 +161,7 @@ static int show_cpuinfo(struct seq_file
unsigned int pvr;
unsigned short maj;
unsigned short min;
+ unsigned int freq;
if (cpu_id == NR_CPUS) {
#if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
@@ -226,13 +228,15 @@ static int show_cpuinfo(struct seq_file
}
#endif /* CONFIG_TAU */
- /*
- * Assume here that all clock rates are the same in a
- * smp system. -- Cort
- */
- if (ppc_proc_freq)
- seq_printf(m, "clock\t\t: %lu.%06luMHz\n",
- ppc_proc_freq / 1000000, ppc_proc_freq % 1000000);
+ /* cpufreq_speed_get() is in kHz */
+ freq = cpufreq_quick_get(cpu_id);
+
+ if (!freq)
+ /* ppc_proc_freq is in Hz */
+ freq = ppc_proc_freq / 1000;
+
+ if (freq)
+ seq_printf(m, "clock\t\t: %u.%03uMHz\n", freq / 1000, freq % 1000);
if (ppc_md.show_percpuinfo != NULL)
ppc_md.show_percpuinfo(m, cpu_id);
^ permalink raw reply
* Some advice needed with Xilinx Framebuffer
From: Peter Mendham @ 2007-04-27 8:48 UTC (permalink / raw)
To: linuxppc-embedded
Dear all,
Thanks to Andrei, and others, I have a working framebuffer on my device,
nicely driving a standard VGA screen. I have just discovered that my
*actual* target display is rotated VGA, i.e. 480x640. I would like to
use it as a 640x480 display. I would love some advice from you
knowledgeable people as to how best to go about this. I have had some
(rather naive) thoughts:
1. Modify the hardware to read pixels from non-contiguous locations thus
leaving the framebuffer structure (as far as software is concerned)
completely intact. The major problem with this is that the hardware is
no longer doing burst reads (because locations are not contiguous) so
will be using the bus a lot less efficiently.
2. Modify the hardware to expect the framebuffer memory to be arranged
column-wise, rather than row-wise (i.e. as a 480x640 rotated display in
memory). Is there a way to get the framebuffer to still present this as
a 640x480 display?
3. Be honest about the whole thing and make the framebuffer report a
480x640 display and hope that I can rotate everything else. I believe
the console can be rotated(?) I'd also really like to run the Links
browser in direct framebuffer mode, and/or maybe X. Don't know if
that's possible but it certainly sounds like a minefield...
4. Some other secret magic hidden fourth option I don't know about.
Maybe there's a standard way of doing this?
My feeling is that I should keep the whole nasty rotated business as low
level as possible without affecting performance too much, but maybe I'm
wrong. Anything you can suggest would be greatly appreciated.
Thanks in advance,
-- Peter
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
MailScanner thanks transtec Computers for their support.
^ permalink raw reply
* Re: [PATCH] powerpc: Show current speed in /proc/cpuinfo
From: Matt Sealey @ 2007-04-27 9:00 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, paulus
In-Reply-To: <20070427084118.GA8842@lixom.net>
Olof Johansson wrote:
> On other architectures, the frequency in /proc/cpuinfo moves with cpufreq
> changes. It makes sense to do the same on powerpc to keep users from
> getting confused. Fall back to old ppc_proc_freq for non-cpufreq systems.
>
> Also change the format to three decimals, having full Hz granularity is
> silly these days.
>
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
>
>
> Index: powerpc/arch/powerpc/kernel/setup-common.c
> ===================================================================
> --- powerpc.orig/arch/powerpc/kernel/setup-common.c
> +++ powerpc/arch/powerpc/kernel/setup-common.c
> @@ -29,6 +29,7 @@
> #include <linux/root_dev.h>
> #include <linux/notifier.h>
> #include <linux/cpu.h>
> +#include <linux/cpufreq.h>
> #include <linux/unistd.h>
> #include <linux/serial.h>
> #include <linux/serial_8250.h>
> @@ -160,6 +161,7 @@ static int show_cpuinfo(struct seq_file
> unsigned int pvr;
> unsigned short maj;
> unsigned short min;
> + unsigned int freq;
>
> if (cpu_id == NR_CPUS) {
> #if defined(CONFIG_SMP) && defined(CONFIG_PPC32)
> @@ -226,13 +228,15 @@ static int show_cpuinfo(struct seq_file
> }
> #endif /* CONFIG_TAU */
>
> - /*
> - * Assume here that all clock rates are the same in a
> - * smp system. -- Cort
> - */
> - if (ppc_proc_freq)
> - seq_printf(m, "clock\t\t: %lu.%06luMHz\n",
> - ppc_proc_freq / 1000000, ppc_proc_freq % 1000000);
Would it not be relevant to keep listing the maximum CPU speed as well
as the real, current CPU speed?
Intel encode this into their CPUID string and when I bring up Windows' System
Properties dialog I get this;
Intel(R) Pentium(R) M processor 1.70GHz
593MHz, 512MB of RAM
So you can always, always find out very easily what spec your processor
is, and not just what cpufreq has done with it?
> + /* cpufreq_speed_get() is in kHz */
> + freq = cpufreq_quick_get(cpu_id);
Is it speed or quick? This and the comment below confused me, KHz or Hz? :D
> +
> + if (!freq)
> + /* ppc_proc_freq is in Hz */
> + freq = ppc_proc_freq / 1000;
> +
> + if (freq)
> + seq_printf(m, "clock\t\t: %u.%03uMHz\n", freq / 1000, freq % 1000);
--
Matt Sealey <matt@genesi-usa.com>
Genesi, Manager, Developer Relations
^ permalink raw reply
* Re: [PATCH] powerpc: Show current speed in /proc/cpuinfo
From: Benjamin Herrenschmidt @ 2007-04-27 9:24 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, paulus
In-Reply-To: <20070427084118.GA8842@lixom.net>
On Fri, 2007-04-27 at 03:41 -0500, Olof Johansson wrote:
> On other architectures, the frequency in /proc/cpuinfo moves with cpufreq
> changes. It makes sense to do the same on powerpc to keep users from
> getting confused. Fall back to old ppc_proc_freq for non-cpufreq systems.
>
> Also change the format to three decimals, having full Hz granularity is
> silly these days.
That doesn't work if cpufreq is a module... on mac, I used to have
exactly that hack, though at one point I changed to just updating
ppc_proc_freq :-) But then, it's easy because I only change the freq on
all CPUs at the same time. Might be different for you.
Ben.
^ permalink raw reply
* Re: [PATCH] powerpc: Show current speed in /proc/cpuinfo
From: Benjamin Herrenschmidt @ 2007-04-27 9:25 UTC (permalink / raw)
To: Matt Sealey; +Cc: Olof Johansson, linuxppc-dev, paulus
In-Reply-To: <4631BBB1.9010705@genesi-usa.com>
> Would it not be relevant to keep listing the maximum CPU speed as well
> as the real, current CPU speed?
Probably not in cpuinfo... there's already a place for that in sysfs.
Ben.
^ permalink raw reply
* Re: [PATCH v2] [2.6.22] pasemi: cpufreq driver
From: Johannes Berg @ 2007-04-27 9:40 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev, egor, paulus, arnd, cpufreq
In-Reply-To: <20070426203710.GB17302@lixom.net>
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
On Thu, 2007-04-26 at 15:37 -0500, Olof Johansson wrote:
> You can set the requested speed per-processor, but the actual speed
> will be the max of them. Because of this, it's less surprising to set
> it on both at the same time since then you'll at least know what you're
> running at.
>
> So yes, I'll change it to online_map instead of possible_map.
Ok, yeah, so effectively they all just go together (that additional
complication of running at the max probably should be hidden as you
note)
> Hmm, I just tried adding debugging to the cpu_init code, and I'm not
> seeing it called more than once (i.e. only for cpu 0). Mind you, I don't
> have cpu hotplug support at this time.
Oh right, you need cpu hotplug support for the bug to show up. What
happens then is you unplug and replug a CPU and the sysfs cpufreq stuff
for the CPU you just replugged is gone.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply
* Re: mpc5200 and spi bus
From: Asier Llano Palacios @ 2007-04-27 10:36 UTC (permalink / raw)
To: Txema Lopez; +Cc: linuxppc-embedded
In-Reply-To: <4630BBF9.7000305@aotek.es>
I'm working with the a linux 2.6.20.9 with patches from Sylvain's tree.
I've been looking the Den'x 2.5.xx SPI support and it seems that it is
done through GPIOs. I'd like a native SPI implementation, using the
hardware of the MPC5200, because of the performance issue of using a
GPIO, because I'd like to use it at full speed.
Is it done really with GPIOs? If so, is there any other implementation?
If it is possible I'd like it to be for 2.6.x.
Thank you,
Asier
El jue, 26-04-2007 a las 16:49 +0200, Txema Lopez escribi=F3:
> Asier Llano Palacios wrote:
>=20
> >I've seen some comments about drivers for SPI of the MPC5200. I'm not
> >sure about it, but is there anything functional about it?. I want to
> >know if there is anything already done, in order to use it or improve
> >it. I need a driver of the SPI bus, so if it is not implemented at =
all
> >we should contribute it.
> >
> > =20
> >
> The Denx's 2.4.xx top of tree kernel has MPC5200 SPI support. We are=20
> using the SPI dev interface from a user aplication and it works fine.
>=20
>=20
=20
----------------------------------------- PLEASE NOTE =
-------------------------------------------
This message, along with any attachments, may be confidential or legally =
privileged.=20
It is intended only for the named person(s), who is/are the only =
authorized recipients.
If this message has reached you in error, kindly destroy it without =
review and notify the sender immediately.
Thank you for your help.
=B5SysCom uses virus scanning software but excludes any liability for =
viruses contained in any attachment.
=20
------------------------------------ ROGAMOS LEA ESTE TEXTO =
-------------------------------
Este mensaje y sus anexos pueden contener informaci=F3n confidencial y/o =
con derecho legal.=20
Est=E1 dirigido =FAnicamente a la/s persona/s o entidad/es rese=F1adas =
como =FAnico destinatario autorizado.
Si este mensaje le hubiera llegado por error, por favor elim=EDnelo sin =
revisarlo ni reenviarlo y notif=EDquelo inmediatamente al remitente. =
Gracias por su colaboraci=F3n. =20
=B5SysCom utiliza software antivirus, pero no se hace responsable de los =
virus contenidos en los ficheros anexos.
^ 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