From f25222b99542bcadf1cc53cc9aa0e304849242ca Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Wed, 24 Jan 2007 22:40:49 +0300 Subject: [POWERPC] cpm_uart: OF-related fix for CPM1 This makes cpm uart able to work using OF-passed parameters in case of CPM stuff (found on most mpc8xx reference and custom boards). The idea is to keep ppc stuff working yet making it able to be used for powerpc. Signed-off-by: Vitaly Bordug Signed-off-by: Paul Mackerras --- drivers/serial/cpm_uart/cpm_uart_cpm1.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c index 08e55fdc882..925fb607d8c 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -145,7 +146,7 @@ int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con) /* was hostalloc but changed cause it blows away the */ /* large tlb mapping when pinning the kernel area */ mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); - dma_addr = (u32)mem_addr; + dma_addr = (u32)cpm_dpram_phys(mem_addr); } else mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, GFP_KERNEL); @@ -205,7 +206,7 @@ int __init cpm_uart_init_portdesc(void) (unsigned long)&cpmp->cp_smc[0]; cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); - cpm_uart_ports[UART_SMC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); + cpm_uart_ports[UART_SMC1].port.uartclk = uart_clock(); cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1; #endif @@ -217,7 +218,7 @@ int __init cpm_uart_init_portdesc(void) (unsigned long)&cpmp->cp_smc[1]; cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); - cpm_uart_ports[UART_SMC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); + cpm_uart_ports[UART_SMC2].port.uartclk = uart_clock(); cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2; #endif @@ -231,7 +232,7 @@ int __init cpm_uart_init_portdesc(void) ~(UART_SCCM_TX | UART_SCCM_RX); cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); - cpm_uart_ports[UART_SCC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); + cpm_uart_ports[UART_SCC1].port.uartclk = uart_clock(); cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1; #endif @@ -245,7 +246,7 @@ int __init cpm_uart_init_portdesc(void) ~(UART_SCCM_TX | UART_SCCM_RX); cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); - cpm_uart_ports[UART_SCC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); + cpm_uart_ports[UART_SCC2].port.uartclk = uart_clock(); cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2; #endif @@ -259,7 +260,7 @@ int __init cpm_uart_init_portdesc(void) ~(UART_SCCM_TX | UART_SCCM_RX); cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); - cpm_uart_ports[UART_SCC3].port.uartclk = (((bd_t *) __res)->bi_intfreq); + cpm_uart_ports[UART_SCC3].port.uartclk = uart_clock(); cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3; #endif @@ -273,7 +274,7 @@ int __init cpm_uart_init_portdesc(void) ~(UART_SCCM_TX | UART_SCCM_RX); cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); - cpm_uart_ports[UART_SCC4].port.uartclk = (((bd_t *) __res)->bi_intfreq); + cpm_uart_ports[UART_SCC4].port.uartclk = uart_clock(); cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4; #endif return 0; -- cgit v1.2.3 From 43d80439c5f619446e174abdbdaff4fc0e539546 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 26 Jan 2007 19:07:54 -0800 Subject: [POWERPC] ps3: system bus minor mmio fix Fix two minor bugs in the PS3 system bus mmio region code. First, on error or when freeing a region, retain the bus_addr and len fields to allow subsequent calls to create the region. Second, correct the region address argument to the lv1_unmap_device_mmio_region() call. Fixes modprobe/rmmod of some drivers. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Geoff Levand Acked-by: Arnd Bergmann Signed-off-by: Paul Mackerras --- drivers/ps3/system-bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ps3/system-bus.c b/drivers/ps3/system-bus.c index d79f949bcb2..468bdbcc722 100644 --- a/drivers/ps3/system-bus.c +++ b/drivers/ps3/system-bus.c @@ -50,7 +50,7 @@ int ps3_mmio_region_create(struct ps3_mmio_region *r) if (result) { pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n", __func__, __LINE__, ps3_result(result)); - r->lpar_addr = r->len = r->bus_addr = 0; + r->lpar_addr = 0; } dump_mmio_region(r); @@ -62,13 +62,13 @@ int ps3_free_mmio_region(struct ps3_mmio_region *r) int result; result = lv1_unmap_device_mmio_region(r->did.bus_id, r->did.dev_id, - r->bus_addr); + r->lpar_addr); if (result) pr_debug("%s:%d: lv1_unmap_device_mmio_region failed: %s\n", __func__, __LINE__, ps3_result(result)); - r->lpar_addr = r->len = r->bus_addr = 0; + r->lpar_addr = 0; return result; } -- cgit v1.2.3 From 861be32ce7f1cf272a3f809e77213b83117a0bd2 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Fri, 26 Jan 2007 19:08:08 -0800 Subject: [POWERPC] ps3: bind interrupt to cpu Change the PS3 irq allocation routines to take an argument indicating which cpu (processor thread) the interrupt should be serviced on. The current system configuration favors device interrupts that are serviced on cpu0, so that is used as the default. Signed-off-by: Geoff Levand Acked-by: Arnd Bergmann Signed-off-by: Paul Mackerras --- drivers/ps3/vuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c index 6974f65bcda..a72da8f651f 100644 --- a/drivers/ps3/vuart.c +++ b/drivers/ps3/vuart.c @@ -783,8 +783,8 @@ static int ps3_vuart_probe(struct device *_dev) vuart_private.in_use++; if (vuart_private.in_use == 1) { - result = ps3_alloc_vuart_irq((void*)&vuart_private.bmp.status, - &vuart_private.virq); + result = ps3_alloc_vuart_irq(PS3_BINDING_CPU_ANY, + (void*)&vuart_private.bmp.status, &vuart_private.virq); if (result) { dev_dbg(&dev->core, -- cgit v1.2.3 From 63c2f782e8f6aafbc11b14b2cb291b3dc9fc217d Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Tue, 30 Jan 2007 06:06:00 -0500 Subject: [POWERPC] Add "is_power_of_2" checking to log2.h. Add the inline function "is_power_of_2()" to log2.h, where the value zero is *not* considered to be a power of two. Signed-off-by: Robert P. J. Day Acked-by: Kumar Gala Signed-off-by: Paul Mackerras --- drivers/net/gianfar_ethtool.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers') diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 6d71bea5e90..0d6943d6709 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c @@ -42,8 +42,6 @@ #include "gianfar.h" -#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) - extern void gfar_start(struct net_device *dev); extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit); -- cgit v1.2.3 From 2a08ea69a3e448a5cc94e5da9eccc40cf13f9532 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Tue, 30 Jan 2007 15:20:27 -0800 Subject: [POWERPC] PS3: Move system bus to platform directory Move the PS3 system bus routines from drivers/ps3 to arch/powerpc/platforms/ps3. Signed-off-by: Geoff Levand Acked-by: Benjamin Herrenschmidt Acked-by: Arnd Bergmann Signed-off-by: Paul Mackerras --- drivers/ps3/Makefile | 1 - drivers/ps3/system-bus.c | 362 ----------------------------------------------- 2 files changed, 363 deletions(-) delete mode 100644 drivers/ps3/system-bus.c (limited to 'drivers') diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile index 8433eb7562c..d547cf50ca9 100644 --- a/drivers/ps3/Makefile +++ b/drivers/ps3/Makefile @@ -1,2 +1 @@ -obj-y += system-bus.o obj-$(CONFIG_PS3_VUART) += vuart.o diff --git a/drivers/ps3/system-bus.c b/drivers/ps3/system-bus.c deleted file mode 100644 index 468bdbcc722..00000000000 --- a/drivers/ps3/system-bus.c +++ /dev/null @@ -1,362 +0,0 @@ -/* - * PS3 system bus driver. - * - * Copyright (C) 2006 Sony Computer Entertainment Inc. - * Copyright 2006 Sony Corp. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define dump_mmio_region(_a) _dump_mmio_region(_a, __func__, __LINE__) -static void _dump_mmio_region(const struct ps3_mmio_region* r, - const char* func, int line) -{ - pr_debug("%s:%d: dev %u:%u\n", func, line, r->did.bus_id, - r->did.dev_id); - pr_debug("%s:%d: bus_addr %lxh\n", func, line, r->bus_addr); - pr_debug("%s:%d: len %lxh\n", func, line, r->len); - pr_debug("%s:%d: lpar_addr %lxh\n", func, line, r->lpar_addr); -} - -int ps3_mmio_region_create(struct ps3_mmio_region *r) -{ - int result; - - result = lv1_map_device_mmio_region(r->did.bus_id, r->did.dev_id, - r->bus_addr, r->len, r->page_size, &r->lpar_addr); - - if (result) { - pr_debug("%s:%d: lv1_map_device_mmio_region failed: %s\n", - __func__, __LINE__, ps3_result(result)); - r->lpar_addr = 0; - } - - dump_mmio_region(r); - return result; -} - -int ps3_free_mmio_region(struct ps3_mmio_region *r) -{ - int result; - - result = lv1_unmap_device_mmio_region(r->did.bus_id, r->did.dev_id, - r->lpar_addr); - - if (result) - pr_debug("%s:%d: lv1_unmap_device_mmio_region failed: %s\n", - __func__, __LINE__, ps3_result(result)); - - r->lpar_addr = 0; - return result; -} - -static int ps3_system_bus_match(struct device *_dev, - struct device_driver *_drv) -{ - int result; - struct ps3_system_bus_driver *drv = to_ps3_system_bus_driver(_drv); - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - - result = dev->match_id == drv->match_id; - - pr_info("%s:%d: dev=%u(%s), drv=%u(%s): %s\n", __func__, __LINE__, - dev->match_id, dev->core.bus_id, drv->match_id, drv->core.name, - (result ? "match" : "miss")); - return result; -} - -static int ps3_system_bus_probe(struct device *_dev) -{ - int result; - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - struct ps3_system_bus_driver *drv = - to_ps3_system_bus_driver(_dev->driver); - - result = lv1_open_device(dev->did.bus_id, dev->did.dev_id, 0); - - if (result) { - pr_debug("%s:%d: lv1_open_device failed (%d)\n", - __func__, __LINE__, result); - result = -EACCES; - goto clean_none; - } - - if (dev->d_region->did.bus_id) { - result = ps3_dma_region_create(dev->d_region); - - if (result) { - pr_debug("%s:%d: ps3_dma_region_create failed (%d)\n", - __func__, __LINE__, result); - BUG_ON("check region type"); - result = -EINVAL; - goto clean_device; - } - } - - BUG_ON(!drv); - - if (drv->probe) - result = drv->probe(dev); - else - pr_info("%s:%d: %s no probe method\n", __func__, __LINE__, - dev->core.bus_id); - - if (result) { - pr_debug("%s:%d: drv->probe failed\n", __func__, __LINE__); - goto clean_dma; - } - - return result; - -clean_dma: - ps3_dma_region_free(dev->d_region); -clean_device: - lv1_close_device(dev->did.bus_id, dev->did.dev_id); -clean_none: - return result; -} - -static int ps3_system_bus_remove(struct device *_dev) -{ - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - struct ps3_system_bus_driver *drv = - to_ps3_system_bus_driver(_dev->driver); - - if (drv->remove) - drv->remove(dev); - else - pr_info("%s:%d: %s no remove method\n", __func__, __LINE__, - dev->core.bus_id); - - ps3_dma_region_free(dev->d_region); - ps3_free_mmio_region(dev->m_region); - lv1_close_device(dev->did.bus_id, dev->did.dev_id); - - return 0; -} - -struct bus_type ps3_system_bus_type = { - .name = "ps3_system_bus", - .match = ps3_system_bus_match, - .probe = ps3_system_bus_probe, - .remove = ps3_system_bus_remove, -}; - -int __init ps3_system_bus_init(void) -{ - int result; - - if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) - return 0; - - result = bus_register(&ps3_system_bus_type); - BUG_ON(result); - return result; -} - -core_initcall(ps3_system_bus_init); - -/* Allocates a contiguous real buffer and creates mappings over it. - * Returns the virtual address of the buffer and sets dma_handle - * to the dma address (mapping) of the first page. - */ - -static void * ps3_alloc_coherent(struct device *_dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) -{ - int result; - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - unsigned long virt_addr; - - BUG_ON(!dev->d_region->bus_addr); - - flag &= ~(__GFP_DMA | __GFP_HIGHMEM); - flag |= __GFP_ZERO; - - virt_addr = __get_free_pages(flag, get_order(size)); - - if (!virt_addr) { - pr_debug("%s:%d: get_free_pages failed\n", __func__, __LINE__); - goto clean_none; - } - - result = ps3_dma_map(dev->d_region, virt_addr, size, dma_handle); - - if (result) { - pr_debug("%s:%d: ps3_dma_map failed (%d)\n", - __func__, __LINE__, result); - BUG_ON("check region type"); - goto clean_alloc; - } - - return (void*)virt_addr; - -clean_alloc: - free_pages(virt_addr, get_order(size)); -clean_none: - dma_handle = NULL; - return NULL; -} - -static void ps3_free_coherent(struct device *_dev, size_t size, void *vaddr, - dma_addr_t dma_handle) -{ - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - - ps3_dma_unmap(dev->d_region, dma_handle, size); - free_pages((unsigned long)vaddr, get_order(size)); -} - -/* Creates TCEs for a user provided buffer. The user buffer must be - * contiguous real kernel storage (not vmalloc). The address of the buffer - * passed here is the kernel (virtual) address of the buffer. The buffer - * need not be page aligned, the dma_addr_t returned will point to the same - * byte within the page as vaddr. - */ - -static dma_addr_t ps3_map_single(struct device *_dev, void *ptr, size_t size, - enum dma_data_direction direction) -{ - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - int result; - unsigned long bus_addr; - - result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, - &bus_addr); - - if (result) { - pr_debug("%s:%d: ps3_dma_map failed (%d)\n", - __func__, __LINE__, result); - } - - return bus_addr; -} - -static void ps3_unmap_single(struct device *_dev, dma_addr_t dma_addr, - size_t size, enum dma_data_direction direction) -{ - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - int result; - - result = ps3_dma_unmap(dev->d_region, dma_addr, size); - - if (result) { - pr_debug("%s:%d: ps3_dma_unmap failed (%d)\n", - __func__, __LINE__, result); - } -} - -static int ps3_map_sg(struct device *_dev, struct scatterlist *sg, int nents, - enum dma_data_direction direction) -{ -#if defined(CONFIG_PS3_DYNAMIC_DMA) - BUG_ON("do"); -#endif - return 0; -} - -static void ps3_unmap_sg(struct device *_dev, struct scatterlist *sg, - int nents, enum dma_data_direction direction) -{ -#if defined(CONFIG_PS3_DYNAMIC_DMA) - BUG_ON("do"); -#endif -} - -static int ps3_dma_supported(struct device *_dev, u64 mask) -{ - return 1; -} - -static struct dma_mapping_ops ps3_dma_ops = { - .alloc_coherent = ps3_alloc_coherent, - .free_coherent = ps3_free_coherent, - .map_single = ps3_map_single, - .unmap_single = ps3_unmap_single, - .map_sg = ps3_map_sg, - .unmap_sg = ps3_unmap_sg, - .dma_supported = ps3_dma_supported -}; - -/** - * ps3_system_bus_release_device - remove a device from the system bus - */ - -static void ps3_system_bus_release_device(struct device *_dev) -{ - struct ps3_system_bus_device *dev = to_ps3_system_bus_device(_dev); - kfree(dev); -} - -/** - * ps3_system_bus_device_register - add a device to the system bus - * - * ps3_system_bus_device_register() expects the dev object to be allocated - * dynamically by the caller. The system bus takes ownership of the dev - * object and frees the object in ps3_system_bus_release_device(). - */ - -int ps3_system_bus_device_register(struct ps3_system_bus_device *dev) -{ - int result; - static unsigned int dev_count = 1; - - dev->core.parent = NULL; - dev->core.bus = &ps3_system_bus_type; - dev->core.release = ps3_system_bus_release_device; - - dev->core.archdata.of_node = NULL; - dev->core.archdata.dma_ops = &ps3_dma_ops; - dev->core.archdata.numa_node = 0; - - snprintf(dev->core.bus_id, sizeof(dev->core.bus_id), "sb_%02x", - dev_count++); - - pr_debug("%s:%d add %s\n", __func__, __LINE__, dev->core.bus_id); - - result = device_register(&dev->core); - return result; -} - -EXPORT_SYMBOL_GPL(ps3_system_bus_device_register); - -int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv) -{ - int result; - - drv->core.bus = &ps3_system_bus_type; - - result = driver_register(&drv->core); - return result; -} - -EXPORT_SYMBOL_GPL(ps3_system_bus_driver_register); - -void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv) -{ - driver_unregister(&drv->core); -} - -EXPORT_SYMBOL_GPL(ps3_system_bus_driver_unregister); -- cgit v1.2.3 From 97ec1675999eae96975a30facbedc2e6c0c832bc Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Tue, 30 Jan 2007 15:20:30 -0800 Subject: [POWERPC] PS3: Move vuart declarations to ps3.h Move the structures and routines needed for PS3 vuart port device registration to asm-powerpc/ps3.h. Signed-off-by: Geoff Levand Acked-by: Arnd Bergmann Signed-off-by: Paul Mackerras --- drivers/ps3/vuart.h | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) (limited to 'drivers') diff --git a/drivers/ps3/vuart.h b/drivers/ps3/vuart.h index 28fd89f0c8a..11c421cf7a0 100644 --- a/drivers/ps3/vuart.h +++ b/drivers/ps3/vuart.h @@ -21,37 +21,6 @@ #if !defined(_PS3_VUART_H) #define _PS3_VUART_H -struct ps3_vuart_stats { - unsigned long bytes_written; - unsigned long bytes_read; - unsigned long tx_interrupts; - unsigned long rx_interrupts; - unsigned long disconnect_interrupts; -}; - -/** - * struct ps3_vuart_port_device - a device on a vuart port - */ - -struct ps3_vuart_port_device { - enum ps3_match_id match_id; - struct device core; - - /* private driver variables */ - unsigned int port_number; - unsigned long interrupt_mask; - struct { - spinlock_t lock; - struct list_head head; - } tx_list; - struct { - unsigned long bytes_held; - spinlock_t lock; - struct list_head head; - } rx_list; - struct ps3_vuart_stats stats; -}; - /** * struct ps3_vuart_port_driver - a driver for a device on a vuart port */ @@ -68,9 +37,9 @@ struct ps3_vuart_port_driver { /* int (*resume)(struct ps3_vuart_port_device *); */ }; -int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv); void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv); + int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf, unsigned int bytes); int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf, @@ -86,9 +55,4 @@ static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device( return container_of(_dev, struct ps3_vuart_port_device, core); } -int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf, - unsigned int bytes); -int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf, - unsigned int bytes); - #endif -- cgit v1.2.3 From 5427828e83b7f3c000eaec1cfb09c9bc4d024ad1 Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Wed, 31 Jan 2007 02:09:00 +0300 Subject: [POWERPC] Fix kernel build errors for mpc8272ads and mpc8560ads Recent update of asm-powerpc/io.h caused cpm-related stuff to break in the current kernel. Current patch fixes it, as well as other inconsistencies expressed, that do not permit targets from working properly: - Updated dts with a chosen node with interrupt controller, - fixed messed device IDs among CPM2 SoC devices, - corrected odd header name and fixed type in defines, - Added 82xx subdir to the powerpc/platforms Makefile, missed during initial commit, - new solely-powerpc header file for 8260 family (was using one from arch/ppc, this one cleaned up from the extra stuff), in fact for now a placeholder to get the board-specific includes for stuff not yet capable to live with devicetree peeks only - Fixed couple of misprints in reference mpc8272 dts. Signed-off-by: Vitaly Bordug Signed-off-by: Paul Mackerras --- drivers/net/fs_enet/fs_enet.h | 1 + drivers/serial/cpm_uart/cpm_uart_cpm1.h | 3 --- drivers/serial/cpm_uart/cpm_uart_cpm2.h | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h index 92590d8fc24..569be225cd0 100644 --- a/drivers/net/fs_enet/fs_enet.h +++ b/drivers/net/fs_enet/fs_enet.h @@ -9,6 +9,7 @@ #include #include +#include #ifdef CONFIG_CPM1 #include diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.h b/drivers/serial/cpm_uart/cpm_uart_cpm1.h index 5eb49ea63bf..a99e45e2b6d 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm1.h +++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.h @@ -20,9 +20,6 @@ #define SCC3_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC3) #define SCC4_IRQ (CPM_IRQ_OFFSET + CPMVEC_SCC4) -/* the CPM address */ -#define CPM_ADDR IMAP_ADDR - static inline void cpm_set_brg(int brg, int baud) { cpm_setbrg(brg, baud); diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.h b/drivers/serial/cpm_uart/cpm_uart_cpm2.h index 4b779111eaf..1b3219f56c8 100644 --- a/drivers/serial/cpm_uart/cpm_uart_cpm2.h +++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.h @@ -20,9 +20,6 @@ #define SCC3_IRQ SIU_INT_SCC3 #define SCC4_IRQ SIU_INT_SCC4 -/* the CPM address */ -#define CPM_ADDR CPM_MAP_ADDR - static inline void cpm_set_brg(int brg, int baud) { cpm_setbrg(brg, baud); -- cgit v1.2.3 From 3cdc20e51791bd2fd67781e65640a4650f99c63e Mon Sep 17 00:00:00 2001 From: Ishizaki Kou Date: Fri, 2 Feb 2007 16:44:08 +0900 Subject: [POWERPC] Celleb: hypervisor console driver This patch adds hypervisor console driver for Celleb platform. Signed-off-by: Kou Ishizaki Signed-off-by: Paul Mackerras --- drivers/char/Kconfig | 7 +++ drivers/char/Makefile | 1 + drivers/char/hvc_beat.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 drivers/char/hvc_beat.c (limited to 'drivers') diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 9e43e39dc35..d08bb4ee130 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -610,6 +610,13 @@ config HVC_RTAS help IBM Console device driver which makes use of RTAS +config HVC_BEAT + bool "Toshiba's Beat Hypervisor Console support" + depends on PPC_CELLEB + select HVC_DRIVER + help + Toshiba's Cell Reference Set Beat Console device driver + config HVCS tristate "IBM Hypervisor Virtual Console Server support" depends on PPC_PSERIES diff --git a/drivers/char/Makefile b/drivers/char/Makefile index fc110637ced..0326ca1a848 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_RIO) += rio/ generic_serial.o obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o +obj-$(CONFIG_HVC_BEAT) += hvc_beat.o obj-$(CONFIG_HVC_DRIVER) += hvc_console.o obj-$(CONFIG_RAW_DRIVER) += raw.o obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o diff --git a/drivers/char/hvc_beat.c b/drivers/char/hvc_beat.c new file mode 100644 index 00000000000..6f019f19be7 --- /dev/null +++ b/drivers/char/hvc_beat.c @@ -0,0 +1,134 @@ +/* + * Beat hypervisor console driver + * + * (C) Copyright 2006 TOSHIBA CORPORATION + * + * This code is based on drivers/char/hvc_rtas.c: + * (C) Copyright IBM Corporation 2001-2005 + * (C) Copyright Red Hat, Inc. 2005 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hvc_console.h" + +extern int64_t beat_get_term_char(uint64_t, uint64_t *, uint64_t *, uint64_t *); +extern int64_t beat_put_term_char(uint64_t, uint64_t, uint64_t, uint64_t); + +struct hvc_struct *hvc_beat_dev = NULL; + +/* bug: only one queue is available regardless of vtermno */ +static int hvc_beat_get_chars(uint32_t vtermno, char *buf, int cnt) +{ + static unsigned char q[sizeof(unsigned long) * 2] + __attribute__((aligned(sizeof(unsigned long)))); + static int qlen = 0; + unsigned long got; + +again: + if (qlen) { + if (qlen > cnt) { + memcpy(buf, q, cnt); + qlen -= cnt; + memmove(q + cnt, q, qlen); + return cnt; + } else { /* qlen <= cnt */ + int r; + + memcpy(buf, q, qlen); + r = qlen; + qlen = 0; + return r; + } + } + if (beat_get_term_char(vtermno, &got, + ((unsigned long *)q), ((unsigned long *)q) + 1) == 0) { + qlen = got; + goto again; + } + return 0; +} + +static int hvc_beat_put_chars(uint32_t vtermno, const char *buf, int cnt) +{ + unsigned long kb[2]; + int rest, nlen; + + for (rest = cnt; rest > 0; rest -= nlen) { + nlen = (rest > 16) ? 16 : rest; + memcpy(kb, buf, nlen); + beat_put_term_char(vtermno, rest, kb[0], kb[1]); + rest -= nlen; + } + return cnt; +} + +static struct hv_ops hvc_beat_get_put_ops = { + .get_chars = hvc_beat_get_chars, + .put_chars = hvc_beat_put_chars, +}; + +static int hvc_beat_useit = 1; + +static int hvc_beat_config(char *p) +{ + hvc_beat_useit = simple_strtoul(p, NULL, 0); + return 0; +} + +static int hvc_beat_console_init(void) +{ + if (hvc_beat_useit && machine_is_compatible("Beat")) { + hvc_instantiate(0, 0, &hvc_beat_get_put_ops); + } + return 0; +} + +/* temp */ +static int hvc_beat_init(void) +{ + struct hvc_struct *hp; + + if (!firmware_has_feature(FW_FEATURE_BEAT)) + return -ENODEV; + + hp = hvc_alloc(0, NO_IRQ, &hvc_beat_get_put_ops, 16); + if (IS_ERR(hp)) + return PTR_ERR(hp); + hvc_beat_dev = hp; + return 0; +} + +static void __exit hvc_beat_exit(void) +{ + if (hvc_beat_dev) + hvc_remove(hvc_beat_dev); +} + +module_init(hvc_beat_init); +module_exit(hvc_beat_exit); + +__setup("hvc_beat=", hvc_beat_config); + +console_initcall(hvc_beat_console_init); -- cgit v1.2.3 From f31909c00332b3e8299209eaba6cec80756f802c Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 7 Feb 2007 09:45:55 +0100 Subject: [POWERPC] ppc: Fix booke watchdog initialization Fix two problems in the book-e watchdog driver. a) The 4xx default period was defined wrong b) Clear status before enabling the watchdog exception Signed-off-by: Stefan Roese Signed-off-by: Paul Mackerras --- drivers/char/watchdog/booke_wdt.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/char/watchdog/booke_wdt.c index 488902231cc..0e23f29f71a 100644 --- a/drivers/char/watchdog/booke_wdt.c +++ b/drivers/char/watchdog/booke_wdt.c @@ -35,7 +35,7 @@ #ifdef CONFIG_FSL_BOOKE #define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */ #else -#define WDT_PERIOD_DEFAULT 4 /* Refer to the PPC40x and PPC4xx manuals */ +#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */ #endif /* for timing information */ u32 booke_wdt_enabled = 0; @@ -47,6 +47,14 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT; #define WDTP(x) (TCR_WP(x)) #endif +/* + * booke_wdt_ping: + */ +static __inline__ void booke_wdt_ping(void) +{ + mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); +} + /* * booke_wdt_enable: */ @@ -54,20 +62,14 @@ static __inline__ void booke_wdt_enable(void) { u32 val; + /* clear status before enabling watchdog */ + booke_wdt_ping(); val = mfspr(SPRN_TCR); val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period)); mtspr(SPRN_TCR, val); } -/* - * booke_wdt_ping: - */ -static __inline__ void booke_wdt_ping(void) -{ - mtspr(SPRN_TSR, TSR_ENW|TSR_WIS); -} - /* * booke_wdt_write: */ -- cgit v1.2.3 From 1ed2ddf380e19dafeec2150ca709ef7f4a67cd21 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 5 Feb 2007 19:30:29 +0100 Subject: [POWERPC] windfarm: don't die on suspend thread signal When the windfarm thread gets a suspend signal it will die instead of freezing. This fixes it. Signed-off-by: Johannes Berg Acked-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- drivers/macintosh/windfarm_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c index e947af982f9..94c117ef20c 100644 --- a/drivers/macintosh/windfarm_core.c +++ b/drivers/macintosh/windfarm_core.c @@ -94,8 +94,6 @@ static int wf_thread_func(void *data) DBG("wf: thread started\n"); while(!kthread_should_stop()) { - try_to_freeze(); - if (time_after_eq(jiffies, next)) { wf_notify(WF_EVENT_TICK, NULL); if (wf_overtemp) { @@ -118,8 +116,8 @@ static int wf_thread_func(void *data) if (delay <= HZ) schedule_timeout_interruptible(delay); - /* there should be no signal, but oh well */ - if (signal_pending(current)) { + /* there should be no non-suspend signal, but oh well */ + if (signal_pending(current) && !try_to_freeze()) { printk(KERN_WARNING "windfarm: thread got sigl !\n"); break; } -- cgit v1.2.3