* [PATCH 5/5] ibmebus: More speaking error return code in ibmebus_store_probe()
From: Joachim Fenkes @ 2007-09-25 12:13 UTC (permalink / raw)
To: Paul Mackerras, LinuxPPC-Dev, LKML
Cc: Thomas Klein, Arnd Bergmann, Jan-Bernd Themann, Paul Mackerras,
Christoph Raisch, Stefan Roscher
In-Reply-To: <200709251410.29780.fenkes@de.ibm.com>
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
arch/powerpc/kernel/ibmebus.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 379472f..8c08a98 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -270,10 +270,10 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
return -ENOMEM;
if (bus_find_device(&ibmebus_bus_type, NULL, path,
- ibmebus_match_path)) {
+ ibmebus_match_path)) {
printk(KERN_WARNING "%s: %s has already been probed\n",
__FUNCTION__, path);
- rc = -EINVAL;
+ rc = -EEXIST;
goto out;
}
--
1.5.2
^ permalink raw reply related
* [PATCH 4/5] ibmebus: Move to of_device and of_platform_driver, match eHCA and eHEA drivers
From: Joachim Fenkes @ 2007-09-25 12:12 UTC (permalink / raw)
To: Paul Mackerras, LinuxPPC-Dev, LKML
Cc: Thomas Klein, Arnd Bergmann, Jan-Bernd Themann, Paul Mackerras,
Christoph Raisch, Stefan Roscher
In-Reply-To: <200709251410.29780.fenkes@de.ibm.com>
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
drivers/infiniband/hw/ehca/ehca_classes.h | 2 +-
drivers/net/ehea/ehea.h | 2 +-
include/asm-powerpc/ibmebus.h | 38 +++------------
arch/powerpc/kernel/ibmebus.c | 28 ++++++-----
drivers/infiniband/hw/ehca/ehca_eq.c | 6 +-
drivers/infiniband/hw/ehca/ehca_main.c | 32 ++++++------
drivers/net/ehea/ehea_main.c | 72 ++++++++++++++--------------
7 files changed, 79 insertions(+), 101 deletions(-)
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index c2edd4c..8ca4dd4 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -106,7 +106,7 @@ struct ehca_sport {
struct ehca_shca {
struct ib_device ib_device;
- struct ibmebus_dev *ibmebus_dev;
+ struct of_device *ofdev;
u8 num_ports;
int hw_level;
struct list_head shca_list;
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 8d58be5..830a66a 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -382,7 +382,7 @@ struct ehea_port_res {
#define EHEA_MAX_PORTS 16
struct ehea_adapter {
u64 handle;
- struct ibmebus_dev *ebus_dev;
+ struct of_device *ofdev;
struct ehea_port *port[EHEA_MAX_PORTS];
struct ehea_eq *neq; /* notification event queue */
struct workqueue_struct *ehea_wq;
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h
index 87d396e..1a9d9ae 100644
--- a/include/asm-powerpc/ibmebus.h
+++ b/include/asm-powerpc/ibmebus.h
@@ -43,42 +43,18 @@
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/mod_devicetable.h>
-#include <asm/of_device.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
extern struct bus_type ibmebus_bus_type;
-struct ibmebus_dev {
- struct of_device ofdev;
-};
+int ibmebus_register_driver(struct of_platform_driver *drv);
+void ibmebus_unregister_driver(struct of_platform_driver *drv);
-struct ibmebus_driver {
- char *name;
- struct of_device_id *id_table;
- int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id);
- int (*remove) (struct ibmebus_dev *dev);
- struct device_driver driver;
-};
-
-int ibmebus_register_driver(struct ibmebus_driver *drv);
-void ibmebus_unregister_driver(struct ibmebus_driver *drv);
-
-int ibmebus_request_irq(struct ibmebus_dev *dev,
- u32 ist,
- irq_handler_t handler,
- unsigned long irq_flags, const char * devname,
+int ibmebus_request_irq(u32 ist, irq_handler_t handler,
+ unsigned long irq_flags, const char *devname,
void *dev_id);
-void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id);
-
-static inline struct ibmebus_driver *to_ibmebus_driver(struct device_driver *drv)
-{
- return container_of(drv, struct ibmebus_driver, driver);
-}
-
-static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev)
-{
- return container_of(dev, struct ibmebus_dev, ofdev.dev);
-}
-
+void ibmebus_free_irq(u32 ist, void *dev_id);
#endif /* __KERNEL__ */
#endif /* _ASM_IBMEBUS_H */
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index c506e0d..379472f 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -194,21 +194,26 @@ static int ibmebus_create_devices(const struct of_device_id *matches)
return ret;
}
-int ibmebus_register_driver(struct ibmebus_driver *drv)
+int ibmebus_register_driver(struct of_platform_driver *drv)
{
- return 0;
+ /* If the driver uses devices that ibmebus doesn't know, add them */
+ ibmebus_create_devices(drv->match_table);
+
+ drv->driver.name = drv->name;
+ drv->driver.bus = &ibmebus_bus_type;
+
+ return driver_register(&drv->driver);
}
EXPORT_SYMBOL(ibmebus_register_driver);
-void ibmebus_unregister_driver(struct ibmebus_driver *drv)
+void ibmebus_unregister_driver(struct of_platform_driver *drv)
{
+ driver_unregister(&drv->driver);
}
EXPORT_SYMBOL(ibmebus_unregister_driver);
-int ibmebus_request_irq(struct ibmebus_dev *dev,
- u32 ist,
- irq_handler_t handler,
- unsigned long irq_flags, const char * devname,
+int ibmebus_request_irq(u32 ist, irq_handler_t handler,
+ unsigned long irq_flags, const char *devname,
void *dev_id)
{
unsigned int irq = irq_create_mapping(NULL, ist);
@@ -216,12 +221,11 @@ int ibmebus_request_irq(struct ibmebus_dev *dev,
if (irq == NO_IRQ)
return -EINVAL;
- return request_irq(irq, handler,
- irq_flags, devname, dev_id);
+ return request_irq(irq, handler, irq_flags, devname, dev_id);
}
EXPORT_SYMBOL(ibmebus_request_irq);
-void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id)
+void ibmebus_free_irq(u32 ist, void *dev_id)
{
unsigned int irq = irq_find_mapping(NULL, ist);
@@ -232,9 +236,7 @@ EXPORT_SYMBOL(ibmebus_free_irq);
static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
- const char *name = of_get_property(ebus_dev->ofdev.node, "name", NULL);
- return sprintf(buf, "%s\n", name);
+ return sprintf(buf, "%s\n", to_of_device(dev)->node->name);
}
static struct device_attribute ibmebus_dev_attrs[] = {
diff --git a/drivers/infiniband/hw/ehca/ehca_eq.c b/drivers/infiniband/hw/ehca/ehca_eq.c
index 1d41faa..b4ac617 100644
--- a/drivers/infiniband/hw/ehca/ehca_eq.c
+++ b/drivers/infiniband/hw/ehca/ehca_eq.c
@@ -123,7 +123,7 @@ int ehca_create_eq(struct ehca_shca *shca,
/* register interrupt handlers and initialize work queues */
if (type == EHCA_EQ) {
- ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_eq,
+ ret = ibmebus_request_irq(eq->ist, ehca_interrupt_eq,
IRQF_DISABLED, "ehca_eq",
(void *)shca);
if (ret < 0)
@@ -131,7 +131,7 @@ int ehca_create_eq(struct ehca_shca *shca,
tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca);
} else if (type == EHCA_NEQ) {
- ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_neq,
+ ret = ibmebus_request_irq(eq->ist, ehca_interrupt_neq,
IRQF_DISABLED, "ehca_neq",
(void *)shca);
if (ret < 0)
@@ -171,7 +171,7 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq)
u64 h_ret;
spin_lock_irqsave(&eq->spinlock, flags);
- ibmebus_free_irq(NULL, eq->ist, (void *)shca);
+ ibmebus_free_irq(eq->ist, (void *)shca);
h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq);
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index c84e310..8a038b1 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -404,7 +404,7 @@ int ehca_init_device(struct ehca_shca *shca)
shca->ib_device.node_type = RDMA_NODE_IB_CA;
shca->ib_device.phys_port_cnt = shca->num_ports;
shca->ib_device.num_comp_vectors = 1;
- shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev;
+ shca->ib_device.dma_device = &shca->ofdev->dev;
shca->ib_device.query_device = ehca_query_device;
shca->ib_device.query_port = ehca_query_port;
shca->ib_device.query_gid = ehca_query_gid;
@@ -658,7 +658,7 @@ static struct attribute_group ehca_dev_attr_grp = {
.attrs = ehca_dev_attrs
};
-static int __devinit ehca_probe(struct ibmebus_dev *dev,
+static int __devinit ehca_probe(struct of_device *dev,
const struct of_device_id *id)
{
struct ehca_shca *shca;
@@ -666,16 +666,16 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
struct ib_pd *ibpd;
int ret;
- handle = of_get_property(dev->ofdev.node, "ibm,hca-handle", NULL);
+ handle = of_get_property(dev->node, "ibm,hca-handle", NULL);
if (!handle) {
ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
- dev->ofdev.node->full_name);
+ dev->node->full_name);
return -ENODEV;
}
if (!(*handle)) {
ehca_gen_err("Wrong eHCA handle for adapter: %s.",
- dev->ofdev.node->full_name);
+ dev->node->full_name);
return -ENODEV;
}
@@ -686,9 +686,9 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
}
mutex_init(&shca->modify_mutex);
- shca->ibmebus_dev = dev;
+ shca->ofdev = dev;
shca->ipz_hca_handle.handle = *handle;
- dev->ofdev.dev.driver_data = shca;
+ dev->dev.driver_data = shca;
ret = ehca_sense_attributes(shca);
if (ret < 0) {
@@ -764,7 +764,7 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev,
}
}
- ret = sysfs_create_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp);
+ ret = sysfs_create_group(&dev->dev.kobj, &ehca_dev_attr_grp);
if (ret) /* only complain; we can live without attributes */
ehca_err(&shca->ib_device,
"Cannot create device attributes ret=%d", ret);
@@ -814,12 +814,12 @@ probe1:
return -EINVAL;
}
-static int __devexit ehca_remove(struct ibmebus_dev *dev)
+static int __devexit ehca_remove(struct of_device *dev)
{
- struct ehca_shca *shca = dev->ofdev.dev.driver_data;
+ struct ehca_shca *shca = dev->dev.driver_data;
int ret;
- sysfs_remove_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp);
+ sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp);
if (ehca_open_aqp1 == 1) {
int i;
@@ -870,11 +870,11 @@ static struct of_device_id ehca_device_table[] =
{},
};
-static struct ibmebus_driver ehca_driver = {
- .name = "ehca",
- .id_table = ehca_device_table,
- .probe = ehca_probe,
- .remove = ehca_remove,
+static struct of_platform_driver ehca_driver = {
+ .name = "ehca",
+ .match_table = ehca_device_table,
+ .probe = ehca_probe,
+ .remove = ehca_remove,
};
void ehca_poll_eqs(unsigned long data)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 717b129..a4d4150 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -89,10 +89,10 @@ struct workqueue_struct *ehea_driver_wq;
struct work_struct ehea_rereg_mr_task;
-static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
+static int __devinit ehea_probe_adapter(struct of_device *dev,
const struct of_device_id *id);
-static int __devexit ehea_remove(struct ibmebus_dev *dev);
+static int __devexit ehea_remove(struct of_device *dev);
static struct of_device_id ehea_device_table[] = {
{
@@ -102,9 +102,9 @@ static struct of_device_id ehea_device_table[] = {
{},
};
-static struct ibmebus_driver ehea_driver = {
+static struct of_platform_driver ehea_driver = {
.name = "ehea",
- .id_table = ehea_device_table,
+ .match_table = ehea_device_table,
.probe = ehea_probe_adapter,
.remove = ehea_remove,
};
@@ -968,7 +968,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1, "%s-aff",
dev->name);
- ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1,
+ ret = ibmebus_request_irq(port->qp_eq->attr.ist1,
ehea_qp_aff_irq_handler,
IRQF_DISABLED, port->int_aff_name, port);
if (ret) {
@@ -986,7 +986,7 @@ static int ehea_reg_interrupts(struct net_device *dev)
pr = &port->port_res[i];
snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1,
"%s-queue%d", dev->name, i);
- ret = ibmebus_request_irq(NULL, pr->eq->attr.ist1,
+ ret = ibmebus_request_irq(pr->eq->attr.ist1,
ehea_recv_irq_handler,
IRQF_DISABLED, pr->int_send_name,
pr);
@@ -1007,11 +1007,11 @@ out:
out_free_req:
while (--i >= 0) {
u32 ist = port->port_res[i].eq->attr.ist1;
- ibmebus_free_irq(NULL, ist, &port->port_res[i]);
+ ibmebus_free_irq(ist, &port->port_res[i]);
}
out_free_qpeq:
- ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port);
+ ibmebus_free_irq(port->qp_eq->attr.ist1, port);
i = port->num_def_qps;
goto out;
@@ -1028,14 +1028,14 @@ static void ehea_free_interrupts(struct net_device *dev)
for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
pr = &port->port_res[i];
- ibmebus_free_irq(NULL, pr->eq->attr.ist1, pr);
+ ibmebus_free_irq(pr->eq->attr.ist1, pr);
if (netif_msg_intr(port))
ehea_info("free send irq for res %d with handle 0x%X",
i, pr->eq->attr.ist1);
}
/* associated events */
- ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port);
+ ibmebus_free_irq(port->qp_eq->attr.ist1, port);
if (netif_msg_intr(port))
ehea_info("associated event interrupt for handle 0x%X freed",
port->qp_eq->attr.ist1);
@@ -2548,7 +2548,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
int ret;
port->ofdev.node = of_node_get(dn);
- port->ofdev.dev.parent = &port->adapter->ebus_dev->ofdev.dev;
+ port->ofdev.dev.parent = &port->adapter->ofdev->dev;
port->ofdev.dev.bus = &ibmebus_bus_type;
sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++);
@@ -2729,7 +2729,7 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
const u32 *dn_log_port_id;
int i = 0;
- lhea_dn = adapter->ebus_dev->ofdev.node;
+ lhea_dn = adapter->ofdev->node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
@@ -2769,7 +2769,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
struct device_node *eth_dn = NULL;
const u32 *dn_log_port_id;
- lhea_dn = adapter->ebus_dev->ofdev.node;
+ lhea_dn = adapter->ofdev->node;
while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
@@ -2875,31 +2875,31 @@ static ssize_t ehea_remove_port(struct device *dev,
static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port);
static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port);
-int ehea_create_device_sysfs(struct ibmebus_dev *dev)
+int ehea_create_device_sysfs(struct of_device *dev)
{
- int ret = device_create_file(&dev->ofdev.dev, &dev_attr_probe_port);
+ int ret = device_create_file(&dev->dev, &dev_attr_probe_port);
if (ret)
goto out;
- ret = device_create_file(&dev->ofdev.dev, &dev_attr_remove_port);
+ ret = device_create_file(&dev->dev, &dev_attr_remove_port);
out:
return ret;
}
-void ehea_remove_device_sysfs(struct ibmebus_dev *dev)
+void ehea_remove_device_sysfs(struct of_device *dev)
{
- device_remove_file(&dev->ofdev.dev, &dev_attr_probe_port);
- device_remove_file(&dev->ofdev.dev, &dev_attr_remove_port);
+ device_remove_file(&dev->dev, &dev_attr_probe_port);
+ device_remove_file(&dev->dev, &dev_attr_remove_port);
}
-static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
+static int __devinit ehea_probe_adapter(struct of_device *dev,
const struct of_device_id *id)
{
struct ehea_adapter *adapter;
const u64 *adapter_handle;
int ret;
- if (!dev || !dev->ofdev.node) {
+ if (!dev || !dev->node) {
ehea_error("Invalid ibmebus device probed");
return -EINVAL;
}
@@ -2907,36 +2907,36 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
if (!adapter) {
ret = -ENOMEM;
- dev_err(&dev->ofdev.dev, "no mem for ehea_adapter\n");
+ dev_err(&dev->dev, "no mem for ehea_adapter\n");
goto out;
}
list_add(&adapter->list, &adapter_list);
- adapter->ebus_dev = dev;
+ adapter->ofdev = dev;
- adapter_handle = of_get_property(dev->ofdev.node, "ibm,hea-handle",
+ adapter_handle = of_get_property(dev->node, "ibm,hea-handle",
NULL);
if (adapter_handle)
adapter->handle = *adapter_handle;
if (!adapter->handle) {
- dev_err(&dev->ofdev.dev, "failed getting handle for adapter"
- " '%s'\n", dev->ofdev.node->full_name);
+ dev_err(&dev->dev, "failed getting handle for adapter"
+ " '%s'\n", dev->node->full_name);
ret = -ENODEV;
goto out_free_ad;
}
adapter->pd = EHEA_PD_ID;
- dev->ofdev.dev.driver_data = adapter;
+ dev->dev.driver_data = adapter;
/* initialize adapter and ports */
/* get adapter properties */
ret = ehea_sense_adapter_attr(adapter);
if (ret) {
- dev_err(&dev->ofdev.dev, "sense_adapter_attr failed: %d", ret);
+ dev_err(&dev->dev, "sense_adapter_attr failed: %d", ret);
goto out_free_ad;
}
@@ -2944,18 +2944,18 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1);
if (!adapter->neq) {
ret = -EIO;
- dev_err(&dev->ofdev.dev, "NEQ creation failed");
+ dev_err(&dev->dev, "NEQ creation failed");
goto out_free_ad;
}
tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet,
(unsigned long)adapter);
- ret = ibmebus_request_irq(NULL, adapter->neq->attr.ist1,
+ ret = ibmebus_request_irq(adapter->neq->attr.ist1,
ehea_interrupt_neq, IRQF_DISABLED,
"ehea_neq", adapter);
if (ret) {
- dev_err(&dev->ofdev.dev, "requesting NEQ IRQ failed");
+ dev_err(&dev->dev, "requesting NEQ IRQ failed");
goto out_kill_eq;
}
@@ -2971,7 +2971,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
ret = ehea_setup_ports(adapter);
if (ret) {
- dev_err(&dev->ofdev.dev, "setup_ports failed");
+ dev_err(&dev->dev, "setup_ports failed");
goto out_rem_dev_sysfs;
}
@@ -2985,7 +2985,7 @@ out_kill_wq:
destroy_workqueue(adapter->ehea_wq);
out_free_irq:
- ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter);
+ ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
out_kill_eq:
ehea_destroy_eq(adapter->neq);
@@ -2996,9 +2996,9 @@ out:
return ret;
}
-static int __devexit ehea_remove(struct ibmebus_dev *dev)
+static int __devexit ehea_remove(struct of_device *dev)
{
- struct ehea_adapter *adapter = dev->ofdev.dev.driver_data;
+ struct ehea_adapter *adapter = dev->dev.driver_data;
int i;
for (i = 0; i < EHEA_MAX_PORTS; i++)
@@ -3011,7 +3011,7 @@ static int __devexit ehea_remove(struct ibmebus_dev *dev)
destroy_workqueue(adapter->ehea_wq);
- ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter);
+ ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
tasklet_kill(&adapter->neq_tasklet);
ehea_destroy_eq(adapter->neq);
--
1.5.2
^ permalink raw reply related
* [PATCH 3/5] ibmebus: Add device creation and bus probing based on of_device
From: Joachim Fenkes @ 2007-09-25 12:12 UTC (permalink / raw)
To: Paul Mackerras, LinuxPPC-Dev, LKML
Cc: Thomas Klein, Arnd Bergmann, Jan-Bernd Themann, Paul Mackerras,
Christoph Raisch, Stefan Roscher
In-Reply-To: <200709251410.29780.fenkes@de.ibm.com>
The devtree root is now searched for devices matching a built-in whitelist
during boot, so these devices appear on the bus from the beginning. It is
still possible to manually add/remove devices to/from the bus by using the
probe/remove sysfs interface. Also, when a device driver registers itself,
the devtree is matched against its matchlist.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
arch/powerpc/kernel/ibmebus.c | 97 ++++++++++++++++++++++++++++++++++-------
1 files changed, 81 insertions(+), 16 deletions(-)
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index cc80f84..c506e0d 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -51,6 +51,15 @@ static struct device ibmebus_bus_device = { /* fake "parent" device */
struct bus_type ibmebus_bus_type;
+/* These devices will automatically be added to the bus during init */
+static struct of_device_id builtin_matches[] = {
+ { .name = "lhca" },
+ { .compatible = "IBM,lhca" },
+ { .name = "lhea" },
+ { .compatible = "IBM,lhea" },
+ {},
+};
+
static void *ibmebus_alloc_coherent(struct device *dev,
size_t size,
dma_addr_t *dma_handle,
@@ -124,6 +133,67 @@ static struct dma_mapping_ops ibmebus_dma_ops = {
.dma_supported = ibmebus_dma_supported,
};
+static int ibmebus_match_path(struct device *dev, void *data)
+{
+ struct device_node *dn = to_of_device(dev)->node;
+ return (dn->full_name &&
+ (strcasecmp((char *)data, dn->full_name) == 0));
+}
+
+static int ibmebus_match_node(struct device *dev, void *data)
+{
+ return to_of_device(dev)->node == data;
+}
+
+static int ibmebus_create_device(struct device_node *dn)
+{
+ struct of_device *dev;
+ int ret;
+
+ dev = of_device_alloc(dn, NULL, &ibmebus_bus_device);
+ if (!dev)
+ return -ENOMEM;
+
+ dev->dev.bus = &ibmebus_bus_type;
+ dev->dev.archdata.dma_ops = &ibmebus_dma_ops;
+
+ ret = of_device_register(dev);
+ if (ret) {
+ of_device_free(dev);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int ibmebus_create_devices(const struct of_device_id *matches)
+{
+ struct device_node *root, *child;
+ int ret = 0;
+
+ root = of_find_node_by_path("/");
+
+ for (child = NULL; (child = of_get_next_child(root, child)); ) {
+ if (!of_match_node(matches, child))
+ continue;
+
+ if (bus_find_device(&ibmebus_bus_type, NULL, child,
+ ibmebus_match_node))
+ continue;
+
+ ret = ibmebus_create_device(child);
+ if (ret) {
+ printk(KERN_ERR "%s: failed to create device (%i)",
+ __FUNCTION__, ret);
+ of_node_put(child);
+ break;
+ }
+ }
+
+ of_node_put(root);
+ return ret;
+}
+
int ibmebus_register_driver(struct ibmebus_driver *drv)
{
return 0;
@@ -172,18 +242,6 @@ static struct device_attribute ibmebus_dev_attrs[] = {
__ATTR_NULL
};
-static int ibmebus_match_path(struct device *dev, void *data)
-{
- int rc;
- struct device_node *dn =
- of_node_get(to_ibmebus_dev(dev)->ofdev.node);
-
- rc = (dn->full_name && (strcasecmp((char*)data, dn->full_name) == 0));
-
- of_node_put(dn);
- return rc;
-}
-
static char *ibmebus_chomp(const char *in, size_t count)
{
char *out = (char*)kmalloc(count + 1, GFP_KERNEL);
@@ -202,7 +260,6 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
const char *buf, size_t count)
{
struct device_node *dn = NULL;
- struct ibmebus_dev *dev;
char *path;
ssize_t rc;
@@ -219,9 +276,9 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
}
if ((dn = of_find_node_by_path(path))) {
-/* dev = ibmebus_register_device_node(dn); */
+ rc = ibmebus_create_device(dn);
of_node_put(dn);
- rc = IS_ERR(dev) ? PTR_ERR(dev) : count;
+ rc = rc ? rc : count;
} else {
printk(KERN_WARNING "%s: no such device node: %s\n",
__FUNCTION__, path);
@@ -245,7 +302,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path,
ibmebus_match_path))) {
-/* ibmebus_unregister_device(dev); */
+ of_device_unregister(to_of_device(dev));
kfree(path);
return count;
@@ -265,6 +322,7 @@ static struct bus_attribute ibmebus_bus_attrs[] = {
};
struct bus_type ibmebus_bus_type = {
+ .uevent = of_device_uevent,
.dev_attrs = ibmebus_dev_attrs,
.bus_attrs = ibmebus_bus_attrs
};
@@ -292,6 +350,13 @@ static int __init ibmebus_bus_init(void)
return err;
}
+ err = ibmebus_create_devices(builtin_matches);
+ if (err) {
+ device_unregister(&ibmebus_bus_device);
+ bus_unregister(&ibmebus_bus_type);
+ return err;
+ }
+
return 0;
}
postcore_initcall(ibmebus_bus_init);
--
1.5.2
^ permalink raw reply related
* [PATCH 2/5] ibmebus: Remove bus match/probe/remove functions
From: Joachim Fenkes @ 2007-09-25 12:11 UTC (permalink / raw)
To: Paul Mackerras, LinuxPPC-Dev, LKML
Cc: Thomas Klein, Arnd Bergmann, Jan-Bernd Themann, Paul Mackerras,
Christoph Raisch, Stefan Roscher
In-Reply-To: <200709251410.29780.fenkes@de.ibm.com>
ibmebus_{,un}register_driver() are replaced by dummy functions because
ibmebus is temporarily unusable in this transitional state.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
arch/powerpc/kernel/ibmebus.c | 199 ++---------------------------------------
1 files changed, 6 insertions(+), 193 deletions(-)
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index d6a38cd..cc80f84 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -41,6 +41,7 @@
#include <linux/kobject.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
+#include <linux/of_platform.h>
#include <asm/ibmebus.h>
#include <asm/abs_addr.h>
@@ -123,183 +124,14 @@ static struct dma_mapping_ops ibmebus_dma_ops = {
.dma_supported = ibmebus_dma_supported,
};
-static int ibmebus_bus_probe(struct device *dev)
-{
- struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev);
- struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
- const struct of_device_id *id;
- int error = -ENODEV;
-
- if (!ibmebusdrv->probe)
- return error;
-
- id = of_match_device(ibmebusdrv->id_table, &ibmebusdev->ofdev);
- if (id) {
- error = ibmebusdrv->probe(ibmebusdev, id);
- }
-
- return error;
-}
-
-static int ibmebus_bus_remove(struct device *dev)
-{
- struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev);
- struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
-
- if (ibmebusdrv->remove) {
- return ibmebusdrv->remove(ibmebusdev);
- }
-
- return 0;
-}
-
-static void __devinit ibmebus_dev_release(struct device *dev)
-{
- of_node_put(to_ibmebus_dev(dev)->ofdev.node);
- kfree(to_ibmebus_dev(dev));
-}
-
-static int __devinit ibmebus_register_device_common(
- struct ibmebus_dev *dev, const char *name)
-{
- int err = 0;
-
- dev->ofdev.dev.parent = &ibmebus_bus_device;
- dev->ofdev.dev.bus = &ibmebus_bus_type;
- dev->ofdev.dev.release = ibmebus_dev_release;
-
- dev->ofdev.dev.archdata.of_node = dev->ofdev.node;
- dev->ofdev.dev.archdata.dma_ops = &ibmebus_dma_ops;
- dev->ofdev.dev.archdata.numa_node = of_node_to_nid(dev->ofdev.node);
-
- /* An ibmebusdev is based on a of_device. We have to change the
- * bus type to use our own DMA mapping operations.
- */
- if ((err = of_device_register(&dev->ofdev)) != 0) {
- printk(KERN_ERR "%s: failed to register device (%d).\n",
- __FUNCTION__, err);
- return -ENODEV;
- }
-
- return 0;
-}
-
-static struct ibmebus_dev* __devinit ibmebus_register_device_node(
- struct device_node *dn)
-{
- struct ibmebus_dev *dev;
- int i, len, bus_len;
-
- dev = kzalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
- if (!dev)
- return ERR_PTR(-ENOMEM);
-
- dev->ofdev.node = of_node_get(dn);
-
- len = strlen(dn->full_name + 1);
- bus_len = min(len, BUS_ID_SIZE - 1);
- memcpy(dev->ofdev.dev.bus_id, dn->full_name + 1
- + (len - bus_len), bus_len);
- for (i = 0; i < bus_len; i++)
- if (dev->ofdev.dev.bus_id[i] == '/')
- dev->ofdev.dev.bus_id[i] = '_';
-
- /* Register with generic device framework. */
- if (ibmebus_register_device_common(dev, dn->name) != 0) {
- kfree(dev);
- return ERR_PTR(-ENODEV);
- }
-
- return dev;
-}
-
-static void ibmebus_probe_of_nodes(char* name)
-{
- struct device_node *dn = NULL;
-
- while ((dn = of_find_node_by_name(dn, name))) {
- if (IS_ERR(ibmebus_register_device_node(dn))) {
- of_node_put(dn);
- return;
- }
- }
-
- of_node_put(dn);
-
- return;
-}
-
-static void ibmebus_add_devices_by_id(struct of_device_id *idt)
-{
- while (strlen(idt->name) > 0) {
- ibmebus_probe_of_nodes(idt->name);
- idt++;
- }
-
- return;
-}
-
-static int ibmebus_match_name(struct device *dev, void *data)
-{
- const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
- const char *name;
-
- name = of_get_property(ebus_dev->ofdev.node, "name", NULL);
-
- if (name && (strcmp(data, name) == 0))
- return 1;
-
- return 0;
-}
-
-static int ibmebus_unregister_device(struct device *dev)
-{
- of_device_unregister(to_of_device(dev));
-
- return 0;
-}
-
-static void ibmebus_remove_devices_by_id(struct of_device_id *idt)
-{
- struct device *dev;
-
- while (strlen(idt->name) > 0) {
- while ((dev = bus_find_device(&ibmebus_bus_type, NULL,
- (void*)idt->name,
- ibmebus_match_name))) {
- ibmebus_unregister_device(dev);
- }
- idt++;
- }
-
- return;
-}
-
int ibmebus_register_driver(struct ibmebus_driver *drv)
{
- int err = 0;
-
- drv->driver.name = drv->name;
- drv->driver.bus = &ibmebus_bus_type;
- drv->driver.probe = ibmebus_bus_probe;
- drv->driver.remove = ibmebus_bus_remove;
-
- if ((err = driver_register(&drv->driver) != 0))
- return err;
-
- /* remove all supported devices first, in case someone
- * probed them manually before registering the driver */
- ibmebus_remove_devices_by_id(drv->id_table);
- ibmebus_add_devices_by_id(drv->id_table);
-
return 0;
}
EXPORT_SYMBOL(ibmebus_register_driver);
void ibmebus_unregister_driver(struct ibmebus_driver *drv)
{
- driver_unregister(&drv->driver);
- ibmebus_remove_devices_by_id(drv->id_table);
}
EXPORT_SYMBOL(ibmebus_unregister_driver);
@@ -327,23 +159,6 @@ void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id)
}
EXPORT_SYMBOL(ibmebus_free_irq);
-static int ibmebus_bus_match(struct device *dev, struct device_driver *drv)
-{
- const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
- struct ibmebus_driver *ebus_drv = to_ibmebus_driver(drv);
- const struct of_device_id *ids = ebus_drv->id_table;
- const struct of_device_id *found_id;
-
- if (!ids)
- return 0;
-
- found_id = of_match_device(ids, &ebus_dev->ofdev);
- if (found_id)
- return 1;
-
- return 0;
-}
-
static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -404,7 +219,7 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
}
if ((dn = of_find_node_by_path(path))) {
- dev = ibmebus_register_device_node(dn);
+/* dev = ibmebus_register_device_node(dn); */
of_node_put(dn);
rc = IS_ERR(dev) ? PTR_ERR(dev) : count;
} else {
@@ -430,7 +245,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path,
ibmebus_match_path))) {
- ibmebus_unregister_device(dev);
+/* ibmebus_unregister_device(dev); */
kfree(path);
return count;
@@ -450,8 +265,6 @@ static struct bus_attribute ibmebus_bus_attrs[] = {
};
struct bus_type ibmebus_bus_type = {
- .name = "ibmebus",
- .match = ibmebus_bus_match,
.dev_attrs = ibmebus_dev_attrs,
.bus_attrs = ibmebus_bus_attrs
};
@@ -463,9 +276,9 @@ static int __init ibmebus_bus_init(void)
printk(KERN_INFO "IBM eBus Device Driver\n");
- err = bus_register(&ibmebus_bus_type);
+ err = of_bus_type_init(&ibmebus_bus_type, "ibmebus");
if (err) {
- printk(KERN_ERR ":%s: failed to register IBM eBus.\n",
+ printk(KERN_ERR "%s: failed to register IBM eBus.\n",
__FUNCTION__);
return err;
}
@@ -481,4 +294,4 @@ static int __init ibmebus_bus_init(void)
return 0;
}
-__initcall(ibmebus_bus_init);
+postcore_initcall(ibmebus_bus_init);
--
1.5.2
^ permalink raw reply related
* [PATCH 1/5] PowerPC: Move of_device allocation into of_device.[ch]
From: Joachim Fenkes @ 2007-09-25 12:11 UTC (permalink / raw)
To: Paul Mackerras, LinuxPPC-Dev, LKML
Cc: Thomas Klein, Arnd Bergmann, Jan-Bernd Themann, Paul Mackerras,
Christoph Raisch, Stefan Roscher
In-Reply-To: <200709251410.29780.fenkes@de.ibm.com>
Extract generic of_device allocation code from of_platform_device_create()
and move it into of_device.[ch], called of_device_alloc(). Also, there's now
of_device_free() which puts the device node.
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
include/asm-powerpc/of_device.h | 4 ++
include/linux/of_device.h | 5 ++
arch/powerpc/kernel/of_device.c | 80 +++++++++++++++++++++++++++++++++++++
arch/powerpc/kernel/of_platform.c | 70 +-------------------------------
4 files changed, 91 insertions(+), 68 deletions(-)
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index ec2a8a2..9ab469d 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -17,6 +17,10 @@ struct of_device
struct device dev; /* Generic device interface */
};
+extern struct of_device *of_device_alloc(struct device_node *np,
+ const char *bus_id,
+ struct device *parent);
+
extern ssize_t of_device_get_modalias(struct of_device *ofdev,
char *str, ssize_t len);
extern int of_device_uevent(struct device *dev,
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 91bf84b..212bffb 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -22,5 +22,10 @@ extern int of_device_register(struct of_device *ofdev);
extern void of_device_unregister(struct of_device *ofdev);
extern void of_release_dev(struct device *dev);
+static inline void of_device_free(struct of_device *dev)
+{
+ of_release_dev(&dev->dev);
+}
+
#endif /* __KERNEL__ */
#endif /* _LINUX_OF_DEVICE_H */
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 89b911e..ecb8b0e 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -7,8 +7,88 @@
#include <linux/slab.h>
#include <asm/errno.h>
+#include <asm/dcr.h>
#include <asm/of_device.h>
+static void of_device_make_bus_id(struct of_device *dev)
+{
+ static atomic_t bus_no_reg_magic;
+ struct device_node *node = dev->node;
+ char *name = dev->dev.bus_id;
+ const u32 *reg;
+ u64 addr;
+ int magic;
+
+ /*
+ * If it's a DCR based device, use 'd' for native DCRs
+ * and 'D' for MMIO DCRs.
+ */
+#ifdef CONFIG_PPC_DCR
+ reg = of_get_property(node, "dcr-reg", NULL);
+ if (reg) {
+#ifdef CONFIG_PPC_DCR_NATIVE
+ snprintf(name, BUS_ID_SIZE, "d%x.%s",
+ *reg, node->name);
+#else /* CONFIG_PPC_DCR_NATIVE */
+ addr = of_translate_dcr_address(node, *reg, NULL);
+ if (addr != OF_BAD_ADDR) {
+ snprintf(name, BUS_ID_SIZE,
+ "D%llx.%s", (unsigned long long)addr,
+ node->name);
+ return;
+ }
+#endif /* !CONFIG_PPC_DCR_NATIVE */
+ }
+#endif /* CONFIG_PPC_DCR */
+
+ /*
+ * For MMIO, get the physical address
+ */
+ reg = of_get_property(node, "reg", NULL);
+ if (reg) {
+ addr = of_translate_address(node, reg);
+ if (addr != OF_BAD_ADDR) {
+ snprintf(name, BUS_ID_SIZE,
+ "%llx.%s", (unsigned long long)addr,
+ node->name);
+ return;
+ }
+ }
+
+ /*
+ * No BusID, use the node name and add a globally incremented
+ * counter (and pray...)
+ */
+ magic = atomic_add_return(1, &bus_no_reg_magic);
+ snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1);
+}
+
+struct of_device *of_device_alloc(struct device_node *np,
+ const char *bus_id,
+ struct device *parent)
+{
+ struct of_device *dev;
+
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev)
+ return NULL;
+
+ dev->node = of_node_get(np);
+ dev->dev.dma_mask = &dev->dma_mask;
+ dev->dev.parent = parent;
+ dev->dev.release = of_release_dev;
+ dev->dev.archdata.of_node = np;
+ dev->dev.archdata.numa_node = of_node_to_nid(np);
+
+ if (bus_id)
+ strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
+ else
+ of_device_make_bus_id(dev);
+
+ return dev;
+}
+EXPORT_SYMBOL(of_device_alloc);
+
ssize_t of_device_get_modalias(struct of_device *ofdev,
char *str, ssize_t len)
{
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index f70e787..1d96b82 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -21,7 +21,6 @@
#include <linux/pci.h>
#include <asm/errno.h>
-#include <asm/dcr.h>
#include <asm/of_device.h>
#include <asm/of_platform.h>
#include <asm/topology.h>
@@ -53,8 +52,6 @@ static struct of_device_id of_default_bus_ids[] = {
{},
};
-static atomic_t bus_no_reg_magic;
-
struct bus_type of_platform_bus_type = {
.uevent = of_device_uevent,
};
@@ -84,89 +81,26 @@ void of_unregister_platform_driver(struct of_platform_driver *drv)
}
EXPORT_SYMBOL(of_unregister_platform_driver);
-static void of_platform_make_bus_id(struct of_device *dev)
-{
- struct device_node *node = dev->node;
- char *name = dev->dev.bus_id;
- const u32 *reg;
- u64 addr;
- int magic;
-
- /*
- * If it's a DCR based device, use 'd' for native DCRs
- * and 'D' for MMIO DCRs.
- */
-#ifdef CONFIG_PPC_DCR
- reg = of_get_property(node, "dcr-reg", NULL);
- if (reg) {
-#ifdef CONFIG_PPC_DCR_NATIVE
- snprintf(name, BUS_ID_SIZE, "d%x.%s",
- *reg, node->name);
-#else /* CONFIG_PPC_DCR_NATIVE */
- addr = of_translate_dcr_address(node, *reg, NULL);
- if (addr != OF_BAD_ADDR) {
- snprintf(name, BUS_ID_SIZE,
- "D%llx.%s", (unsigned long long)addr,
- node->name);
- return;
- }
-#endif /* !CONFIG_PPC_DCR_NATIVE */
- }
-#endif /* CONFIG_PPC_DCR */
-
- /*
- * For MMIO, get the physical address
- */
- reg = of_get_property(node, "reg", NULL);
- if (reg) {
- addr = of_translate_address(node, reg);
- if (addr != OF_BAD_ADDR) {
- snprintf(name, BUS_ID_SIZE,
- "%llx.%s", (unsigned long long)addr,
- node->name);
- return;
- }
- }
-
- /*
- * No BusID, use the node name and add a globally incremented
- * counter (and pray...)
- */
- magic = atomic_add_return(1, &bus_no_reg_magic);
- snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1);
-}
-
struct of_device* of_platform_device_create(struct device_node *np,
const char *bus_id,
struct device *parent)
{
struct of_device *dev;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = of_device_alloc(np, bus_id, parent);
if (!dev)
return NULL;
- dev->node = of_node_get(np);
dev->dma_mask = 0xffffffffUL;
- dev->dev.dma_mask = &dev->dma_mask;
- dev->dev.parent = parent;
dev->dev.bus = &of_platform_bus_type;
- dev->dev.release = of_release_dev;
- dev->dev.archdata.of_node = np;
- dev->dev.archdata.numa_node = of_node_to_nid(np);
/* We do not fill the DMA ops for platform devices by default.
* This is currently the responsibility of the platform code
* to do such, possibly using a device notifier
*/
- if (bus_id)
- strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
- else
- of_platform_make_bus_id(dev);
-
if (of_device_register(dev) != 0) {
- kfree(dev);
+ of_device_free(dev);
return NULL;
}
--
1.5.2
^ permalink raw reply related
* [PATCH 0/5] PowerPC: ibmebus refactoring and fixes
From: Joachim Fenkes @ 2007-09-25 12:10 UTC (permalink / raw)
To: Paul Mackerras, LinuxPPC-Dev, LKML
Cc: Thomas Klein, Arnd Bergmann, Jan-Bernd Themann, Paul Mackerras,
Christoph Raisch, Stefan Roscher
This patchset will merge the ibmebus and of_platform bus drivers by basing a
lot of ibmebus functionality on of_platform code and adding the features
specific to ibmebus on top of that.
I split the actual ibmebus rework into three patches (2/5-4/5) for easier
readability. The kernel will compile during the intermediate states, and
ibmebus will not crash, but not work either.
As a side-effect of patch 3/5, a problem with bus_id collisions in case of
two devices sharing the same location code is resolved -- the bus_id is now
determined differently.
[1/5] moves of_device allocation into of_device.[ch]
[2/5] removes the old bus match/probe/remove functions
[3/5] adds device creation and bus probing based on of_device
[4/5] finally moves to of_device and of_platform_driver by changing
ibmebus.h and matching the eHCA and eHEA drivers
[5/5] just changes a nit in ibmebus_store_probe()
These patches should apply cleanly, in order, against 2.6.23-rc5 and against
Linus' git. Please review and comment them, and queue them up for 2.6.24 if
you think they're okay.
Thanks and regards,
Joachim
arch/powerpc/kernel/ibmebus.c | 263 ++++++++-----------------=
=2D---
arch/powerpc/kernel/of_device.c | 80 +++++++++
arch/powerpc/kernel/of_platform.c | 70 +--------
drivers/infiniband/hw/ehca/ehca_classes.h | 2 +-
drivers/infiniband/hw/ehca/ehca_eq.c | 6 +-
drivers/infiniband/hw/ehca/ehca_main.c | 32 ++--
drivers/net/ehea/ehea.h | 2 +-
drivers/net/ehea/ehea_main.c | 72 ++++----
include/asm-powerpc/ibmebus.h | 38 +----
include/asm-powerpc/of_device.h | 4 +
include/linux/of_device.h | 5 +
11 files changed, 226 insertions(+), 348 deletions(-)
=2D-=20
Joachim Fenkes =A0-- =A0eHCA Linux Driver Developer and Hardware Tamer
IBM Deutschland Entwicklung GmbH =A0-- =A0Dept. 3627 (I/O Firmware Dev. 2)
Schoenaicher Strasse 220 =A0-- =A071032 Boeblingen =A0-- =A0Germany
eMail: fenkes@de.ibm.com
^ permalink raw reply
* Re: [PATCH4/4] [POWERPC] Fix cpm_uart driver
From: Jochen Friedrich @ 2007-09-25 12:09 UTC (permalink / raw)
To: Scott Wood; +Cc: linux-kernel, linuxppc-embedded
In-Reply-To: <46F80049.2030509@freescale.com>
Hi Scott,
> Yikes. Please don't change cpm_uart_cpm1.h, as it's correct for
> arch/powerpc, and there are numerous other places that assume cpmp is
> virtual (including in the very same function that assigns it a
> physical address).
I'm still not convinced cpm_uart_cpm1.h is correct:
pinfo->rx_bd_base and pinfo->tx_bd_base are both initialized with an
address obtained by cpm_dpram_addr(). In both ppc and powerpc, this is
an address relative to dpram_vbase in commproc.c
In cpm_uart_core.c, the operation "pinfo->rx_bd_base - DPRAM_BASE" is
used to calculate the DPRAM offset. So DPRAM_BASE must be relative to
dpram_vbase in commproc.c as well. However, cpm_uart_cpm1.h uses cpmp in
commproc.c to initialize DPRAM_BASE.
On ARCH=ppc, cpmp is a physical address with 1:1 virtual mapping ("well
known address"). On ARC=powerpc, this is an address obtained by
ioremap(), however it's a different ioremap() call than dpram_vbase is
obtained from, so noone can guarantee
cpmp is always the same as dpram_vbase even on ARCH=powerpc.
To me, it looks like setting DPRAM_BASE to cpm_dpram_addr(0) is the fix
as it makes the DPRAM offset a defined result.
Thanks,
Jochen
^ permalink raw reply
* Please pull powerpc.git merge branch
From: Paul Mackerras @ 2007-09-25 11:40 UTC (permalink / raw)
To: torvalds; +Cc: linuxppc-dev, roland
Linus,
Please do
git pull \
git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git merge
to get a patch from Roland McGrath that fixes a user-triggerable oops
on 64-bit powerpc.
Thanks,
Paul.
arch/powerpc/kernel/process.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
commit 474f81967217f3bec2389ae913da72641f2c40e3
Author: Roland McGrath <roland@redhat.com>
Date: Mon Sep 24 16:52:44 2007 -0700
[POWERPC] Ensure FULL_REGS on exec
When PTRACE_O_TRACEEXEC is used, a ptrace call to fetch the registers at
the PTRACE_EVENT_EXEC stop (PTRACE_PEEKUSR) will oops in CHECK_FULL_REGS.
With recent versions, "gdb --args /bin/sh -c 'exec /bin/true'" and "run" at
the (gdb) prompt is sufficient to produce this. I also have written an
isolated test case, see https://bugzilla.redhat.com/show_bug.cgi?id=301791#c15.
This change fixes the problem by clearing the low bit of pt_regs.trap in
start_thread so that FULL_REGS is true again. This is correct since all of
the GPRs that "full" refers to are cleared in start_thread.
Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
^ permalink raw reply
* MPC8560 CPM2 SCC(UART) Driver CPM_UART_CONSOLE
From: Deepak Gaur @ 2007-09-25 11:03 UTC (permalink / raw)
To: linuxppc-dev
Hi all,
I am writing a kernel module which is required to parse the characters received from a
device attached to MPC8560 SCC2 (UART slave mode) on serial interface. This SCC is
required to be configured for single-buffer, character based operation. Moreover on
another SCC (SCC1 UART master mode) the board debug interface(console) is connected.
While trying to figure out CPM UART device driver interface available in file
drivers/serial/cpm_uart/cpm_uart_core.c for my kernel module I found that some of the
functions are available when CPM_UART_CONSOLE is enabled.
My doubt is regarding status of this flag for my hardware setup. Should this flag be
enabled or not. If it is required to be enabled for supporting SCC1 then how SCC2 will
be handled?
As I am a novice in this area , I shall be grateful if you please guide me in
understanding this driver code.
with regards,
Deepak Gaur
^ permalink raw reply
* Re: Linux doesn not boot from u-boot on ML403
From: Mirek23 @ 2007-09-25 8:25 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <fa686aa40709230832m1d4a083ao2e43b57cc39e088@mail.gmail.com>
Hi Grant,
Thank you very much for your response. actually I was wrong when saying:
> My observation is that the linux 2.6.23 rc-2 is not that stable as 2.6.21.
> In most cases It boots successfully (ie. zImage.elf) but occasionally it
> fails during booting. It has never occurred with 2.6.21 which I also
> copied from your side.
Both version of linux 2.6.21 and 2.6.23 run very well and always boot
properly.
To deal with u-boot and linux kernel I use jtag and load the software
straight to RAM.
I have difficulties to boot uImage (kernel v2.6.23) from u-boot 1.2.0.
uImage boots sometimes from u-boot but zImage.elf boots always (when loaded
to RAM via jtag).
It seems to be that I have the general problem with u-boot which I have
described on u-boot users forum:
http://www.nabble.com/u-boot-init-problem-on-ml403-%28virtex-4%29-board-tf4514050.html
Best Regards
Mirek
--
View this message in context: http://www.nabble.com/Re%3A-Linux-doesn-not-boot-from-u-boot-on-ML403-tf4504418.html#a12875133
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply
* Linux 2.6.23-rc7 kGDB broken
From: Benjamin ZORES @ 2007-09-25 7:41 UTC (permalink / raw)
To: linuxppc-dev
Hi,
I used to use linux-2.6-kgdb git tree from jwessel to extract kGDB
related patches
but I now have seen that it has been included in -mm branch.
However, in this branch, kGDB seems to be broken at least on PowerPC
(see http://lkml.org/lkml/2007/9/19/103).
It seems to me that the only reason is due to a missing header file
in include/asm-powerpc/kgdb.h
This file used to be present in kgdb tree (see
http://git.kernel.org/?p=linux/kernel/git/jwessel/linux-2.6-kgdb.git;a=blob_plain;f=include/asm-powerpc/kgdb.h;hb=kgdb_2.6.22-rc6)
but is no longer part of the patch.
Is there any reason for that ?
By opposition to what could be said in first LKML thread, adding this
file is enough to restore kGDB on PowerPC.
I've tested it and it compiles (and work) just fine (and as expected).
Can this file be restored ?
Ben
^ permalink raw reply
* jffs2 file system on MPC8272ADS
From: Nethra @ 2007-09-25 6:01 UTC (permalink / raw)
To: linuxppc-embedded
hi everyone,
I m using custom board similar to MPC8272ADS board...
1) For the first time it boots up properly in case if we overwrite any
existing binaries using nfs mounted file system on the board, after
rebooting it displays fallowing message...
Further such events for this erase block will not be printed
Eep. Child "null" (ino #1346) of dir ino #3 doesn't exist!
Eep. Child "autocomm" (ino #463) of dir ino #461 doesn't exist!
Eep. Child "calibration" (ino #464) of dir ino #461 doesn't exist!
Eep. Child "coredsp_driver.ko" (ino #939) of dir ino #336 doesn't exist!
Inode #1307 was a directory with children - removing those too...
Inode #564 was a directory with children - removing those too...
Inode #565 was a directory with children - removing those too...
Inode #1112 was a directory with children - removing those too...
Inode #1115 was a directory with children - removing those too...
Inode #1118 was a directory with children - removing those too...
Inode #1123 was a directory with children - removing those too...
after this board boots up properly....but it not be having overwritten files
2) while booting up for the first time itself it will display the falowing
message..
modprobe: FATAL: Could not load
/lib/modules/2.6.10_mvl401-8272ads/modules.dep: No such file or dire
ctory
but after this also board boots up properly
3) when board is running properly in between it starts printing on console
repeatedly...
Header CRC failed on REF_PRISTINE node at 0x00638a6c: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000254)
Header CRC failed on REF_PRISTINE node at 0x00638cc0: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000234)
Header CRC failed on REF_PRISTINE node at 0x00638ef4: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c4)
Header CRC failed on REF_PRISTINE node at 0x006391b8: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b4)
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c0)
Header CRC failed on REF_PRISTINE node at 0x0063972c: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002bc)
Header CRC failed on REF_PRISTINE node at 0x006399e8: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002ac)
Header CRC failed on REF_PRISTINE node at 0x00639c94: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x00639f44: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002ac)
Header CRC failed on REF_PRISTINE node at 0x0063a1f0: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c0)
Header CRC failed on REF_PRISTINE node at 0x0063a4b0: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x0063a760: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x0063aa10: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c8)
Header CRC failed on REF_PRISTINE node at 0x0063acd8: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x0063af88: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c4)
Header CRC failed on REF_PRISTINE node at 0x0063b24c: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b4)
Header CRC failed on REF_PRISTINE node at 0x0063b500: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c8)
Header CRC failed on REF_PRISTINE node at 0x0063b7c8: Read 0xffffffff,
calculated 0x44660075
are they debug messages or warnings...?
do they create more problem or can i neglet these errors..
plz reply..it is too urgent
here is my kerenl configurations....
#
# Memory Technology Devices (MTD)
#
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_CONCAT is not set
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_REDBOOT_PARTS is not set
CONFIG_MTD_CMDLINE_PARTS=y
#
# User Modules And Translation Layers
#
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_NOSWAP=y
# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
CONFIG_MTD_CFI_GEOMETRY=y
# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
# CONFIG_MTD_CFI_I1 is not set
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_OTP is not set
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_AMDSTD_RETRY=0
# CONFIG_MTD_CFI_STAA is not set
CONFIG_MTD_CFI_UTIL=y
# CONFIG_MTD_RAM is not set
CONFIG_MTD_ROM=y
# CONFIG_MTD_ABSENT is not set
# CONFIG_MTD_XIP is not set
#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_START=0xFC000000
CONFIG_MTD_PHYSMAP_LEN=0x4000000CONFIG_MTD_PHYSMAP_BANKWIDTH=4
# CONFIG_MTD_MULTI_PHYSMAP is not set
# CONFIG_MTD_SBC8240 is not set
CONFIG_MTD_PQ2FADS=y
# CONFIG_MTD_PLATRAM is not set
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=0
CONFIG_JFFS2_FS_WRITEBUFFER=y
and
file system is created using fallowing command..
mkfs.jffs2 -r RFS_NEW/ -e 0x20000 -o /tftpboot/jffs2_img -b
do we need padding or not..?
thnks in advance..
Nethra
--
View this message in context: http://www.nabble.com/jffs2-file-system-on-MPC8272ADS-tf4513571.html#a12873633
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply
* jffs2 file system on MPC8272ADS board
From: Nethra @ 2007-09-25 5:47 UTC (permalink / raw)
To: linuxppc-dev
hi everyone,
I m using custom board similar to MPC8272ADS board...
1) For the first time it boots up properly in case if we overwrite any
existing binaries using nfs mounted file system on the board, after
rebooting it displays fallowing message...
Further such events for this erase block will not be printed
Eep. Child "null" (ino #1346) of dir ino #3 doesn't exist!
Eep. Child "autocomm" (ino #463) of dir ino #461 doesn't exist!
Eep. Child "calibration" (ino #464) of dir ino #461 doesn't exist!
Eep. Child "coredsp_driver.ko" (ino #939) of dir ino #336 doesn't exist!
Inode #1307 was a directory with children - removing those too...
Inode #564 was a directory with children - removing those too...
Inode #565 was a directory with children - removing those too...
Inode #1112 was a directory with children - removing those too...
Inode #1115 was a directory with children - removing those too...
Inode #1118 was a directory with children - removing those too...
Inode #1123 was a directory with children - removing those too...
after this board boots up properly....but it not be having overwritten files
2) while booting up for the first time itself it will display the falowing
message..
modprobe: FATAL: Could not load
/lib/modules/2.6.10_mvl401-8272ads/modules.dep: No such file or dire
ctory
but after this also board boots up properly
3) when board is running properly in between it starts printing on console
repeatedly...
Header CRC failed on REF_PRISTINE node at 0x00638a6c: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000254)
Header CRC failed on REF_PRISTINE node at 0x00638cc0: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x00000234)
Header CRC failed on REF_PRISTINE node at 0x00638ef4: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c4)
Header CRC failed on REF_PRISTINE node at 0x006391b8: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b4)
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c0)
Header CRC failed on REF_PRISTINE node at 0x0063972c: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002bc)
Header CRC failed on REF_PRISTINE node at 0x006399e8: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002ac)
Header CRC failed on REF_PRISTINE node at 0x00639c94: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x00639f44: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002ac)
Header CRC failed on REF_PRISTINE node at 0x0063a1f0: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c0)
Header CRC failed on REF_PRISTINE node at 0x0063a4b0: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x0063a760: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x0063aa10: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c8)
Header CRC failed on REF_PRISTINE node at 0x0063acd8: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b0)
Header CRC failed on REF_PRISTINE node at 0x0063af88: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c4)
Header CRC failed on REF_PRISTINE node at 0x0063b24c: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002b4)
Header CRC failed on REF_PRISTINE node at 0x0063b500: Read 0xffffffff,
calculated 0x44660075
Node totlen on flash (0xffffffff) != totlen from node ref (0x000002c8)
Header CRC failed on REF_PRISTINE node at 0x0063b7c8: Read 0xffffffff,
calculated 0x44660075
are they debug messages or warnings...?
do they create more problem or can i neglet these errors..
plz reply..it is too urgent
here is my kerenl configurations....
#
# Memory Technology Devices (MTD)
#
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_CONCAT is not set
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_REDBOOT_PARTS is not set
CONFIG_MTD_CMDLINE_PARTS=y
#
# User Modules And Translation Layers
#
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_GEN_PROBE=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
CONFIG_MTD_CFI_NOSWAP=y
# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
CONFIG_MTD_CFI_GEOMETRY=y
# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
# CONFIG_MTD_CFI_I1 is not set
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_OTP is not set
# CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_CFI_AMDSTD_RETRY=0
# CONFIG_MTD_CFI_STAA is not set
CONFIG_MTD_CFI_UTIL=y
# CONFIG_MTD_RAM is not set
CONFIG_MTD_ROM=y
# CONFIG_MTD_ABSENT is not set
# CONFIG_MTD_XIP is not set
#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_START=0xFC000000
CONFIG_MTD_PHYSMAP_LEN=0x4000000CONFIG_MTD_PHYSMAP_BANKWIDTH=4
# CONFIG_MTD_MULTI_PHYSMAP is not set
# CONFIG_MTD_SBC8240 is not set
CONFIG_MTD_PQ2FADS=y
# CONFIG_MTD_PLATRAM is not set
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=0
CONFIG_JFFS2_FS_WRITEBUFFER=y
and
file system is created using fallowing command..
mkfs.jffs2 -r RFS_NEW/ -e 0x20000 -o /tftpboot/jffs2_img -b
do we need padding or not..?
thnks in advance..
Nethra
--
View this message in context: http://www.nabble.com/jffs2-file-system-on-MPC8272ADS-board-tf4513530.html#a12873530
Sent from the linuxppc-dev mailing list archive at Nabble.com.
^ permalink raw reply
* Re: [patch 3/3] mpc8349emitx.dts: Add ds1339 RTC
From: David Gibson @ 2007-09-25 5:47 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linuxppc-dev, Timur Tabi
In-Reply-To: <87myvbnwbo.fsf@macbook.be.48ers.dk>
On Tue, Sep 25, 2007 at 07:33:15AM +0200, Peter Korsgaard wrote:
> >>>>> "David" == David Gibson <david@gibson.dropbear.id.au> writes:
>
> Hi,
>
> >> The Linux driver for the chip (rtc-1307.c) doesn't expose the NVRAM
> >> bytes either.
>
> David> Incidentally how are you planning on instantiating the driver? AFAIK
> David> all the rtc-* drivers are platform drivers rather than of_platform
> David> drivers. I had been thinking of an rtc helper function that would go
> David> through the tree instantiating platform devices for any RTCs based on
> David> a compatible -> platform device name table.
>
> Please see patch #2 in the series:
>
> http://ozlabs.org/pipermail/linuxppc-dev/2007-September/042896.html
>
> That helper function more or less already exists in fsl_soc.c.
Ah, I see. Well... it exists for i2c devices (possibly including
RTCs). Whereas I was thinking of a version for RTCs (possibly
including i2c devices). Actually that won't quite work - looks like
the i2c RTC class drivers are probed differently from the RTC drivers
I was looking at which are pure platform devices.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [patch 3/3] mpc8349emitx.dts: Add ds1339 RTC
From: Peter Korsgaard @ 2007-09-25 5:33 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, Timur Tabi
In-Reply-To: <20070925021340.GG30338@localhost.localdomain>
>>>>> "David" == David Gibson <david@gibson.dropbear.id.au> writes:
Hi,
>> The Linux driver for the chip (rtc-1307.c) doesn't expose the NVRAM
>> bytes either.
David> Incidentally how are you planning on instantiating the driver? AFAIK
David> all the rtc-* drivers are platform drivers rather than of_platform
David> drivers. I had been thinking of an rtc helper function that would go
David> through the tree instantiating platform devices for any RTCs based on
David> a compatible -> platform device name table.
Please see patch #2 in the series:
http://ozlabs.org/pipermail/linuxppc-dev/2007-September/042896.html
That helper function more or less already exists in fsl_soc.c.
--
Bye, Peter Korsgaard
^ permalink raw reply
* Re: AMCC yosemite 440ep PCI slot doesn't work.
From: Stefan Roese @ 2007-09-25 5:18 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <46F86C4F.7060305@windriver.com>
On Tuesday 25 September 2007, Andrew Liu wrote:
> I have tested it on linux-2.6.19 which is from AMCC website , linux
> 2.6.21.7 which is from linux mainline and linux-2.6.23.rc7 which is
> from git://www.denx.de/git/linux-2.6-denx.git
> Have the same problem.
> I don't understand, why after enabling this PCI interrupts. in so
> short time, produce 100,000 interrupt request (25: 100000 UIC0
> Level eth2).
Because the interrupt is somehow not acknowledged in the PCI device.
I will test this on my Yosemite and let you know.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de
=====================================================================
^ permalink raw reply
* [PATCH] powerpc: fix CONFIG_SWAP=n builds for 64-bit
From: Jeremy Kerr @ 2007-09-25 4:33 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
Currently, 64-bit won't build with CONFIG_SWAP=n, as asm-generic/tlb.h
needs page_cache_release() and release_pages(), which are defined in
linux/pagemap.h.
We can't include linux/pagemap.h in asm-generic/tlb.h, as (apparently)
this breaks sparc. So, include it in the necessary places in the
powerpc mm code.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
arch/powerpc/mm/hash_native_64.c | 1 +
arch/powerpc/mm/hash_utils_64.c | 1 +
arch/powerpc/mm/init_64.c | 1 +
arch/powerpc/mm/pgtable_64.c | 1 +
arch/powerpc/mm/tlb_64.c | 1 +
5 files changed, 5 insertions(+)
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 6ba9b47..dd1e9fb 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -16,6 +16,7 @@
#include <linux/bitops.h>
#include <linux/threads.h>
#include <linux/smp.h>
+#include <linux/pagemap.h>
#include <asm/abs_addr.h>
#include <asm/machdep.h>
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index d525f2e..1ff0117 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -31,6 +31,7 @@
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/signal.h>
+#include <linux/pagemap.h>
#include <asm/processor.h>
#include <asm/pgtable.h>
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 9f27bb5..a1e8364 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -40,6 +40,7 @@
#include <linux/nodemask.h>
#include <linux/module.h>
#include <linux/poison.h>
+#include <linux/pagemap.h>
#include <asm/pgalloc.h>
#include <asm/page.h>
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 60fd52c..4265eed 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -33,6 +33,7 @@
#include <linux/stddef.h>
#include <linux/vmalloc.h>
#include <linux/init.h>
+#include <linux/pagemap.h>
#include <asm/pgalloc.h>
#include <asm/page.h>
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index cbd34fc..b51ca5b 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -26,6 +26,7 @@
#include <linux/init.h>
#include <linux/percpu.h>
#include <linux/hardirq.h>
+#include <linux/pagemap.h>
#include <asm/pgalloc.h>
#include <asm/tlbflush.h>
#include <asm/tlb.h>
^ permalink raw reply related
* [PATCH] add Altivec/VMX state to coredumps
From: Mark Nelson @ 2007-09-25 4:03 UTC (permalink / raw)
To: linuxppc-dev
Update dump_task_altivec() (that has so far never been put to use)
so that it dumps the Altivec/VMX registers (VR[0] - VR[31], VSCR
and VRSAVE) in the same format as the ptrace get_vrregs() and add
the appropriate glue typedefs and #defines to
include/asm-powerpc/elf.h for it to work.
Signed-off-by: Mark Nelson <markn@au1.ibm.com>
---
arch/powerpc/kernel/process.c | 28 +++++++++++++++++++++++++---
include/asm-powerpc/elf.h | 7 +++++++
2 files changed, 32 insertions(+), 3 deletions(-)
Index: linux/arch/powerpc/kernel/process.c
===================================================================
--- linux.orig/arch/powerpc/kernel/process.c
+++ linux/arch/powerpc/kernel/process.c
@@ -149,10 +149,32 @@ void flush_altivec_to_thread(struct task
}
}
-int dump_task_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
+int dump_task_altivec(struct task_struct *tsk, elf_vrregset_t *vrregs)
{
- flush_altivec_to_thread(current);
- memcpy(vrregs, ¤t->thread.vr[0], sizeof(*vrregs));
+ /* ELF_NVRREG includes the VSCR and VRSAVE which we need to save
+ * separately, see below */
+ const int nregs = ELF_NVRREG - 2;
+ elf_vrreg_t *reg;
+ u32 *dest;
+
+ if (tsk == current)
+ flush_altivec_to_thread(tsk);
+
+ reg = (elf_vrreg_t *)vrregs;
+
+ /* copy the 32 vr registers */
+ memcpy(reg, &tsk->thread.vr[0], nregs * sizeof(*reg));
+ reg += nregs;
+
+ /* copy the vscr */
+ memcpy(reg, &tsk->thread.vscr, sizeof(*reg));
+ reg++;
+
+ /* vrsave is stored in the high 32bit slot of the final 128bits */
+ memset(reg, 0, sizeof(*reg));
+ dest = (u32 *)reg;
+ *dest = tsk->thread.vrsave;
+
return 1;
}
#endif /* CONFIG_ALTIVEC */
Index: linux/include/asm-powerpc/elf.h
===================================================================
--- linux.orig/include/asm-powerpc/elf.h
+++ linux/include/asm-powerpc/elf.h
@@ -212,6 +212,13 @@ static inline int dump_task_regs(struct
extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
+typedef elf_vrregset_t elf_fpxregset_t;
+
+#ifdef CONFIG_ALTIVEC
+extern int dump_task_altivec(struct task_struct *, elf_vrregset_t *vrregs);
+#define ELF_CORE_COPY_XFPREGS(tsk, regs) dump_task_altivec(tsk, regs)
+#endif
+
#endif /* __KERNEL__ */
/* ELF_HWCAP yields a mask that user programs can use to figure out what
^ permalink raw reply
* Re: [PATCH 1/2] powerpc: ptrace CHECK_FULL_REGS
From: Benjamin Herrenschmidt @ 2007-09-25 3:58 UTC (permalink / raw)
To: Roland McGrath
Cc: David Woodhouse, linux-kernel, linuxppc-dev, Paul Mackerras,
Andrew Morton, Linus Torvalds
In-Reply-To: <20070925005945.02E924D04B7@magilla.localdomain>
On Mon, 2007-09-24 at 17:59 -0700, Roland McGrath wrote:
> > Yup, I think I ditched most of them.. for some reason I decided it
> > couldn't happen, but maybe I'm wrong ?
>
> Well, it's a BUG_ON. It's supposed to be for something that "can't happen".
> That's why it's a sanity check, not a wild assertion. ;-)
>
> The 2/2 patch is an example of a bug that CHECK_FULL_REGS catches.
> In the status quo, using PTRACE_PEEKUSR in a bug case crashes while using
> PTRACE_GETREGS in the same place might get bogus data. (In the actual bug
> thus found, the data is not bogus and only the bit that FULL_REGS checks is.)
Fair enough.
Ben.
^ permalink raw reply
* Re: [PATCH 8/15] bootwrapper: convert flatdevtree to version 16
From: David Gibson @ 2007-09-25 3:46 UTC (permalink / raw)
To: Milton Miller; +Cc: ppcdev, Paul Mackerras
In-Reply-To: <5e71423247aef068d82b84166102fd7d@bga.com>
On Mon, Sep 24, 2007 at 01:54:32AM -0500, Milton Miller wrote:
>
> On Sep 23, 2007, at 10:36 PM, David Gibson wrote:
>
> > On Fri, Sep 21, 2007 at 06:05:06PM -0500, Milton Miller wrote:
[snip]
> >> +#define MIN_VERSION 2
> >> +#define OUT_VERSION 16
> >
> > Should output version 17. In any case, don't try to be so general -
> > just convert v123 (all basically the same) to latest (i.e. v17)
> > without all the #if nonsense.
>
> Outputing v17 instead of 16 requires more words to be added to the
> header, and the library does fine with v16.
For now. libfdt will want v17. Although it will (eventually) have
it's own v16->v17 conversion code.
> Actually the v1 trees has
> some other differences such as initrd addresses were kernel linear not
> real, cpus were assigned logical numbers ... so while the structure
> didn't change except for the header field, the contents did.
!? what's your source for this. v2 and v3 were absolutely supposed to
be backwards compatible with v1 which would not be the case with
silent semantic changes such as this.
> Actually,
> when converting v3 to v16 some of the code issn't needed, the ifs allow
> the code size to be reduced.
Yes, but it never will be, because the only reason we'd include this
file is for converting old kexec-tools device trees which are v2 not
v3.
> >> +#define OUT_COMPAT 16
> >> +
> >> +#ifdef NO_CHECK
> >> +static int check_v123_tree(u32 *start, u32 *limit)
> >> +{
> >> + return 0;
> >> +}
> >> +#else
> >> +/**
> >> + * check_v123_tree - check integrety of a version 1, 2, or 3 tree
> >> + * @start: the start of the device tree struct
> >> + * @limit: the end of the region for the struct
> >> + * structural checks on device_tree
> >> + */
> >> +static int check_v123_tree(u32 *start, u32 *limit)
> >
> > What is the point of this check? If the device tree is corrupt, we're
> > stuffed anyway, so why bother?
>
> Hence the ifdef NO_CHECK. When developing, sometimes its nice to know
> if its your input or your program. These functions are destructive to
> an improperlly formed tree, and in non-obvious ways. When debugging,
> it's not hard to hardcode console write or read the printf string
> buffer with a hardware debugger to see error messages. That said, it
> could be removed.
Right. Debugging code shouldn't pollute final patches.
[snip]
> >> +#if MIN_VERSION < 3 || OUT_VERSION > 16
> >> +/**
> >> + * move_nops_fwd - move nops in a v16 dt_struct to the beginning
> >> + * @start - device tree starting address
> >> + * @count - number of %OF_DT_NOP cells to move
> >> + */
> >> +static void move_nops_fwd(u32 *start, int count)
> >
> > What on earth is the point of this. The NOPs are perfectly valid
> > scattered within the tree, why go to all this trouble to shuffle them
> > about.
>
> And if you notice, there is a "how many to move" argument. The point
> of moving them to the front of the tree is the v17 device tree header
> takes more space than the v3 one, and the v2 header is smaller than
> both v17 and v16 header. Since I am converting the tree in place, the
> space has to come from somewhere. Since we are pretty much guaranteed
> to get several nops, this function moves them forward so they can be
> overwritten. In practice we move 1-3 NOPS from the early properties >
> 8 bytes and early grandchild nodes (eg /cpus/PowerPC,xxx).
This is a hell of a lot of bother to go to for a few bytes.
Allocating a big-enough buffer for any reasonable devtree in BSS and
memmove()ing into there would be far simpler.
Remember this is a hack for horrid old device trees produced by
kexec-tools. It simply doesn't justify large amounts of code to work
around.
[snip]
> >> + if (tree->last_comp_version > 3)
> >> + return; /* don't know what to do */
> >
> > Rather, don't need to do anything.
>
> If the tree is >= 16 then we don't presently need to do anything. If
> there is a theoritical v4 tree we don't know what to do. And if output
> version is 17 but input is 16 we don't know what to do either, because
> there likely aren't nops in the tree to consume. I suppose we could
> preceed it with a check for version == OUTPUT_VERSION, but then I'm
> sure I'd get pointless differentation :-).
There will never be a v4. Or anything between v3 and v16.
Again this is far too general. It's a hack to deal with kexec-tools
old trees. Therefore it doesn't need to deal with any general old
tree, just the minimum to deal with trees as produced by old
kexec-tools.
[snip]
> >> + /*
> >> + * move mem_rsvmap and dt_strings if they are before dt_struct
> >> + * onto our nops . Adjust start addresses for the 3 sections.
> >> + */
> >
> > Hrm. Do we really need to worry about this case. You may be
> > producing v2 trees in kexec-tools, but do they actually have the
> > blocks out of order? dtc certainly never produced them that way.
>
> Out of order? There has never been a spec as to the order of the
> blocks, only the implicit assumption that they follow the device tree
> header in a reasonably packed sequence. booting-without-of says it
> must be in ram,; the offsets are unsigned 32 bit quantities.
> As to the order, used, the first implemntation was the kernel which
> writes memreserve, strings, then struct (both the openfirmware client
> in prom_init and the iSeries procedural library in dt.c). The second
> implentation written is a procedural based library (similar to iseries,
> never published, but still used internally) that starts with a
> pre-built header and string table, builds the dt_struct as the
> functions are called, and when finished copies the memreserve table and
> fills in the dt_size, total size, and memreserve offset.
Hrm. Yes, well, the iSeries tree is weird in a bunch of ways.
> fs2dt writes memreserve, struct, then strings. Aparently the same as
> dtc. But yes, the strings can be before the struct, and the mem
> reserve may or may not be when the strings are before the struct.
Again. We don't need to deal with the general case here - just the
real case of trees produced by old kexec-tools.
[snip]
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [PATCH 1/15] boot: find initrd location from device-tree
From: David Gibson @ 2007-09-25 3:27 UTC (permalink / raw)
To: Milton Miller; +Cc: ppcdev, Paul Mackerras
In-Reply-To: <c76a222305d08e74b878c946d4181078@bga.com>
On Mon, Sep 24, 2007 at 03:02:36AM -0500, Milton Miller wrote:
>
> On Sep 23, 2007, at 9:58 PM, David Gibson wrote:
>
> > On Fri, Sep 21, 2007 at 06:03:24PM -0500, Milton Miller wrote:
> >> Some platforms have a boot agent that can create or modify properties
> >> in
> >> the device-tree and load images into memory. Provide a helper to set
> >> loader_info used by prep_initrd().
> >>
> >> Signed-off-by: Milton Miller <miltonm@bga.com>
> >> Acked-by: David Gibson <david@gibson.dropbear.id.au>
> >
> > Hrm, despite my earlier ack, I'm going to whinge about a few nits
> > here.
> >
> >> ---
> >> re 12168
> >> rediffed types.h, offset in ops.h
> >>
> >> Index: kernel/arch/powerpc/boot/ops.h
> >> ===================================================================
> >> --- kernel.orig/arch/powerpc/boot/ops.h 2007-09-17 22:12:47.000000000
> >> -0500
> >> +++ kernel/arch/powerpc/boot/ops.h 2007-09-17 22:12:51.000000000 -0500
> >> @@ -163,6 +163,7 @@ void dt_fixup_clock(const char *path, u3
> >> void __dt_fixup_mac_addresses(u32 startindex, ...);
> >> #define dt_fixup_mac_addresses(...) \
> >> __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
> >> +void dt_find_initrd(void);
> >>
> >>
> >> static inline void *find_node_by_linuxphandle(const u32 linuxphandle)
> >> Index: kernel/arch/powerpc/boot/types.h
> >> ===================================================================
> >> --- kernel.orig/arch/powerpc/boot/types.h 2007-09-17
> >> 22:12:47.000000000 -0500
> >> +++ kernel/arch/powerpc/boot/types.h 2007-09-17 22:12:51.000000000
> >> -0500
> >> @@ -12,6 +12,8 @@ typedef short s16;
> >> typedef int s32;
> >> typedef long long s64;
> >>
> >> +#define UINT_MAX 0xFFFFFFFF
> >
> > I actually don't like this constant - at the point you compare you
> > care, explicitly, about the value not being over 32-bits, rather than
> > whether it fits a uint, so the named constant is more misleading than
> > helpful.
>
> Arguable, I don't like counting F's or zeros in C code.
So check if (addr >> 32) is non-zero.
> It is used as the max address that the wrapper deals with, both here
> and memranges, which happens to be 32 bits.
Right and the reasons for that being the value it is are not because
it also hapeens to be the max uint *or* ulong.
> Actually it cares about overflowing the unsigned long in loader_info,
> not that the address fits in 32 bits.
>
> So it should be ULONG_MAX now (malloc and all the address code was
> changed to use unsigned long instead of unsigned int since the patch
> was written).
>
> And dt_xlate needs the same information. Its is using a hardcoded 64
> bit constant to provide the a simiar check.
>
>
> >> +
> >> #define min(x,y) ({ \
> >> typeof(x) _x = (x); \
> >> typeof(y) _y = (y); \
> >> Index: kernel/arch/powerpc/boot/devtree.c
> >> ===================================================================
> >> --- kernel.orig/arch/powerpc/boot/devtree.c 2007-09-17
> >> 22:12:47.000000000 -0500
> >> +++ kernel/arch/powerpc/boot/devtree.c 2007-09-17 22:12:51.000000000
> >> -0500
> >> @@ -1,6 +1,7 @@
> >> /*
> >> * devtree.c - convenience functions for device tree manipulation
> >> * Copyright 2007 David Gibson, IBM Corporation.
> >> + * Copyright 2007 Milton Miller, IBM Corporation.
> >> * Copyright (c) 2007 Freescale Semiconductor, Inc.
> >> *
> >> * Authors: David Gibson <david@gibson.dropbear.id.au>
> >> @@ -333,3 +334,68 @@ int dt_is_compatible(void *node, const c
> >>
> >> return 0;
> >> }
> >> +
> >> +/**
> >> + * dt_find_initrd - set loader initrd location based on existing
> >> properties
> >> + *
> >> + * finds the linux,initrd-start and linux,initrd-end properties in
> >> + * the /chosen node and sets the loader initrd fields accordingly.
> >> + *
> >> + * Use this if your loader sets the properties to allow other code to
> >> + * relocate the tree and/or cause r3 and r4 to be set on true OF
> >> + * platforms.
> >
> > I am unable to make sense of the paragraph above.
>
> The phrase "relocate the tree" should be "relocate the initrd", which
> the wrapper will do if it located below vmlinux.size. Also, r3 and r4
> need to be set when booting the kernel from a client interface with an
> initrd so it can take it into consideration when choosing the location
> to build the flat tree.
>
> How about:
>
> Filling in the loader info allows main.c to be aware of the initrd,
> meaning prep_initrd will move the initrd if it will be overwritten when
> the kernel is copied to its runtime location. In addition, if you are
> booting the kernel from a client interface instead of a flat device
> tree, this also causes r3 and r4 to be set so the kernel can avoid
> overwriting the initrd when creating the flat tree.
Clearer, but I still don't see that it says anything useful - "finds
the initrd from the devtree and does all the things that are supposed
to be done with an initrd" - which is implied in the previous
paragraph.
>
> >
> >> + */
> >> +void dt_find_initrd(void)
> >> +{
> >> + int rc;
> >> + unsigned long long initrd_start, initrd_end;
> >> + void *devp;
> >> + static const char start_prop[] = "linux,initrd-start";
> >> + static const char end_prop[] = "linux,initrd-end";
> >
> > I think these constants are more obscuring than useful.
>
> They are useful to the extent they reduce the number of source
> characters causing about 8 less line wraps. Since they are used
> multiple places, the compiler only needs to emit one copy of this byte
> sequence. Admitedly you made this point in a prior review.
The compiler is perfectly capable of folding identical string
constants.
> >> +
> >> + devp = finddevice("/chosen");
> >> + if (! devp) {
> >> + return;
> >> + }
> >
> > CodingStyle would not put { } here.
>
> Yea, nit. not sure why I have the braces there, I usually follow that
> one. And what's that space doing after !?
>
> >
> >> +
> >> + rc = getprop(devp, start_prop, &initrd_start, sizeof(initrd_start));
> >> + if (rc < 0)
> >> + return; /* not found */
> >> + /* The properties had to be 8 bytes until 2.6.22 */
> >> + if (rc == sizeof(unsigned long)) {
> >> + unsigned long tmp;
> >> + memcpy(&tmp, &initrd_start, rc);
> >> + initrd_start = tmp;
> >> + } else if (rc != sizeof(initrd_start)) { /* now they
> >> can be 4 */
> >
> > Right. 8 bytes and 4 bytes, so you should be using explicit length
> > types instead of long and long long.
>
> Ok, I guess we ahve u32 and u64 in types.h now. But there is other
> code in the wrapper that assumes its compiled 32 bit ILP.
Yes, but that's no reason to propagate the sin.
> >> + printf("unexpected length of %s in /chosen!\n\r", start_prop);
> >> + return;
> >
> > All these printf() / return stanzas add a lot of verbosity to this
> > function. Any way they can be consolidated a bit, maybe a single
> > error path that just prints the property values, so the user can
> > figure out what was wrong with them.
>
> On a prior review I got asked to split the reasons for ingoring the
> values below (the > 32 bit address from end < start cases). Admitedly
> without all the detailed errors the justification for the string
> varables is reduced.
Hrm. Well, I can't say I'm entirely convinced either way on this
one. I guess I'll think about it again once the rest is cleaned up.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [RFC] [PATCH] PowerPC: add more than 4MB kernel image size support to bootwarapper
From: David Gibson @ 2007-09-25 2:29 UTC (permalink / raw)
To: Valentine Barshak; +Cc: linuxppc-dev
In-Reply-To: <20070924113627.GA30504@ru.mvista.com>
On Mon, Sep 24, 2007 at 03:36:27PM +0400, Valentine Barshak wrote:
> Currently zImage is linked at the 4MB base address.
> Some platforms (using cuboot, treeboot) need the zImage's
> entry point and base address. They place zImage exactly
> at the base address it's been linked to. Sometimes 4MB left
> at the start of the memory is simply not enough to unpack zImage.
> This could happen with initramfs enabled, since the kernel image
> packed along with initramfs.cpio could be over 5MB in size.
> This patch checks vmlinux image size and links zImage at
> the base address that is equal to the unpacked image size
> aligned to 4MB boundary. This way zImage base address is 4MB
> only if unpacked kernel image size is less then 4MB.
Good plan. However..
[snip]
> diff -ruN linux-2.6.orig/arch/powerpc/boot/zImage.lds.S linux-2.6/arch/powerpc/boot/zImage.lds.S
> --- linux-2.6.orig/arch/powerpc/boot/zImage.lds.S 2007-09-22 00:48:08.000000000 +0400
> +++ linux-2.6/arch/powerpc/boot/zImage.lds.S 2007-09-22 04:03:58.000000000 +0400
> @@ -3,7 +3,7 @@
> EXTERN(_zimage_start)
> SECTIONS
> {
> - . = (4*1024*1024);
> + . = ALIGN((_kend - _kstart), (4*1024*1024));
..I don't see any reason to keep the 4MB granularity. I would just
align the address to say a 64k boundary (64k because that's the
granularity used in the normal ABI).
> _start = .;
> .text :
> {
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: Problems compiling Linux for MPC8272ADS
From: David Gibson @ 2007-09-25 2:16 UTC (permalink / raw)
To: Alan Bennett; +Cc: linuxppc-dev, Manil Gaouar
In-Reply-To: <bfa0697f0709240946i341739b3n8d5541b30bca8cb@mail.gmail.com>
On Mon, Sep 24, 2007 at 10:46:41AM -0600, Alan Bennett wrote:
> I added this to my boot/Makefile near the other mcpu=440 lines. I
> believe there may be a fix coming?
I believe there is.
> $(obj)/treeboot-walnut.o: BOOTCFLAGS += -mcpu=440
It should be -mcpu=405 for Walnut, though.
> $(obj)/4xx.o: BOOTCFLAGS += -mcpu=440
> $(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [patch 3/3] mpc8349emitx.dts: Add ds1339 RTC
From: David Gibson @ 2007-09-25 2:13 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linuxppc-dev, Timur Tabi
In-Reply-To: <878x6wpq3t.fsf@macbook.be.48ers.dk>
On Mon, Sep 24, 2007 at 07:52:22AM +0200, Peter Korsgaard wrote:
> >>>>> "David" == David Gibson <david@gibson.dropbear.id.au> writes:
>
> Hi
>
> >> compatible = "fsl-i2c";
> >> reg = <3100 100>;
> >> interrupts = <f 8>;
> >> interrupt-parent = < &ipic >;
> >> dfsrr;
> >> +
> >> + rtc@68 {
> >> + device_type = "rtc";
> >> + compatible = "dallas,ds1339";
> >> + reg = <68>;
> >> + };
>
> David> I think we want to think a bit more carefully about how to do bindings
> David> for RTC devices. No "rtc" device_type is defined, but again we might
> David> want to.
>
> Could be. I've simply done it like kuroboxHD.dts already does and
> fsl_soc.c expects.
>
> David> I did find one real OF binding for a different Dallas RTC (and NVRAM),
> David> see:
>
> David> http://playground.sun.com/1275/proposals/Closed/Remanded/Accepted/346-it.txt
>
> David> It's a little different from the example above.
>
> David> The fact that NVRAM+RTC chips are so common is a bit of an issue from
> David> the point of view of defining a device class binding - a device can't
> David> have type "rtc" and "nvram".
>
> True. I think we should primarily focus on the RTC part rather than
> NVRAM as that's the "main" functionality and leave a NVRAM class for
> I2C EEPROMs.
>
> The Linux driver for the chip (rtc-1307.c) doesn't expose the NVRAM
> bytes either.
Incidentally how are you planning on instantiating the driver? AFAIK
all the rtc-* drivers are platform drivers rather than of_platform
drivers. I had been thinking of an rtc helper function that would go
through the tree instantiating platform devices for any RTCs based on
a compatible -> platform device name table.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [patch 3/3] mpc8349emitx.dts: Add ds1339 RTC
From: David Gibson @ 2007-09-25 2:11 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: linuxppc-dev, Timur Tabi
In-Reply-To: <b312e03ef67dcd6cdc5f57e90da746ef@kernel.crashing.org>
On Mon, Sep 24, 2007 at 11:11:28PM +0200, Segher Boessenkool wrote:
> >> Scott> #size-cells is zero on i2c, so it should just be reg = <68>.
> >>
> >> Scott> You'll probably need to add #address-cells and #size-cells to
> >> the
> >> Scott> controller node, as well.
> >
> > Uh.. yes.. i2c interfaces should really always have #a and #s.
>
> More generally, every node that defines a bus needs it (unless the
> defaults of 2 resp. 1 are correct for this bus, but even then you
> might want it because it makes things more explicit).
Yes. Actually I think we should make explicit #a and #s at least
strongly recommended in the flat tree documentation.
> >> i2c@3100 {
> >> + #address-cells = <1>;
> >> + #size-cells = <0>;
> >> device_type = "i2c";
> >
> > Hrm... we probably want an "i2c" device_type class, but I don't think
> > we've actually defined one, which is a problem
>
> By defining new device_type's, or new semantics for device_type,
> you open the door to (accidentally) becoming incompatible with
> "real" OF.
Hrm... perhaps. But is it a realistic danger - I'll have to think
more about that.
> And you don't need to: "real" OF has a mechanism for specifying
> the "generic device class" already, if you use the "generic names"
> recommended practice (and you do, for both this node and the rtc
> node): it's the generic name itself!
Hmm, I guess.
> >> + rtc@68 {
> >> + device_type = "rtc";
> >> + compatible = "dallas,ds1339";
> >> + reg = <68>;
> >> + };
> >
> > I think we want to think a bit more carefully about how to do bindings
> > for RTC devices. No "rtc" device_type is defined, but again we might
> > want to.
>
> Actually, "device_type" = "rtc" _is_ defined (in the "device support
> extensions" recommended practice), and there is no useful way a flat
> device tree can implement it (it merely defines get-time and set-time
> methods).
Ah.. right. That changes things a bit, in that we might want to
include device_type purely for similarity with real OF tree.
Real OF has a device_type == "nvram" too, doesn't it? AFAICT the real
OF systems I have (which I think all have ISA-like CMOS RTC/NVRAM
chips) the RTC is labelled as "nvram" rather than "rtc".
> > The fact that NVRAM+RTC chips are so common is a bit of an issue from
> > the point of view of defining a device class binding - a device can't
> > have type "rtc" and "nvram".
>
> You should match OS drivers on "compatible" only anyway.
Absolutely. I was only thinking of defining "device classes" where
for some reason it is useful to examine them without needing to pick a
particular driver.
> Those cases where OS drivers don't nicely 1-1 match device nodes are a
> bit of a headache; for RTC/NVRAM devices, these problems are nicely
> side-stepped by handling this from platform code.
Not necessarily. The new RTC class drivers are just drivers like
anything other and are not especially instantiated from the platform
code.
And drat. I was only really mentioning stuff about device_type in
passing, but it's the only thing anyone's responded to. I was also
mostly suggesting changing the format of compatible, for greater
similarity with the existing ds1385 binding.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox