From b45cc9eff72e0871ffb83ae32c3dbca382909706 Mon Sep 17 00:00:00 2001 From: Dave Liu Date: Mon, 8 Jun 2009 22:24:36 +0800 Subject: serial: Make ucc_uart work in HW UART mode In HW UART mode the TxBD[READY] is not cleared by H/W (RISC engine) when the user send characters to Tx buffer of QE UART. So, these characters stay on the QE forever, never go to UART line. Signed-off-by: Dave Liu Signed-off-by: Kumar Gala --- drivers/serial/ucc_uart.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c index 7de66c06b05..e945e780b5c 100644 --- a/drivers/serial/ucc_uart.c +++ b/drivers/serial/ucc_uart.c @@ -681,22 +681,27 @@ static void qe_uart_init_ucc(struct uart_qe_port *qe_port) out_be16(&uccup->rccm, 0xc0ff); /* Configure the GUMR registers for UART */ - if (soft_uart) + if (soft_uart) { /* Soft-UART requires a 1X multiplier for TX */ clrsetbits_be32(&uccp->gumr_l, UCC_SLOW_GUMR_L_MODE_MASK | UCC_SLOW_GUMR_L_TDCR_MASK | UCC_SLOW_GUMR_L_RDCR_MASK, UCC_SLOW_GUMR_L_MODE_UART | UCC_SLOW_GUMR_L_TDCR_1 | UCC_SLOW_GUMR_L_RDCR_16); - else + + clrsetbits_be32(&uccp->gumr_h, UCC_SLOW_GUMR_H_RFW, + UCC_SLOW_GUMR_H_TRX | UCC_SLOW_GUMR_H_TTX); + } else { clrsetbits_be32(&uccp->gumr_l, UCC_SLOW_GUMR_L_MODE_MASK | UCC_SLOW_GUMR_L_TDCR_MASK | UCC_SLOW_GUMR_L_RDCR_MASK, UCC_SLOW_GUMR_L_MODE_UART | UCC_SLOW_GUMR_L_TDCR_16 | UCC_SLOW_GUMR_L_RDCR_16); - clrsetbits_be32(&uccp->gumr_h, UCC_SLOW_GUMR_H_RFW, - UCC_SLOW_GUMR_H_TRX | UCC_SLOW_GUMR_H_TTX); + clrsetbits_be32(&uccp->gumr_h, + UCC_SLOW_GUMR_H_TRX | UCC_SLOW_GUMR_H_TTX, + UCC_SLOW_GUMR_H_RFW); + } #ifdef LOOPBACK clrsetbits_be32(&uccp->gumr_l, UCC_SLOW_GUMR_L_DIAG_MASK, @@ -706,7 +711,7 @@ static void qe_uart_init_ucc(struct uart_qe_port *qe_port) UCC_SLOW_GUMR_H_CDS); #endif - /* Enable rx interrupts and clear all pending events. */ + /* Disable rx interrupts and clear all pending events. */ out_be16(&uccp->uccm, 0); out_be16(&uccp->ucce, 0xffff); out_be16(&uccp->udsr, 0x7e7e); @@ -765,6 +770,10 @@ static void qe_uart_init_ucc(struct uart_qe_port *qe_port) cecr_subblock = ucc_slow_get_qe_cr_subblock(qe_port->ucc_num); qe_issue_cmd(QE_INIT_TX_RX, cecr_subblock, QE_CR_PROTOCOL_UNSPECIFIED, 0); + } else { + cecr_subblock = ucc_slow_get_qe_cr_subblock(qe_port->ucc_num); + qe_issue_cmd(QE_INIT_TX_RX, cecr_subblock, + QE_CR_PROTOCOL_UART, 0); } } -- cgit v1.2.3 From 5f28c52003612cccf12dfcbac4d9f0692bd28e67 Mon Sep 17 00:00:00 2001 From: Yang Li Date: Mon, 11 May 2009 22:36:02 +0000 Subject: rio: warn_unused_result warnings fix Adding failure path for the following two cases. warning: ignoring return value of 'device_add', declared with attribute warn_unused_result warning: ignoring return value of 'sysfs_create_bin_file', declared with attribute warn_unused_result Signed-off-by: Li Yang Signed-off-by: Kumar Gala --- drivers/rapidio/rio-scan.c | 43 ++++++++++++++++++++++++++----------------- drivers/rapidio/rio-sysfs.c | 6 ++++-- 2 files changed, 30 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 3b78540288c..45415096c29 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -263,15 +263,21 @@ static void rio_route_set_ops(struct rio_dev *rdev) * device to the RIO device list. Creates the generic sysfs nodes * for an RIO device. */ -static void __devinit rio_add_device(struct rio_dev *rdev) +static int __devinit rio_add_device(struct rio_dev *rdev) { - device_add(&rdev->dev); + int err; + + err = device_add(&rdev->dev); + if (err) + return err; spin_lock(&rio_global_list_lock); list_add_tail(&rdev->global_list, &rio_devices); spin_unlock(&rio_global_list_lock); rio_create_sysfs_dev_files(rdev); + + return 0; } /** @@ -294,13 +300,14 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, struct rio_mport *port, u16 destid, u8 hopcount, int do_enum) { + int ret = 0; struct rio_dev *rdev; - struct rio_switch *rswitch; + struct rio_switch *rswitch = NULL; int result, rdid; rdev = kzalloc(sizeof(struct rio_dev), GFP_KERNEL); if (!rdev) - goto out; + return NULL; rdev->net = net; rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR, @@ -343,23 +350,16 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, rio_mport_read_config_32(port, destid, hopcount, RIO_SWP_INFO_CAR, &rdev->swpinfo); rswitch = kmalloc(sizeof(struct rio_switch), GFP_KERNEL); - if (!rswitch) { - kfree(rdev); - rdev = NULL; - goto out; - } + if (!rswitch) + goto cleanup; rswitch->switchid = next_switchid; rswitch->hopcount = hopcount; rswitch->destid = destid; rswitch->route_table = kzalloc(sizeof(u8)* RIO_MAX_ROUTE_ENTRIES(port->sys_size), GFP_KERNEL); - if (!rswitch->route_table) { - kfree(rdev); - rdev = NULL; - kfree(rswitch); - goto out; - } + if (!rswitch->route_table) + goto cleanup; /* Initialize switch route table */ for (rdid = 0; rdid < RIO_MAX_ROUTE_ENTRIES(port->sys_size); rdid++) @@ -390,10 +390,19 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE], 0, 0xffff); - rio_add_device(rdev); + ret = rio_add_device(rdev); + if (ret) + goto cleanup; - out: return rdev; + +cleanup: + if (rswitch) { + kfree(rswitch->route_table); + kfree(rswitch); + } + kfree(rdev); + return NULL; } /** diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index 97a147f050d..ba742e82c57 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c @@ -214,9 +214,11 @@ static struct bin_attribute rio_config_attr = { */ int rio_create_sysfs_dev_files(struct rio_dev *rdev) { - sysfs_create_bin_file(&rdev->dev.kobj, &rio_config_attr); + int err = 0; - return 0; + err = sysfs_create_bin_file(&rdev->dev.kobj, &rio_config_attr); + + return err; } /** -- cgit v1.2.3 From 48dce82cd6df71c8e7cddc79d787735b109ee0a3 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 10 Jun 2009 04:38:58 +0000 Subject: net/ps3: gelic - Add missing annotations probe functions should be __devinit Signed-off-by: Geert Uytterhoeven Acked-by: Geoff Levand Acked-by: David S. Miller Signed-off-by: Benjamin Herrenschmidt --- drivers/net/ps3_gelic_net.c | 22 ++++++++++++---------- drivers/net/ps3_gelic_wireless.c | 6 +++--- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'drivers') diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c index 2b38f39924a..d1a5fb4d6ac 100644 --- a/drivers/net/ps3_gelic_net.c +++ b/drivers/net/ps3_gelic_net.c @@ -214,9 +214,10 @@ static void gelic_card_free_chain(struct gelic_card *card, * * returns 0 on success, <0 on failure */ -static int gelic_card_init_chain(struct gelic_card *card, - struct gelic_descr_chain *chain, - struct gelic_descr *start_descr, int no) +static int __devinit gelic_card_init_chain(struct gelic_card *card, + struct gelic_descr_chain *chain, + struct gelic_descr *start_descr, + int no) { int i; struct gelic_descr *descr; @@ -407,7 +408,7 @@ rewind: * * returns 0 on success, < 0 on failure */ -static int gelic_card_alloc_rx_skbs(struct gelic_card *card) +static int __devinit gelic_card_alloc_rx_skbs(struct gelic_card *card) { struct gelic_descr_chain *chain; int ret; @@ -1422,8 +1423,8 @@ static const struct net_device_ops gelic_netdevice_ops = { * * fills out function pointers in the net_device structure */ -static void gelic_ether_setup_netdev_ops(struct net_device *netdev, - struct napi_struct *napi) +static void __devinit gelic_ether_setup_netdev_ops(struct net_device *netdev, + struct napi_struct *napi) { netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT; /* NAPI */ @@ -1443,7 +1444,8 @@ static void gelic_ether_setup_netdev_ops(struct net_device *netdev, * gelic_ether_setup_netdev initializes the net_device structure * and register it. **/ -int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) +int __devinit gelic_net_setup_netdev(struct net_device *netdev, + struct gelic_card *card) { int status; u64 v1, v2; @@ -1491,7 +1493,7 @@ int gelic_net_setup_netdev(struct net_device *netdev, struct gelic_card *card) * the card and net_device structures are linked to each other */ #define GELIC_ALIGN (32) -static struct gelic_card *gelic_alloc_card_net(struct net_device **netdev) +static struct gelic_card * __devinit gelic_alloc_card_net(struct net_device **netdev) { struct gelic_card *card; struct gelic_port *port; @@ -1542,7 +1544,7 @@ static struct gelic_card *gelic_alloc_card_net(struct net_device **netdev) return card; } -static void gelic_card_get_vlan_info(struct gelic_card *card) +static void __devinit gelic_card_get_vlan_info(struct gelic_card *card) { u64 v1, v2; int status; @@ -1616,7 +1618,7 @@ static void gelic_card_get_vlan_info(struct gelic_card *card) /** * ps3_gelic_driver_probe - add a device to the control of this driver */ -static int ps3_gelic_driver_probe(struct ps3_system_bus_device *dev) +static int __devinit ps3_gelic_driver_probe(struct ps3_system_bus_device *dev) { struct gelic_card *card; struct net_device *netdev; diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index 4f3ada622f9..b6b3ca9bdb2 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c @@ -2442,7 +2442,7 @@ static const struct iw_handler_def gelic_wl_wext_handler_def = { #endif }; -static struct net_device *gelic_wl_alloc(struct gelic_card *card) +static struct net_device * __devinit gelic_wl_alloc(struct gelic_card *card) { struct net_device *netdev; struct gelic_port *port; @@ -2722,7 +2722,7 @@ static struct ethtool_ops gelic_wl_ethtool_ops = { .set_rx_csum = gelic_net_set_rx_csum, }; -static void gelic_wl_setup_netdev_ops(struct net_device *netdev) +static void __devinit gelic_wl_setup_netdev_ops(struct net_device *netdev) { struct gelic_wl_info *wl; wl = port_wl(netdev_priv(netdev)); @@ -2738,7 +2738,7 @@ static void gelic_wl_setup_netdev_ops(struct net_device *netdev) /* * driver probe/remove */ -int gelic_wl_driver_probe(struct gelic_card *card) +int __devinit gelic_wl_driver_probe(struct gelic_card *card) { int ret; struct net_device *netdev; -- cgit v1.2.3 From e364ca92770a84ab3a917359ba7fed69479a16e3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 10 Jun 2009 09:42:30 +0000 Subject: drivers/hvc: Add missing __devexit_p() The remove function uses __devexit, so the .remove assignment needs __devexit_p() to fix a build error with hotplug disabled. Signed-off-by: Mike Frysinger Signed-off-by: Andrew Morton Signed-off-by: Benjamin Herrenschmidt --- drivers/char/hvc_iseries.c | 2 +- drivers/char/hvc_vio.c | 2 +- drivers/char/hvcs.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c index 449727b6166..936d05bf37f 100644 --- a/drivers/char/hvc_iseries.c +++ b/drivers/char/hvc_iseries.c @@ -241,7 +241,7 @@ static int __devexit hvc_vio_remove(struct vio_dev *vdev) static struct vio_driver hvc_vio_driver = { .id_table = hvc_driver_table, .probe = hvc_vio_probe, - .remove = hvc_vio_remove, + .remove = __devexit_p(hvc_vio_remove), .driver = { .name = hvc_driver_name, .owner = THIS_MODULE, diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c index bd62dc86b47..c72b994652a 100644 --- a/drivers/char/hvc_vio.c +++ b/drivers/char/hvc_vio.c @@ -113,7 +113,7 @@ static int __devexit hvc_vio_remove(struct vio_dev *vdev) static struct vio_driver hvc_vio_driver = { .id_table = hvc_driver_table, .probe = hvc_vio_probe, - .remove = hvc_vio_remove, + .remove = __devexit_p(hvc_vio_remove), .driver = { .name = hvc_driver_name, .owner = THIS_MODULE, diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index c76bccf5354..2724d628527 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c @@ -868,7 +868,7 @@ static int __devexit hvcs_remove(struct vio_dev *dev) static struct vio_driver hvcs_vio_driver = { .id_table = hvcs_driver_table, .probe = hvcs_probe, - .remove = hvcs_remove, + .remove = __devexit_p(hvcs_remove), .driver = { .name = hvcs_driver_name, .owner = THIS_MODULE, -- cgit v1.2.3 From eedacbf02df462d6c915d8d642b23fb450d485c7 Mon Sep 17 00:00:00 2001 From: Dave Mitchell Date: Tue, 9 Jun 2009 13:39:47 +0000 Subject: of_serial: Add UPF_FIXED_TYPE flag This patch adds the UPF_FIXED_TYPE flag which will bypass the 8250's autoconfig probe for uart type. The uart type identified by the of_serial's parse of the flat device tree will be utilized as defined. Signed-off-by: Dave Mitchell Signed-off-by: Benjamin Herrenschmidt --- drivers/serial/of_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c index 14f8fa9135b..3f2027c70e4 100644 --- a/drivers/serial/of_serial.c +++ b/drivers/serial/of_serial.c @@ -67,7 +67,7 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev, port->type = type; port->uartclk = *clk; port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP - | UPF_FIXED_PORT; + | UPF_FIXED_PORT | UPF_FIXED_TYPE; port->dev = &ofdev->dev; /* If current-speed was set, then try not to change it. */ if (spd) -- cgit v1.2.3 From c4b512bc832c6c6aab14acb2bd96940e867e5018 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 10 Jun 2009 04:38:56 +0000 Subject: ps3rom: Use ps3_system_bus_[gs]et_drvdata() instead of direct access Signed-off-by: Geert Uytterhoeven Acked-by: James E.J. Bottomley Signed-off-by: Benjamin Herrenschmidt --- drivers/scsi/ps3rom.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index ca0dd33497e..db90caf43f4 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c @@ -299,7 +299,7 @@ static irqreturn_t ps3rom_interrupt(int irq, void *data) return IRQ_HANDLED; } - host = dev->sbd.core.driver_data; + host = ps3_system_bus_get_drvdata(&dev->sbd); priv = shost_priv(host); cmd = priv->curr_cmd; @@ -387,7 +387,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev) } priv = shost_priv(host); - dev->sbd.core.driver_data = host; + ps3_system_bus_set_drvdata(&dev->sbd, host); priv->dev = dev; /* One device/LUN per SCSI bus */ @@ -407,7 +407,7 @@ static int __devinit ps3rom_probe(struct ps3_system_bus_device *_dev) fail_host_put: scsi_host_put(host); - dev->sbd.core.driver_data = NULL; + ps3_system_bus_set_drvdata(&dev->sbd, NULL); fail_teardown: ps3stor_teardown(dev); fail_free_bounce: @@ -418,12 +418,12 @@ fail_free_bounce: static int ps3rom_remove(struct ps3_system_bus_device *_dev) { struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core); - struct Scsi_Host *host = dev->sbd.core.driver_data; + struct Scsi_Host *host = ps3_system_bus_get_drvdata(&dev->sbd); scsi_remove_host(host); ps3stor_teardown(dev); scsi_host_put(host); - dev->sbd.core.driver_data = NULL; + ps3_system_bus_set_drvdata(&dev->sbd, NULL); kfree(dev->bounce_buf); return 0; } -- cgit v1.2.3 From 313485175da221c388f6a8ecf4c30062ba9bea17 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 10 Jun 2009 04:38:59 +0000 Subject: usb/ps3: Add missing annotations probe functions should be __devinit initialization functions should be __init Signed-off-by: Geert Uytterhoeven Acked-by: Geoff Levand Acked-by: Greg Kroah-Hartman Signed-off-by: Benjamin Herrenschmidt --- drivers/usb/host/ehci-ps3.c | 4 ++-- drivers/usb/host/ohci-ps3.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index bb870b8f81b..3e8844e56ca 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c @@ -76,7 +76,7 @@ static const struct hc_driver ps3_ehci_hc_driver = { .port_handed_over = ehci_port_handed_over, }; -static int ps3_ehci_probe(struct ps3_system_bus_device *dev) +static int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev) { int result; struct usb_hcd *hcd; @@ -224,7 +224,7 @@ static int ps3_ehci_remove(struct ps3_system_bus_device *dev) return 0; } -static int ps3_ehci_driver_register(struct ps3_system_bus_driver *drv) +static int __init ps3_ehci_driver_register(struct ps3_system_bus_driver *drv) { return firmware_has_feature(FW_FEATURE_PS3_LV1) ? ps3_system_bus_driver_register(drv) diff --git a/drivers/usb/host/ohci-ps3.c b/drivers/usb/host/ohci-ps3.c index 1d56259c5db..700950455f4 100644 --- a/drivers/usb/host/ohci-ps3.c +++ b/drivers/usb/host/ohci-ps3.c @@ -75,7 +75,7 @@ static const struct hc_driver ps3_ohci_hc_driver = { #endif }; -static int ps3_ohci_probe(struct ps3_system_bus_device *dev) +static int __devinit ps3_ohci_probe(struct ps3_system_bus_device *dev) { int result; struct usb_hcd *hcd; @@ -224,7 +224,7 @@ static int ps3_ohci_remove(struct ps3_system_bus_device *dev) return 0; } -static int ps3_ohci_driver_register(struct ps3_system_bus_driver *drv) +static int __init ps3_ohci_driver_register(struct ps3_system_bus_driver *drv) { return firmware_has_feature(FW_FEATURE_PS3_LV1) ? ps3_system_bus_driver_register(drv) -- cgit v1.2.3 From aa296a891d1f3704d40127e998c31dfda531fca7 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Wed, 17 Jun 2009 00:30:02 -0600 Subject: fbdev/xilinxfb: Fix improper casting and tighen up probe path The xilinxfb driver is improperly casting a physical address to a u32, and the probe routine isn't as straight forward as it could be. (discovered by gcc spitting out warnings on most recent change to xilinxfb driver). This patch fixes the cast and simplifies the probe path. Signed-off-by: Grant Likely Tested-by: John Linn --- drivers/video/xilinxfb.c | 59 +++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) (limited to 'drivers') diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 7a868bd16e0..ed7c8d0ddcc 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -124,7 +124,6 @@ struct xilinxfb_drvdata { registers */ dcr_host_t dcr_host; - unsigned int dcr_start; unsigned int dcr_len; void *fb_virt; /* virt. address of the frame buffer */ @@ -325,8 +324,8 @@ static int xilinxfb_assign(struct device *dev, drvdata->regs); } /* Put a banner in the log (for DEBUG) */ - dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n", - (void *)drvdata->fb_phys, drvdata->fb_virt, fbsize); + dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n", + (unsigned long long)drvdata->fb_phys, drvdata->fb_virt, fbsize); return 0; /* success */ @@ -404,9 +403,7 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) u32 tft_access; struct xilinxfb_platform_data pdata; struct resource res; - int size, rc; - int start = 0, len = 0; - dcr_host_t dcr_host; + int size, rc, start; struct xilinxfb_drvdata *drvdata; /* Copy with the default pdata (not a ptr reference!) */ @@ -414,35 +411,39 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match); + /* Allocate the driver data region */ + drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); + if (!drvdata) { + dev_err(&op->dev, "Couldn't allocate device private record\n"); + return -ENOMEM; + } + /* * To check whether the core is connected directly to DCR or PLB * interface and initialize the tft_access accordingly. */ p = (u32 *)of_get_property(op->node, "xlnx,dcr-splb-slave-if", NULL); - - if (p) - tft_access = *p; - else - tft_access = 0; /* For backward compatibility */ + tft_access = p ? *p : 0; /* * Fill the resource structure if its direct PLB interface * otherwise fill the dcr_host structure. */ if (tft_access) { + drvdata->flags |= PLB_ACCESS_FLAG; rc = of_address_to_resource(op->node, 0, &res); if (rc) { dev_err(&op->dev, "invalid address\n"); - return -ENODEV; + goto err; } - } else { + res.start = 0; start = dcr_resource_start(op->node, 0); - len = dcr_resource_len(op->node, 0); - dcr_host = dcr_map(op->node, start, len); - if (!DCR_MAP_OK(dcr_host)) { - dev_err(&op->dev, "invalid address\n"); - return -ENODEV; + drvdata->dcr_len = dcr_resource_len(op->node, 0); + drvdata->dcr_host = dcr_map(op->node, start, drvdata->dcr_len); + if (!DCR_MAP_OK(drvdata->dcr_host)) { + dev_err(&op->dev, "invalid DCR address\n"); + goto err; } } @@ -467,26 +468,12 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) if (of_find_property(op->node, "rotate-display", NULL)) pdata.rotate_screen = 1; - /* Allocate the driver data region */ - drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) { - dev_err(&op->dev, "Couldn't allocate device private record\n"); - return -ENOMEM; - } dev_set_drvdata(&op->dev, drvdata); + return xilinxfb_assign(&op->dev, drvdata, res.start, &pdata); - if (tft_access) - drvdata->flags |= PLB_ACCESS_FLAG; - - /* Arguments are passed based on the interface */ - if (drvdata->flags & PLB_ACCESS_FLAG) { - return xilinxfb_assign(&op->dev, drvdata, res.start, &pdata); - } else { - drvdata->dcr_start = start; - drvdata->dcr_len = len; - drvdata->dcr_host = dcr_host; - return xilinxfb_assign(&op->dev, drvdata, 0, &pdata); - } + err: + kfree(drvdata); + return -ENODEV; } static int __devexit xilinxfb_of_remove(struct of_device *op) -- cgit v1.2.3 From ab7f3341df07747079b46c38d4e445f38f9a3192 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Wed, 17 Jun 2009 00:30:10 -0600 Subject: powerpc/5200: convert mpc52xx_psc_spi to use cs_control callback mpc52xx_psc_spi driver is the last user of the legacy activate_cs and deactivate_cs callbacks, so convert the driver to the cs_control hook and remove the legacy callbacks from fsl_spi_platform_data struct. Signed-off-by: Anton Vorontsov Signed-off-by: Grant Likely --- drivers/spi/mpc52xx_psc_spi.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'drivers') diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 68c77a91159..e1901fdce77 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -30,8 +31,7 @@ struct mpc52xx_psc_spi { /* fsl_spi_platform data */ - void (*activate_cs)(u8, u8); - void (*deactivate_cs)(u8, u8); + void (*cs_control)(struct spi_device *spi, bool on); u32 sysclk; /* driver internal data */ @@ -111,18 +111,16 @@ static void mpc52xx_psc_spi_activate_cs(struct spi_device *spi) out_be16((u16 __iomem *)&psc->ccr, ccr); mps->bits_per_word = cs->bits_per_word; - if (mps->activate_cs) - mps->activate_cs(spi->chip_select, - (spi->mode & SPI_CS_HIGH) ? 1 : 0); + if (mps->cs_control) + mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0); } static void mpc52xx_psc_spi_deactivate_cs(struct spi_device *spi) { struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); - if (mps->deactivate_cs) - mps->deactivate_cs(spi->chip_select, - (spi->mode & SPI_CS_HIGH) ? 1 : 0); + if (mps->cs_control) + mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1); } #define MPC52xx_PSC_BUFSIZE (MPC52xx_PSC_RFNUM_MASK + 1) @@ -388,15 +386,13 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, mps->irq = irq; if (pdata == NULL) { dev_warn(dev, "probe called without platform data, no " - "(de)activate_cs function will be called\n"); - mps->activate_cs = NULL; - mps->deactivate_cs = NULL; + "cs_control function will be called\n"); + mps->cs_control = NULL; mps->sysclk = 0; master->bus_num = bus_num; master->num_chipselect = 255; } else { - mps->activate_cs = pdata->activate_cs; - mps->deactivate_cs = pdata->deactivate_cs; + mps->cs_control = pdata->cs_control; mps->sysclk = pdata->sysclk; master->bus_num = pdata->bus_num; master->num_chipselect = pdata->max_chipselect; -- cgit v1.2.3 From 87c441e54dfcf9f45593ecaf68e7e18ea53d5e13 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Wed, 17 Jun 2009 00:30:22 -0600 Subject: powerpc/5xxx: Add common mpc5xxx_get_bus_frequency() function So far, MPC512x used mpc512x_find_ips_freq() to get the bus frequency, while MPC52xx used mpc52xx_find_ipb_freq(). Despite the different clock names (IPS vs. IPB) the code was identical. Use common code for both processor families. Signed-off-by: Wolfgang Denk Signed-off-by: Grant Likely --- drivers/ata/pata_mpc52xx.c | 2 +- drivers/i2c/busses/i2c-mpc.c | 2 +- drivers/net/fec_mpc52xx.c | 2 +- drivers/net/fec_mpc52xx_phy.c | 2 +- drivers/serial/mpc52xx_uart.c | 5 ++--- drivers/watchdog/mpc5200_wdt.c | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 68d27bc70d0..2bc2dbe30e8 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c @@ -694,7 +694,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match) struct bcom_task *dmatsk = NULL; /* Get ipb frequency */ - ipb_freq = mpc52xx_find_ipb_freq(op->node); + ipb_freq = mpc5xxx_get_bus_frequency(op->node); if (!ipb_freq) { dev_err(&op->dev, "could not determine IPB bus frequency\n"); return -ENODEV; diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index dd778d7ae04..d325e86e310 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -197,7 +197,7 @@ int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) return -EINVAL; /* Determine divider value */ - divider = mpc52xx_find_ipb_freq(node) / clock; + divider = mpc5xxx_get_bus_frequency(node) / clock; /* * We want to choose an FDR/DFSR that generates an I2C bus speed that diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index 8bbe7f61799..5ddf03325d1 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c @@ -1006,7 +1006,7 @@ mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) priv->phy_addr = FEC5200_PHYADDR_NONE; priv->speed = 100; priv->duplex = DUPLEX_HALF; - priv->phy_speed = ((mpc52xx_find_ipb_freq(op->node) >> 20) / 5) << 1; + priv->phy_speed = ((mpc5xxx_get_bus_frequency(op->node) >> 20) / 5) << 1; /* the 7-wire property means don't use MII mode */ if (of_find_property(op->node, "fsl,7-wire-mode", NULL)) diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index dd9bfa42ac3..176e9b8d710 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c @@ -120,7 +120,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, /* set MII speed */ out_be32(&priv->regs->mii_speed, - ((mpc52xx_find_ipb_freq(of->node) >> 20) / 5) << 1); + ((mpc5xxx_get_bus_frequency(of->node) >> 20) / 5) << 1); err = mdiobus_register(bus); if (err) diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index b3feb6198d5..abbd146c50d 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c @@ -76,7 +76,6 @@ #include #include -#include #include #if defined(CONFIG_SERIAL_MPC52xx_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) @@ -254,7 +253,7 @@ static unsigned long mpc52xx_getuartclk(void *p) * but the generic serial code assumes 16 * so return ipb freq / 2 */ - return mpc52xx_find_ipb_freq(p) / 2; + return mpc5xxx_get_bus_frequency(p) / 2; } static struct psc_ops mpc52xx_psc_ops = { @@ -391,7 +390,7 @@ static void mpc512x_psc_cw_restore_ints(struct uart_port *port) static unsigned long mpc512x_getuartclk(void *p) { - return mpc512x_find_ips_freq(p); + return mpc5xxx_get_bus_frequency(p); } static struct psc_ops mpc512x_psc_ops = { diff --git a/drivers/watchdog/mpc5200_wdt.c b/drivers/watchdog/mpc5200_wdt.c index 465fe36adad..fa9c47ce0ae 100644 --- a/drivers/watchdog/mpc5200_wdt.c +++ b/drivers/watchdog/mpc5200_wdt.c @@ -188,7 +188,7 @@ static int mpc5200_wdt_probe(struct of_device *op, if (!wdt) return -ENOMEM; - wdt->ipb_freq = mpc52xx_find_ipb_freq(op->node); + wdt->ipb_freq = mpc5xxx_get_bus_frequency(op->node); err = of_address_to_resource(op->node, 0, &wdt->mem); if (err) -- cgit v1.2.3