aboutsummaryrefslogtreecommitdiff
path: root/drivers/sbus/char
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-06-22 19:12:03 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-23 23:15:28 -0700
commit690c8fd31f1e35985d0f35772fde514da59ec9d1 (patch)
tree8a5a0036b3780a9eb315ea2201a2562570de1ebe /drivers/sbus/char
parentde8d28b16f5614aeb12bb69c8f9a38578b8d3ada (diff)
[SPARC64]: Use in-kernel PROM tree for EBUS and ISA.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/sbus/char')
-rw-r--r--drivers/sbus/char/bbc_envctrl.c4
-rw-r--r--drivers/sbus/char/bbc_i2c.c4
-rw-r--r--drivers/sbus/char/display7seg.c2
-rw-r--r--drivers/sbus/char/envctrl.c71
-rw-r--r--drivers/sbus/char/flash.c16
5 files changed, 47 insertions, 50 deletions
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index d89f83f769f..1cc706e1111 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -575,9 +575,9 @@ int bbc_envctrl_init(void)
int devidx = 0;
while ((echild = bbc_i2c_getdev(devidx++)) != NULL) {
- if (!strcmp(echild->prom_name, "temperature"))
+ if (!strcmp(echild->prom_node->name, "temperature"))
attach_one_temp(echild, temp_index++);
- if (!strcmp(echild->prom_name, "fan-control"))
+ if (!strcmp(echild->prom_node->name, "fan-control"))
attach_one_fan(echild, fan_index++);
}
if (temp_index != 0 && fan_index != 0) {
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 3e156e005f2..73634371393 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -423,7 +423,7 @@ static int __init bbc_present(void)
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
- if (!strcmp(edev->prom_name, "bbc"))
+ if (!strcmp(edev->prom_node->name, "bbc"))
return 1;
}
}
@@ -446,7 +446,7 @@ static int __init bbc_i2c_init(void)
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
- if (!strcmp(edev->prom_name, "i2c")) {
+ if (!strcmp(edev->prom_node->name, "i2c")) {
if (!attach_one_i2c(edev, index))
index++;
}
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index c3a51d1fae5..d92bc8827a9 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -184,7 +184,7 @@ static int __init d7s_init(void)
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
- if (!strcmp(edev->prom_name, D7S_OBPNAME))
+ if (!strcmp(edev->prom_node->name, D7S_OBPNAME))
goto ebus_done;
}
}
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 19e8eddf887..cf97e9efe9b 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -768,16 +768,14 @@ static void envctrl_set_mon(struct i2c_child_t *pchild,
* decoding tables, monitor type, optional properties.
* Return: None.
*/
-static void envctrl_init_adc(struct i2c_child_t *pchild, int node)
+static void envctrl_init_adc(struct i2c_child_t *pchild, struct device_node *dp)
{
- char chnls_desc[CHANNEL_DESC_SZ];
int i = 0, len;
- char *pos = chnls_desc;
+ char *pos;
+ unsigned int *pval;
/* Firmware describe channels into a stream separated by a '\0'. */
- len = prom_getproperty(node, "channels-description", chnls_desc,
- CHANNEL_DESC_SZ);
- chnls_desc[CHANNEL_DESC_SZ - 1] = '\0';
+ pos = of_get_property(dp, "channels-description", &len);
while (len > 0) {
int l = strlen(pos) + 1;
@@ -787,10 +785,13 @@ static void envctrl_init_adc(struct i2c_child_t *pchild, int node)
}
/* Get optional properties. */
- len = prom_getproperty(node, "warning-temp", (char *)&warning_temperature,
- sizeof(warning_temperature));
- len = prom_getproperty(node, "shutdown-temp", (char *)&shutdown_temperature,
- sizeof(shutdown_temperature));
+ pval = of_get_property(dp, "warning-temp", NULL);
+ if (pval)
+ warning_temperature = *pval;
+
+ pval = of_get_property(dp, "shutdown-temp", NULL);
+ if (pval)
+ shutdown_temperature = *pval;
}
/* Function Description: Initialize child device monitoring fan status.
@@ -864,21 +865,18 @@ static void envctrl_init_voltage_status(struct i2c_child_t *pchild)
static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
struct i2c_child_t *pchild)
{
- int node, len, i, tbls_size = 0;
-
- node = edev_child->prom_node;
+ int len, i, tbls_size = 0;
+ struct device_node *dp = edev_child->prom_node;
+ void *pval;
/* Get device address. */
- len = prom_getproperty(node, "reg",
- (char *) &(pchild->addr),
- sizeof(pchild->addr));
+ pval = of_get_property(dp, "reg", &len);
+ memcpy(&pchild->addr, pval, len);
/* Get tables property. Read firmware temperature tables. */
- len = prom_getproperty(node, "translation",
- (char *) pchild->tblprop_array,
- (PCF8584_MAX_CHANNELS *
- sizeof(struct pcf8584_tblprop)));
- if (len > 0) {
+ pval = of_get_property(dp, "translation", &len);
+ if (pval && len > 0) {
+ memcpy(pchild->tblprop_array, pval, len);
pchild->total_tbls = len / sizeof(struct pcf8584_tblprop);
for (i = 0; i < pchild->total_tbls; i++) {
if ((pchild->tblprop_array[i].size + pchild->tblprop_array[i].offset) > tbls_size) {
@@ -891,12 +889,12 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
printk("envctrl: Failed to allocate table.\n");
return;
}
- len = prom_getproperty(node, "tables",
- (char *) pchild->tables, tbls_size);
- if (len <= 0) {
+ pval = of_get_property(dp, "tables", &len);
+ if (!pval || len <= 0) {
printk("envctrl: Failed to get table.\n");
return;
}
+ memcpy(pchild->tables, pval, len);
}
/* SPARCengine ASM Reference Manual (ref. SMI doc 805-7581-04)
@@ -907,12 +905,11 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
* 'NULL' monitor type.
*/
if (ENVCTRL_CPCI_IGNORED_NODE == pchild->addr) {
+ struct device_node *root_node;
int len;
- char prop[56];
- len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop));
- if (0 < len && (0 == strncmp(prop, "SUNW,UltraSPARC-IIi-cEngine", len)))
- {
+ root_node = of_find_node_by_path("/");
+ if (!strcmp(root_node->name, "SUNW,UltraSPARC-IIi-cEngine")) {
for (len = 0; len < PCF8584_MAX_CHANNELS; ++len) {
pchild->mon_type[len] = ENVCTRL_NOMON;
}
@@ -921,16 +918,14 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
}
/* Get the monitor channels. */
- len = prom_getproperty(node, "channels-in-use",
- (char *) pchild->chnl_array,
- (PCF8584_MAX_CHANNELS *
- sizeof(struct pcf8584_channel)));
+ pval = of_get_property(dp, "channels-in-use", &len);
+ memcpy(pchild->chnl_array, pval, len);
pchild->total_chnls = len / sizeof(struct pcf8584_channel);
for (i = 0; i < pchild->total_chnls; i++) {
switch (pchild->chnl_array[i].type) {
case PCF8584_TEMP_TYPE:
- envctrl_init_adc(pchild, node);
+ envctrl_init_adc(pchild, dp);
break;
case PCF8584_GLOBALADDR_TYPE:
@@ -945,7 +940,7 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
case PCF8584_VOLTAGE_TYPE:
if (pchild->i2ctype == I2C_ADC) {
- envctrl_init_adc(pchild,node);
+ envctrl_init_adc(pchild,dp);
} else {
envctrl_init_voltage_status(pchild);
}
@@ -1046,7 +1041,7 @@ static int __init envctrl_init(void)
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
- if (!strcmp(edev->prom_name, "bbc")) {
+ if (!strcmp(edev->prom_node->name, "bbc")) {
/* If we find a boot-bus controller node,
* then this envctrl driver is not for us.
*/
@@ -1060,14 +1055,14 @@ static int __init envctrl_init(void)
*/
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
- if (!strcmp(edev->prom_name, "i2c")) {
+ if (!strcmp(edev->prom_node->name, "i2c")) {
i2c = ioremap(edev->resource[0].start, 0x2);
for_each_edevchild(edev, edev_child) {
- if (!strcmp("gpio", edev_child->prom_name)) {
+ if (!strcmp("gpio", edev_child->prom_node->name)) {
i2c_childlist[i].i2ctype = I2C_GPIO;
envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++]));
}
- if (!strcmp("adc", edev_child->prom_name)) {
+ if (!strcmp("adc", edev_child->prom_node->name)) {
i2c_childlist[i].i2ctype = I2C_ADC;
envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++]));
}
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 2beb3dded08..5ae684c011f 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -192,9 +192,11 @@ static int __init flash_init(void)
}
if (!sdev) {
#ifdef CONFIG_PCI
+ struct linux_prom_registers *ebus_regs;
+
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
- if (!strcmp(edev->prom_name, "flashprom"))
+ if (!strcmp(edev->prom_node->name, "flashprom"))
goto ebus_done;
}
}
@@ -202,23 +204,23 @@ static int __init flash_init(void)
if (!edev)
return -ENODEV;
- len = prom_getproperty(edev->prom_node, "reg", (void *)regs, sizeof(regs));
- if ((len % sizeof(regs[0])) != 0) {
+ ebus_regs = of_get_property(edev->prom_node, "reg", &len);
+ if (!ebus_regs || (len % sizeof(regs[0])) != 0) {
printk("flash: Strange reg property size %d\n", len);
return -ENODEV;
}
- nregs = len / sizeof(regs[0]);
+ nregs = len / sizeof(ebus_regs[0]);
flash.read_base = edev->resource[0].start;
- flash.read_size = regs[0].reg_size;
+ flash.read_size = ebus_regs[0].reg_size;
if (nregs == 1) {
flash.write_base = edev->resource[0].start;
- flash.write_size = regs[0].reg_size;
+ flash.write_size = ebus_regs[0].reg_size;
} else if (nregs == 2) {
flash.write_base = edev->resource[1].start;
- flash.write_size = regs[1].reg_size;
+ flash.write_size = ebus_regs[1].reg_size;
} else {
printk("flash: Strange number of regs %d\n", nregs);
return -ENODEV;