[PATCH v3 00/12] staging: tidspbridge: various cleanups
This set of patches replaces some of the redundant components of the tidspbridge driver, such as: * wrapper functions for kmalloc/kfree * custom bitmap implementation * custom linked list implementation (list_head wrapper) with the standard linux kernel interfaces. The patches also do some code reorganization for increasing readability. Most of the changes reduce the code indentation level and simplify the code. No functional changes were done. There are many places in this driver that need this kind of cleanup, but these patches only fix the functions that were touched while converting the code to use linux bitmap and list_head. Changes since v1: * Split the bitmap patch into multiple patches * Split the list_head patch into multiple patches Changes since v2: * Fixes to the list_head patches based on Rene Sapiens' review Ionut Nicu (12): staging: tidspbridge: remove gs memory allocator staging: tidspbridge: remove utildefs staging: tidspbridge: switch to linux bitmap API staging: tidspbridge: remove gb bitmap implementation staging: tidspbridge: rmgr/node.c code cleanup staging: tidspbridge: convert core to list_head staging: tidspbridge: convert pmgr to list_head staging: tidspbridge: convert rmgr to list_head staging: tidspbridge: remove custom linked list staging: tidspbridge: core code cleanup staging: tidspbridge: pmgr code cleanup staging: tidspbridge: rmgr code cleanup drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/TODO |1 - drivers/staging/tidspbridge/core/_msg_sm.h | 12 +- drivers/staging/tidspbridge/core/chnl_sm.c | 630 +++- drivers/staging/tidspbridge/core/io_sm.c | 266 +++ drivers/staging/tidspbridge/core/msg_sm.c | 601 ++- drivers/staging/tidspbridge/gen/gb.c | 166 - drivers/staging/tidspbridge/gen/gh.c | 38 +- drivers/staging/tidspbridge/gen/gs.c | 88 --- .../tidspbridge/include/dspbridge/_chnl_sm.h |8 +- .../tidspbridge/include/dspbridge/cmmdefs.h|1 - drivers/staging/tidspbridge/include/dspbridge/gb.h | 79 -- drivers/staging/tidspbridge/include/dspbridge/gs.h | 59 -- .../staging/tidspbridge/include/dspbridge/list.h | 225 -- .../staging/tidspbridge/include/dspbridge/sync.h |1 + .../tidspbridge/include/dspbridge/utildefs.h | 39 - drivers/staging/tidspbridge/pmgr/cmm.c | 535 +- drivers/staging/tidspbridge/pmgr/dev.c | 73 +-- drivers/staging/tidspbridge/rmgr/drv.c | 242 ++ drivers/staging/tidspbridge/rmgr/node.c| 775 +--- drivers/staging/tidspbridge/rmgr/proc.c|2 - drivers/staging/tidspbridge/rmgr/rmm.c | 313 - 22 files changed, 1448 insertions(+), 2708 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/gb.c delete mode 100644 drivers/staging/tidspbridge/gen/gs.c delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/gb.h delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/gs.h delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/list.h delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/utildefs.h -- 1.7.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 01/12] staging: tidspbridge: remove gs memory allocator
Remove unnecessary wrappers for linux kernel memory allocation primitives. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/gb.c | 11 +-- drivers/staging/tidspbridge/gen/gh.c | 38 ++--- drivers/staging/tidspbridge/gen/gs.c | 88 drivers/staging/tidspbridge/include/dspbridge/gs.h | 59 - 5 files changed, 15 insertions(+), 183 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/gs.c delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/gs.h diff --git a/drivers/staging/tidspbridge/Makefile b/drivers/staging/tidspbridge/Makefile index 41c644c..648e392 100644 --- a/drivers/staging/tidspbridge/Makefile +++ b/drivers/staging/tidspbridge/Makefile @@ -1,6 +1,6 @@ obj-$(CONFIG_TIDSPBRIDGE) += bridgedriver.o -libgen = gen/gb.o gen/gs.o gen/gh.o gen/uuidutil.o +libgen = gen/gb.o gen/gh.o gen/uuidutil.o libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \ core/tiomap3430_pwr.o core/tiomap_io.o \ core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o diff --git a/drivers/staging/tidspbridge/gen/gb.c b/drivers/staging/tidspbridge/gen/gb.c index 9f59023..3c0e04c 100644 --- a/drivers/staging/tidspbridge/gen/gb.c +++ b/drivers/staging/tidspbridge/gen/gb.c @@ -19,7 +19,6 @@ /* --- DSP/BIOS Bridge */ #include linux/types.h /* --- This */ -#include dspbridge/gs.h #include dspbridge/gb.h struct gb_t_map { @@ -52,17 +51,17 @@ struct gb_t_map *gb_create(u32 len) { struct gb_t_map *map; u32 i; - map = (struct gb_t_map *)gs_alloc(sizeof(struct gb_t_map)); + map = kzalloc(sizeof(struct gb_t_map), GFP_KERNEL); if (map != NULL) { map-len = len; map-wcnt = len / BITS_PER_LONG + 1; - map-words = (u32 *) gs_alloc(map-wcnt * sizeof(u32)); + map-words = kzalloc(map-wcnt * sizeof(u32), GFP_KERNEL); if (map-words != NULL) { for (i = 0; i map-wcnt; i++) map-words[i] = 0L; } else { - gs_frees(map, sizeof(struct gb_t_map)); + kfree(map); map = NULL; } } @@ -78,8 +77,8 @@ struct gb_t_map *gb_create(u32 len) void gb_delete(struct gb_t_map *map) { - gs_frees(map-words, map-wcnt * sizeof(u32)); - gs_frees(map, sizeof(struct gb_t_map)); + kfree(map-words); + kfree(map); } /* diff --git a/drivers/staging/tidspbridge/gen/gh.c b/drivers/staging/tidspbridge/gen/gh.c index f72d943..cd72503 100644 --- a/drivers/staging/tidspbridge/gen/gh.c +++ b/drivers/staging/tidspbridge/gen/gh.c @@ -17,9 +17,6 @@ #include linux/types.h #include dspbridge/host_os.h - -#include dspbridge/gs.h - #include dspbridge/gh.h struct element { @@ -37,8 +34,6 @@ struct gh_t_hash_tab { }; static void noop(void *p); -static s32 cur_init; -static void myfree(void *ptr, s32 size); /* * gh_create @@ -51,8 +46,7 @@ struct gh_t_hash_tab *gh_create(u16 max_bucket, u16 val_size, { struct gh_t_hash_tab *hash_tab; u16 i; - hash_tab = - (struct gh_t_hash_tab *)gs_alloc(sizeof(struct gh_t_hash_tab)); + hash_tab = kzalloc(sizeof(struct gh_t_hash_tab), GFP_KERNEL); if (hash_tab == NULL) return NULL; hash_tab-max_bucket = max_bucket; @@ -62,7 +56,7 @@ struct gh_t_hash_tab *gh_create(u16 max_bucket, u16 val_size, hash_tab-delete = delete == NULL ? noop : delete; hash_tab-buckets = (struct element **) - gs_alloc(sizeof(struct element *) * max_bucket); + kzalloc(sizeof(struct element *) * max_bucket, GFP_KERNEL); if (hash_tab-buckets == NULL) { gh_delete(hash_tab); return NULL; @@ -89,17 +83,14 @@ void gh_delete(struct gh_t_hash_tab *hash_tab) elem = next) { next = elem-next; (*hash_tab-delete) (elem-data); - myfree(elem, - sizeof(struct element) - 1 + - hash_tab-val_size); + kfree(elem); } } - myfree(hash_tab-buckets, sizeof(struct element *) - * hash_tab-max_bucket); + kfree(hash_tab-buckets); } - myfree(hash_tab, sizeof(struct gh_t_hash_tab)); + kfree(hash_tab); } } @@ -109,9 +100,7 @@ void
[PATCH v3 02/12] staging: tidspbridge: remove utildefs
Remove a header file that was not very useful to the dspbridge driver. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- .../tidspbridge/include/dspbridge/utildefs.h | 39 drivers/staging/tidspbridge/pmgr/cmm.c |9 + 2 files changed, 1 insertions(+), 47 deletions(-) delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/utildefs.h diff --git a/drivers/staging/tidspbridge/include/dspbridge/utildefs.h b/drivers/staging/tidspbridge/include/dspbridge/utildefs.h deleted file mode 100644 index 8fe5414..000 --- a/drivers/staging/tidspbridge/include/dspbridge/utildefs.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * utildefs.h - * - * DSP-BIOS Bridge driver support functions for TI OMAP processors. - * - * Global UTIL constants and types, shared between DSP API and DSPSYS. - * - * Copyright (C) 2005-2006 Texas Instruments, Inc. - * - * This package is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef UTILDEFS_ -#define UTILDEFS_ - -/* constants taken from configmg.h */ -#define UTIL_MAXMEMREGS 9 -#define UTIL_MAXIOPORTS 20 -#define UTIL_MAXIRQS7 -#define UTIL_MAXDMACHNLS7 - -/* misc. constants */ -#define UTIL_MAXARGVS 10 - -/* Platform specific important info */ -struct util_sysinfo { - /* Granularity of page protection; usually 1k or 4k */ - u32 dw_page_size; - u32 dw_allocation_granularity; /* VM granularity, usually 64K */ - u32 dw_number_of_processors;/* Used as sanity check */ -}; - -#endif /* UTILDEFS_ */ diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c index 93a7c4f..8dbdd20 100644 --- a/drivers/staging/tidspbridge/pmgr/cmm.c +++ b/drivers/staging/tidspbridge/pmgr/cmm.c @@ -40,7 +40,6 @@ /* --- OS Adaptation Layer */ #include dspbridge/list.h #include dspbridge/sync.h -#include dspbridge/utildefs.h /* --- Platform Manager */ #include dspbridge/dev.h @@ -245,7 +244,6 @@ int cmm_create(struct cmm_object **ph_cmm_mgr, { struct cmm_object *cmm_obj = NULL; int status = 0; - struct util_sysinfo sys_info; DBC_REQUIRE(refs 0); DBC_REQUIRE(ph_cmm_mgr != NULL); @@ -261,12 +259,7 @@ int cmm_create(struct cmm_object **ph_cmm_mgr, DBC_ASSERT(mgr_attrts-ul_min_block_size = 4); /* save away smallest block allocation for this cmm mgr */ cmm_obj-ul_min_block_size = mgr_attrts-ul_min_block_size; - /* save away the systems memory page size */ - sys_info.dw_page_size = PAGE_SIZE; - sys_info.dw_allocation_granularity = PAGE_SIZE; - sys_info.dw_number_of_processors = 1; - - cmm_obj-dw_page_size = sys_info.dw_page_size; + cmm_obj-dw_page_size = PAGE_SIZE; /* Note: DSP SM seg table(aDSPSMSegTab[]) zero'd by * MEM_ALLOC_OBJECT */ -- 1.7.3.2 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 03/12] staging: tidspbridge: switch to linux bitmap API
Replace the tidspbridge generic bitmap operations with the linux standard bitmap implementation. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/rmgr/node.c | 166 ++- 1 files changed, 74 insertions(+), 92 deletions(-) diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c index 1562f3c..ab35806 100644 --- a/drivers/staging/tidspbridge/rmgr/node.c +++ b/drivers/staging/tidspbridge/rmgr/node.c @@ -17,6 +17,7 @@ */ #include linux/types.h +#include linux/bitmap.h /* --- Host OS */ #include dspbridge/host_os.h @@ -50,7 +51,6 @@ #include dspbridge/dspioctl.h /* --- Others */ -#include dspbridge/gb.h #include dspbridge/uuidutil.h /* --- This */ @@ -132,11 +132,14 @@ struct node_mgr { struct lst_list *node_list; /* List of all allocated nodes */ u32 num_nodes; /* Number of nodes in node_list */ u32 num_created;/* Number of nodes *created* on DSP */ - struct gb_t_map *pipe_map; /* Pipe connection bit map */ - struct gb_t_map *pipe_done_map; /* Pipes that are half free */ - struct gb_t_map *chnl_map; /* Channel allocation bit map */ - struct gb_t_map *dma_chnl_map; /* DMA Channel allocation bit map */ - struct gb_t_map *zc_chnl_map; /* Zero-Copy Channel alloc bit map */ + DECLARE_BITMAP(pipe_map, MAXPIPES); /* Pipe connection bitmap */ + DECLARE_BITMAP(pipe_done_map, MAXPIPES); /* Pipes that are half free */ + /* Channel allocation bitmap */ + DECLARE_BITMAP(chnl_map, CHNL_MAXCHANNELS); + /* DMA Channel allocation bitmap */ + DECLARE_BITMAP(dma_chnl_map, CHNL_MAXCHANNELS); + /* Zero-Copy Channel alloc bitmap */ + DECLARE_BITMAP(zc_chnl_map, CHNL_MAXCHANNELS); struct ntfy_object *ntfy_obj; /* Manages registered notifications */ struct mutex node_mgr_lock; /* For critical sections */ u32 ul_fxn_addrs[NUMRMSFXNS]; /* RMS function addresses */ @@ -847,8 +850,8 @@ int node_connect(struct node_object *node1, u32 stream1, struct node_object *dev_node_obj; struct node_object *hnode; struct stream_chnl *pstream; - u32 pipe_id = GB_NOBITS; - u32 chnl_id = GB_NOBITS; + u32 pipe_id; + u32 chnl_id; s8 chnl_mode; u32 dw_length; int status = 0; @@ -951,10 +954,11 @@ int node_connect(struct node_object *node1, u32 stream1, (node2_type == NODE_TASK || node2_type == NODE_DAISSOCKET))) { /* Find available pipe */ - pipe_id = gb_findandset(hnode_mgr-pipe_map); - if (pipe_id == GB_NOBITS) { + pipe_id = find_first_zero_bit(hnode_mgr-pipe_map, MAXPIPES); + if (pipe_id == MAXPIPES) { status = -ECONNREFUSED; } else { + set_bit(pipe_id, hnode_mgr-pipe_map); node1-outputs[stream1].type = NODECONNECT; node2-inputs[stream2].type = NODECONNECT; node1-outputs[stream1].dev_id = pipe_id; @@ -971,7 +975,7 @@ int node_connect(struct node_object *node1, u32 stream1, output-sz_device = NULL; input-sz_device = NULL; - gb_clear(hnode_mgr-pipe_map, pipe_id); + clear_bit(pipe_id, hnode_mgr-pipe_map); status = -ENOMEM; } else { /* Copy /dbpipepipId name to device names */ @@ -996,34 +1000,47 @@ int node_connect(struct node_object *node1, u32 stream1, * called for this node. */ if (pattrs) { if (pattrs-strm_mode == STRMMODE_RDMA) { - chnl_id = - gb_findandset(hnode_mgr-dma_chnl_map); + chnl_id = find_first_zero_bit( + hnode_mgr-dma_chnl_map, + CHNL_MAXCHANNELS); /* dma chans are 2nd transport chnl set * ids(e.g. 16-31) */ - (chnl_id != GB_NOBITS) ? - (chnl_id = -chnl_id + -hnode_mgr-ul_num_chnls) : chnl_id; + if (chnl_id != CHNL_MAXCHANNELS) { + set_bit(chnl_id, + hnode_mgr-dma_chnl_map); + chnl_id = chnl_id + +
[PATCH v3 04/12] staging: tidspbridge: remove gb bitmap implementation
Now that all users of gb have been converted to the standard linux bitmap API, we can remove it from the gen library. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/gb.c | 165 drivers/staging/tidspbridge/include/dspbridge/gb.h | 79 -- 3 files changed, 1 insertions(+), 245 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/gb.c delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/gb.h diff --git a/drivers/staging/tidspbridge/Makefile b/drivers/staging/tidspbridge/Makefile index 648e392..fd6a276 100644 --- a/drivers/staging/tidspbridge/Makefile +++ b/drivers/staging/tidspbridge/Makefile @@ -1,6 +1,6 @@ obj-$(CONFIG_TIDSPBRIDGE) += bridgedriver.o -libgen = gen/gb.o gen/gh.o gen/uuidutil.o +libgen = gen/gh.o gen/uuidutil.o libcore = core/chnl_sm.o core/msg_sm.o core/io_sm.o core/tiomap3430.o \ core/tiomap3430_pwr.o core/tiomap_io.o \ core/ue_deh.o core/wdt.o core/dsp-clock.o core/sync.o diff --git a/drivers/staging/tidspbridge/gen/gb.c b/drivers/staging/tidspbridge/gen/gb.c deleted file mode 100644 index 3c0e04c..000 --- a/drivers/staging/tidspbridge/gen/gb.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * gb.c - * - * DSP-BIOS Bridge driver support functions for TI OMAP processors. - * - * Generic bitmap operations. - * - * Copyright (C) 2005-2006 Texas Instruments, Inc. - * - * This package is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -/* --- DSP/BIOS Bridge */ -#include linux/types.h -/* --- This */ -#include dspbridge/gb.h - -struct gb_t_map { - u32 len; - u32 wcnt; - u32 *words; -}; - -/* - * gb_clear - * purpose: - * Clears a bit in the bit map. - */ - -void gb_clear(struct gb_t_map *map, u32 bitn) -{ - u32 mask; - - mask = 1L (bitn % BITS_PER_LONG); - map-words[bitn / BITS_PER_LONG] = ~mask; -} - -/* - * gb_create - * purpose: - * Creates a bit map. - */ - -struct gb_t_map *gb_create(u32 len) -{ - struct gb_t_map *map; - u32 i; - map = kzalloc(sizeof(struct gb_t_map), GFP_KERNEL); - if (map != NULL) { - map-len = len; - map-wcnt = len / BITS_PER_LONG + 1; - map-words = kzalloc(map-wcnt * sizeof(u32), GFP_KERNEL); - if (map-words != NULL) { - for (i = 0; i map-wcnt; i++) - map-words[i] = 0L; - - } else { - kfree(map); - map = NULL; - } - } - - return map; -} - -/* - * gb_delete - * purpose: - * Frees a bit map. - */ - -void gb_delete(struct gb_t_map *map) -{ - kfree(map-words); - kfree(map); -} - -/* - * gb_findandset - * purpose: - * Finds a free bit and sets it. - */ -u32 gb_findandset(struct gb_t_map *map) -{ - u32 bitn; - - bitn = gb_minclear(map); - - if (bitn != GB_NOBITS) - gb_set(map, bitn); - - return bitn; -} - -/* - * gb_minclear - * purpose: - * returns the location of the first unset bit in the bit map. - */ -u32 gb_minclear(struct gb_t_map *map) -{ - u32 bit_location = 0; - u32 bit_acc = 0; - u32 i; - u32 bit; - u32 *word; - - for (word = map-words, i = 0; i map-wcnt; word++, i++) { - if (~*word) { - for (bit = 0; bit BITS_PER_LONG; bit++, bit_acc++) { - if (bit_acc == map-len) - return GB_NOBITS; - - if (~*word (1L bit)) { - bit_location = i * BITS_PER_LONG + bit; - return bit_location; - } - - } - } else { - bit_acc += BITS_PER_LONG; - } - } - - return GB_NOBITS; -} - -/* - * gb_set - * purpose: - * Sets a bit in the bit map. - */ - -void gb_set(struct gb_t_map *map, u32 bitn) -{ - u32 mask; - - mask = 1L (bitn % BITS_PER_LONG); - map-words[bitn / BITS_PER_LONG] |= mask; -} - -/* - * gb_test - * purpose: - * Returns true if the bit is set in the specified location. - */ - -bool gb_test(struct gb_t_map *map, u32 bitn) -{ -
[PATCH v3 05/12] staging: tidspbridge: rmgr/node.c code cleanup
Reorganized some code in rmgr/node.c to increase its readability. Most of the changes reduce the code indentation level and simplifiy the code. No functional changes were done. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/rmgr/node.c | 607 +++ 1 files changed, 284 insertions(+), 323 deletions(-) diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c index ab35806..f213652 100644 --- a/drivers/staging/tidspbridge/rmgr/node.c +++ b/drivers/staging/tidspbridge/rmgr/node.c @@ -235,9 +235,9 @@ struct node_object { /* Default buffer attributes */ static struct dsp_bufferattr node_dfltbufattrs = { - 0, /* cb_struct */ - 1, /* segment_id */ - 0, /* buf_alignment */ + .cb_struct = 0, + .segment_id = 1, + .buf_alignment = 0, }; static void delete_node(struct node_object *hnode, @@ -283,8 +283,7 @@ enum node_state node_get_state(void *hnode) struct node_object *pnode = (struct node_object *)hnode; if (!pnode) return -1; - else - return pnode-node_state; + return pnode-node_state; } /* @@ -844,6 +843,7 @@ int node_connect(struct node_object *node1, u32 stream1, char *pstr_dev_name = NULL; enum node_type node1_type = NODE_TASK; enum node_type node2_type = NODE_TASK; + enum dsp_strmmode strm_mode; struct node_strmdef *pstrm_def; struct node_strmdef *input = NULL; struct node_strmdef *output = NULL; @@ -857,60 +857,50 @@ int node_connect(struct node_object *node1, u32 stream1, int status = 0; DBC_REQUIRE(refs 0); - if ((node1 != (struct node_object *)DSP_HGPPNODE !node1) || - (node2 != (struct node_object *)DSP_HGPPNODE !node2)) - status = -EFAULT; + if (!node1 || !node2) + return -EFAULT; - if (!status) { - /* The two nodes must be on the same processor */ - if (node1 != (struct node_object *)DSP_HGPPNODE - node2 != (struct node_object *)DSP_HGPPNODE - node1-hnode_mgr != node2-hnode_mgr) - status = -EPERM; - /* Cannot connect a node to itself */ - if (node1 == node2) - status = -EPERM; + /* The two nodes must be on the same processor */ + if (node1 != (struct node_object *)DSP_HGPPNODE + node2 != (struct node_object *)DSP_HGPPNODE + node1-hnode_mgr != node2-hnode_mgr) + return -EPERM; - } - if (!status) { - /* node_get_type() will return NODE_GPP if hnode = -* DSP_HGPPNODE. */ - node1_type = node_get_type(node1); - node2_type = node_get_type(node2); - /* Check stream indices ranges */ - if ((node1_type != NODE_GPP node1_type != NODE_DEVICE -stream1 = MAX_OUTPUTS(node1)) || (node2_type != NODE_GPP - node2_type != - NODE_DEVICE - stream2 = - MAX_INPUTS(node2))) - status = -EINVAL; - } - if (!status) { - /* -* Only the following types of connections are allowed: -* task/dais socket == task/dais socket -* task/dais socket == device -* task/dais socket == GPP -* -* ie, no message nodes, and at least one task or dais -* socket node. -*/ - if (node1_type == NODE_MESSAGE || node2_type == NODE_MESSAGE || - (node1_type != NODE_TASK node1_type != NODE_DAISSOCKET -node2_type != NODE_TASK node2_type != NODE_DAISSOCKET)) - status = -EPERM; - } + /* Cannot connect a node to itself */ + if (node1 == node2) + return -EPERM; + + /* node_get_type() will return NODE_GPP if hnode = +* DSP_HGPPNODE. */ + node1_type = node_get_type(node1); + node2_type = node_get_type(node2); + /* Check stream indices ranges */ + if ((node1_type != NODE_GPP node1_type != NODE_DEVICE + stream1 = MAX_OUTPUTS(node1)) || + (node2_type != NODE_GPP node2_type != NODE_DEVICE +stream2 = MAX_INPUTS(node2))) + return -EINVAL; + + /* +* Only the following types of connections are allowed: +* task/dais socket == task/dais socket +* task/dais
[PATCH v3 06/12] staging: tidspbridge: convert core to list_head
Convert the core module of the tidspbridge driver to use struct list_head instead of struct lst_list. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/core/_msg_sm.h | 12 +- drivers/staging/tidspbridge/core/chnl_sm.c | 243 --- drivers/staging/tidspbridge/core/io_sm.c | 142 +--- drivers/staging/tidspbridge/core/msg_sm.c | 236 +++ .../tidspbridge/include/dspbridge/_chnl_sm.h |8 +- .../tidspbridge/include/dspbridge/cmmdefs.h|1 - .../staging/tidspbridge/include/dspbridge/sync.h |1 + 7 files changed, 262 insertions(+), 381 deletions(-) diff --git a/drivers/staging/tidspbridge/core/_msg_sm.h b/drivers/staging/tidspbridge/core/_msg_sm.h index 556de5c..b78d1a6 100644 --- a/drivers/staging/tidspbridge/core/_msg_sm.h +++ b/drivers/staging/tidspbridge/core/_msg_sm.h @@ -20,7 +20,7 @@ #ifndef _MSG_SM_ #define _MSG_SM_ -#include dspbridge/list.h +#include linux/list.h #include dspbridge/msgdefs.h /* @@ -86,12 +86,12 @@ struct msg_mgr { struct bridge_drv_interface *intf_fxns; struct io_mgr *hio_mgr; /* IO manager */ - struct lst_list *queue_list;/* List of MSG_QUEUEs */ + struct list_head queue_list;/* List of MSG_QUEUEs */ spinlock_t msg_mgr_lock;/* For critical sections */ /* Signalled when MsgFrame is available */ struct sync_object *sync_event; - struct lst_list *msg_free_list; /* Free MsgFrames ready to be filled */ - struct lst_list *msg_used_list; /* MsgFrames ready to go to DSP */ + struct list_head msg_free_list; /* Free MsgFrames ready to be filled */ + struct list_head msg_used_list; /* MsgFrames ready to go to DSP */ u32 msgs_pending; /* # of queued messages to go to DSP */ u32 max_msgs; /* Max # of msgs that fit in buffer */ msg_onexit on_exit; /* called when RMS_EXIT is received */ @@ -111,9 +111,9 @@ struct msg_queue { struct msg_mgr *hmsg_mgr; u32 max_msgs; /* Node message depth */ u32 msgq_id;/* Node environment pointer */ - struct lst_list *msg_free_list; /* Free MsgFrames ready to be filled */ + struct list_head msg_free_list; /* Free MsgFrames ready to be filled */ /* Filled MsgFramess waiting to be read */ - struct lst_list *msg_used_list; + struct list_head msg_used_list; void *arg; /* Handle passed to mgr on_exit callback */ struct sync_object *sync_event; /* Signalled when message is ready */ struct sync_object *sync_done; /* For synchronizing cleanup */ diff --git a/drivers/staging/tidspbridge/core/chnl_sm.c b/drivers/staging/tidspbridge/core/chnl_sm.c index 662a5b5..ca19ede 100644 --- a/drivers/staging/tidspbridge/core/chnl_sm.c +++ b/drivers/staging/tidspbridge/core/chnl_sm.c @@ -37,9 +37,9 @@ * which may cause timeouts and/or failure offunction sync_wait_on_event. * This invariant condition is: * - * LST_Empty(pchnl-pio_completions) == pchnl-sync_event is reset + * list_empty(pchnl-pio_completions) == pchnl-sync_event is reset * and - * !LST_Empty(pchnl-pio_completions) == pchnl-sync_event is set. + * !list_empty(pchnl-pio_completions) == pchnl-sync_event is set. */ #include linux/types.h @@ -73,11 +73,9 @@ #define MAILBOX_IRQ INT_MAIL_MPU_IRQ /* --- Function Prototypes */ -static struct lst_list *create_chirp_list(u32 chirps); +static int create_chirp_list(struct list_head *list, u32 chirps); -static void free_chirp_list(struct lst_list *chirp_list); - -static struct chnl_irp *make_new_chirp(void); +static void free_chirp_list(struct list_head *list); static int search_free_channel(struct chnl_mgr *chnl_mgr_obj, u32 *chnl); @@ -179,10 +177,14 @@ func_cont: } if (!status) { /* Get a free chirp: */ - chnl_packet_obj = - (struct chnl_irp *)lst_get_head(pchnl-free_packets_list); - if (chnl_packet_obj == NULL) + if (!list_empty(pchnl-free_packets_list)) { + chnl_packet_obj = list_first_entry( + pchnl-free_packets_list, + struct chnl_irp, link); + list_del(chnl_packet_obj-link); + } else { status = -EIO; + } } if (!status) { @@ -206,8 +208,7 @@ func_cont: chnl_packet_obj-dw_arg = dw_arg; chnl_packet_obj-status = (is_eos ? CHNL_IOCSTATEOS : CHNL_IOCSTATCOMPLETE); - lst_put_tail(pchnl-pio_requests, -(struct list_head *)chnl_packet_obj); +
[PATCH v3 07/12] staging: tidspbridge: convert pmgr to list_head
Convert the pmgr module of the tidspbridge driver to use struct list_head instead of struct lst_list. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/pmgr/cmm.c | 237 ++-- drivers/staging/tidspbridge/pmgr/dev.c | 59 +++- 2 files changed, 98 insertions(+), 198 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c index 8dbdd20..d7ca2a4 100644 --- a/drivers/staging/tidspbridge/pmgr/cmm.c +++ b/drivers/staging/tidspbridge/pmgr/cmm.c @@ -12,7 +12,7 @@ * describes a block of physically contiguous shared memory used for * future allocations by CMM. * - * Memory is coelesced back to the appropriate heap when a buffer is + * Memory is coalesced back to the appropriate heap when a buffer is * freed. * * Notes: @@ -30,6 +30,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #include linux/types.h +#include linux/list.h /* --- DSP/BIOS Bridge */ #include dspbridge/dbdefs.h @@ -38,7 +39,6 @@ #include dspbridge/dbc.h /* --- OS Adaptation Layer */ -#include dspbridge/list.h #include dspbridge/sync.h /* --- Platform Manager */ @@ -73,9 +73,9 @@ struct cmm_allocator {/* sma */ u32 ul_dsp_size;/* DSP seg size in bytes */ struct cmm_object *hcmm_mgr;/* back ref to parent mgr */ /* node list of available memory */ - struct lst_list *free_list_head; + struct list_head free_list; /* node list of memory in use */ - struct lst_list *in_use_list_head; + struct list_head in_use_list; }; struct cmm_xlator {/* Pa-Va translator object */ @@ -97,7 +97,7 @@ struct cmm_object { * Cmm Lock is used to serialize access mem manager for multi-threads. */ struct mutex cmm_lock; /* Lock to access cmm mgr */ - struct lst_list *node_free_list_head; /* Free list of memory nodes */ + struct list_head node_free_list;/* Free list of memory nodes */ u32 ul_min_block_size; /* Min SM block; default 16 bytes */ u32 dw_page_size; /* Memory Page size (1k/4k) */ /* GPP SM segment ptrs */ @@ -215,8 +215,7 @@ void *cmm_calloc_buf(struct cmm_object *hcmm_mgr, u32 usize, pnode-client_proc = current-tgid; /* put our node on InUse list */ - lst_put_tail(allocator-in_use_list_head, -(struct list_head *)pnode); + list_add_tail(pnode-link, allocator-in_use_list); buf_pa = (void *)pnode-dw_pa; /* physical address */ /* clear mem */ pbyte = (u8 *) pnode-dw_va; @@ -265,18 +264,9 @@ int cmm_create(struct cmm_object **ph_cmm_mgr, * MEM_ALLOC_OBJECT */ /* create node free list */ - cmm_obj-node_free_list_head = - kzalloc(sizeof(struct lst_list), - GFP_KERNEL); - if (cmm_obj-node_free_list_head == NULL) { - status = -ENOMEM; - cmm_destroy(cmm_obj, true); - } else { - INIT_LIST_HEAD(cmm_obj- - node_free_list_head-head); - mutex_init(cmm_obj-cmm_lock); - *ph_cmm_mgr = cmm_obj; - } + INIT_LIST_HEAD(cmm_obj-node_free_list); + mutex_init(cmm_obj-cmm_lock); + *ph_cmm_mgr = cmm_obj; } else { status = -ENOMEM; } @@ -294,7 +284,7 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force) struct cmm_info temp_info; int status = 0; s32 slot_seg; - struct cmm_mnode *pnode; + struct cmm_mnode *node, *tmp; DBC_REQUIRE(refs 0); if (!hcmm_mgr) { @@ -324,15 +314,10 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force) } } } - if (cmm_mgr_obj-node_free_list_head != NULL) { - /* Free the free nodes */ - while (!LST_IS_EMPTY(cmm_mgr_obj-node_free_list_head)) { - pnode = (struct cmm_mnode *) - lst_get_head(cmm_mgr_obj-node_free_list_head); - kfree(pnode); - } - /* delete NodeFreeList list */ - kfree(cmm_mgr_obj-node_free_list_head); + list_for_each_entry_safe(node, tmp, cmm_mgr_obj-node_free_list, + link) { + list_del(node-link); + kfree(node); } mutex_unlock(cmm_mgr_obj-cmm_lock); if (!status) { @@ -366,7 +351,7 @@ int
[PATCH v3 08/12] staging: tidspbridge: convert rmgr to list_head
Convert the rmgr module of the tidspbridge driver to use struct list_head instead of struct lst_list. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/rmgr/drv.c | 115 -- drivers/staging/tidspbridge/rmgr/node.c | 53 -- drivers/staging/tidspbridge/rmgr/proc.c |2 - drivers/staging/tidspbridge/rmgr/rmm.c | 75 +++- 4 files changed, 72 insertions(+), 173 deletions(-) diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c index 81b1b90..2ca3a23 100644 --- a/drivers/staging/tidspbridge/rmgr/drv.c +++ b/drivers/staging/tidspbridge/rmgr/drv.c @@ -16,6 +16,7 @@ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #include linux/types.h +#include linux/list.h /* --- Host OS */ #include dspbridge/host_os.h @@ -26,9 +27,6 @@ /* --- Trace Debug */ #include dspbridge/dbc.h -/* --- OS Adaptation Layer */ -#include dspbridge/list.h - /* --- This */ #include dspbridge/drv.h #include dspbridge/dev.h @@ -42,8 +40,8 @@ /* --- Defines, Data Structures, Typedefs */ struct drv_object { - struct lst_list *dev_list; - struct lst_list *dev_node_string; + struct list_head dev_list; + struct list_head dev_node_string; }; /* @@ -316,22 +314,8 @@ int drv_create(struct drv_object **drv_obj) pdrv_object = kzalloc(sizeof(struct drv_object), GFP_KERNEL); if (pdrv_object) { /* Create and Initialize List of device objects */ - pdrv_object-dev_list = kzalloc(sizeof(struct lst_list), - GFP_KERNEL); - if (pdrv_object-dev_list) { - /* Create and Initialize List of device Extension */ - pdrv_object-dev_node_string = - kzalloc(sizeof(struct lst_list), GFP_KERNEL); - if (!(pdrv_object-dev_node_string)) { - status = -EPERM; - } else { - INIT_LIST_HEAD(pdrv_object- - dev_node_string-head); - INIT_LIST_HEAD(pdrv_object-dev_list-head); - } - } else { - status = -ENOMEM; - } + INIT_LIST_HEAD(pdrv_object-dev_list); + INIT_LIST_HEAD(pdrv_object-dev_node_string); } else { status = -ENOMEM; } @@ -348,8 +332,6 @@ int drv_create(struct drv_object **drv_obj) if (!status) { *drv_obj = pdrv_object; } else { - kfree(pdrv_object-dev_list); - kfree(pdrv_object-dev_node_string); /* Free the DRV Object */ kfree(pdrv_object); } @@ -386,13 +368,6 @@ int drv_destroy(struct drv_object *driver_obj) DBC_REQUIRE(refs 0); DBC_REQUIRE(pdrv_object); - /* -* Delete the List if it exists.Should not come here -* as the drv_remove_dev_object and the Last drv_request_resources -* removes the list if the lists are empty. -*/ - kfree(pdrv_object-dev_list); - kfree(pdrv_object-dev_node_string); kfree(pdrv_object); /* Update the DRV Object in the driver data */ if (drv_datap) { @@ -424,7 +399,7 @@ int drv_get_dev_object(u32 index, struct drv_object *hdrv_obj, DBC_REQUIRE(device_obj != NULL); DBC_REQUIRE(index = 0); DBC_REQUIRE(refs 0); - DBC_ASSERT(!(LST_IS_EMPTY(pdrv_obj-dev_list))); + DBC_ASSERT(!(list_empty(pdrv_obj-dev_list))); dev_obj = (struct dev_object *)drv_get_first_dev_object(); for (i = 0; i index; i++) { @@ -455,9 +430,8 @@ u32 drv_get_first_dev_object(void) if (drv_datap drv_datap-drv_object) { pdrv_obj = drv_datap-drv_object; - if ((pdrv_obj-dev_list != NULL) - !LST_IS_EMPTY(pdrv_obj-dev_list)) - dw_dev_object = (u32) lst_first(pdrv_obj-dev_list); + if (!list_empty(pdrv_obj-dev_list)) + dw_dev_object = (u32) pdrv_obj-dev_list.next; } else { pr_err(%s: Failed to retrieve the object handle\n, __func__); } @@ -479,10 +453,9 @@ u32 drv_get_first_dev_extension(void) if (drv_datap drv_datap-drv_object) { pdrv_obj = drv_datap-drv_object; - if ((pdrv_obj-dev_node_string != NULL) - !LST_IS_EMPTY(pdrv_obj-dev_node_string)) { + if (!list_empty(pdrv_obj-dev_node_string)) { dw_dev_extension = - (u32)
[PATCH v3 09/12] staging: tidspbridge: remove custom linked list
Now that all users of lst_list have been converted to the standard linux list_head API, we can remove the associated header file. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/TODO |1 - .../staging/tidspbridge/include/dspbridge/list.h | 225 2 files changed, 0 insertions(+), 226 deletions(-) delete mode 100644 drivers/staging/tidspbridge/include/dspbridge/list.h diff --git a/drivers/staging/tidspbridge/TODO b/drivers/staging/tidspbridge/TODO index 187363f..1c51e2d 100644 --- a/drivers/staging/tidspbridge/TODO +++ b/drivers/staging/tidspbridge/TODO @@ -6,7 +6,6 @@ * Eliminate general services and libraries - use or extend existing kernel libraries instead (e.g. gcf/lcm in nldr.c, global helpers in gen/) * Eliminate direct manipulation of OMAP_SYSC_BASE -* Eliminate list.h : seem like a redundant wrapper to existing kernel lists * Eliminate DSP_SUCCEEDED macros and their imposed redundant indentations (adopt the kernel way of checking for return values) * Audit interfaces exposed to user space diff --git a/drivers/staging/tidspbridge/include/dspbridge/list.h b/drivers/staging/tidspbridge/include/dspbridge/list.h deleted file mode 100644 index 6837b61..000 --- a/drivers/staging/tidspbridge/include/dspbridge/list.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * list.h - * - * DSP-BIOS Bridge driver support functions for TI OMAP processors. - * - * Declarations of list management control structures and definitions - * of inline list management functions. - * - * Copyright (C) 2008 Texas Instruments, Inc. - * - * This package is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifndef LIST_ -#define LIST_ - -#include dspbridge/host_os.h -#include linux/list.h - -#define LST_IS_EMPTY(l) list_empty((l)-head) - -struct lst_list { - struct list_head head; -}; - -/* - * lst_first - * Purpose: - * Returns a pointer to the first element of the list, or NULL if the list - * is empty. - * Parameters: - * lst: Pointer to list control structure. - * Returns: - * Pointer to first list element, or NULL. - * Requires: - * - LST initialized. - * - lst != NULL. - * Ensures: - */ -static inline struct list_head *lst_first(struct lst_list *lst) -{ - if (lst !list_empty(lst-head)) - return lst-head.next; - return NULL; -} - -/* - * lst_get_head - * Purpose: - * Pops the head off the list and returns a pointer to it. - * Details: - * If the list is empty, returns NULL. - * Else, removes the element at the head of the list, making the next - * element the head of the list. - * The head is removed by making the tail element of the list point its - * next pointer at the next element after the head, and by making the - * prev pointer of the next element after the head point at the tail - * element. So the next element after the head becomes the new head of - * the list. - * Parameters: - * lst:Pointer to list control structure of list whose head - * element is to be removed - * Returns: - * Pointer to element that was at the head of the list (success) - * NULL No elements in list - * Requires: - * - LST initialized. - * - lst != NULL. - * Ensures: - * Notes: - * Because the tail of the list points forward (its next pointer) to - * the head of the list, and the head of the list points backward (its - * prev pointer) to the tail of the list, this list is circular. - */ -static inline struct list_head *lst_get_head(struct lst_list *lst) -{ - struct list_head *elem_list; - - if (!lst || list_empty(lst-head)) - return NULL; - - elem_list = lst-head.next; - lst-head.next = elem_list-next; - elem_list-next-prev = lst-head; - - return elem_list; -} - -/* - * lst_init_elem - * Purpose: - * Initializes a list element to default (cleared) values - * Details: - * Parameters: - * elem_list: Pointer to list element to be reset - * Returns: - * Requires: - * LST initialized. - * Ensures: - * Notes: - * This function must not be called to reset an element in the middle - * of a list chain -- that would break the chain. - * - */ -static inline void lst_init_elem(struct list_head *elem_list) -{ - if (elem_list) { - elem_list-next = NULL; - elem_list-prev = NULL; - } -} - -/* - * lst_insert_before - * Purpose: - * Insert the element before
[PATCH v3 10/12] staging: tidspbridge: core code cleanup
Reorganized some code in the core module to increase its readability. Most of the changes reduce the code indentation level and simplifiy the code. No functional changes were done. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/core/chnl_sm.c | 449 +--- drivers/staging/tidspbridge/core/io_sm.c | 192 ++--- drivers/staging/tidspbridge/core/msg_sm.c | 447 --- 3 files changed, 496 insertions(+), 592 deletions(-) diff --git a/drivers/staging/tidspbridge/core/chnl_sm.c b/drivers/staging/tidspbridge/core/chnl_sm.c index ca19ede..bfa8999 100644 --- a/drivers/staging/tidspbridge/core/chnl_sm.c +++ b/drivers/staging/tidspbridge/core/chnl_sm.c @@ -105,35 +105,31 @@ int bridge_chnl_add_io_req(struct chnl_object *chnl_obj, void *host_buf, is_eos = (byte_size == 0); /* Validate args */ - if (!host_buf || !pchnl) { - status = -EFAULT; - } else if (is_eos CHNL_IS_INPUT(pchnl-chnl_mode)) { - status = -EPERM; - } else { - /* -* Check the channel state: only queue chirp if channel state -* allows it. -*/ - dw_state = pchnl-dw_state; - if (dw_state != CHNL_STATEREADY) { - if (dw_state CHNL_STATECANCEL) - status = -ECANCELED; - else if ((dw_state CHNL_STATEEOS) -CHNL_IS_OUTPUT(pchnl-chnl_mode)) - status = -EPIPE; - else - /* No other possible states left */ - DBC_ASSERT(0); - } + if (!host_buf || !pchnl) + return -EFAULT; + + if (is_eos CHNL_IS_INPUT(pchnl-chnl_mode)) + return -EPERM; + + /* +* Check the channel state: only queue chirp if channel state +* allows it. +*/ + dw_state = pchnl-dw_state; + if (dw_state != CHNL_STATEREADY) { + if (dw_state CHNL_STATECANCEL) + return -ECANCELED; + if ((dw_state CHNL_STATEEOS) + CHNL_IS_OUTPUT(pchnl-chnl_mode)) + return -EPIPE; + /* No other possible states left */ + DBC_ASSERT(0); } dev_obj = dev_get_first(); dev_get_bridge_context(dev_obj, dev_ctxt); if (!dev_ctxt) - status = -EFAULT; - - if (status) - goto func_end; + return -EFAULT; if (pchnl-chnl_type == CHNL_PCPY pchnl-chnl_id 1 host_buf) { if (!(host_buf (void *)USERMODE_ADDR)) { @@ -142,18 +138,16 @@ int bridge_chnl_add_io_req(struct chnl_object *chnl_obj, void *host_buf, } /* if addr in user mode, then copy to kernel space */ host_sys_buf = kmalloc(buf_size, GFP_KERNEL); - if (host_sys_buf == NULL) { - status = -ENOMEM; - goto func_end; - } + if (host_sys_buf == NULL) + return -ENOMEM; + if (CHNL_IS_OUTPUT(pchnl-chnl_mode)) { status = copy_from_user(host_sys_buf, host_buf, - buf_size); + buf_size); if (status) { kfree(host_sys_buf); host_sys_buf = NULL; - status = -EFAULT; - goto func_end; + return -EFAULT; } } } @@ -167,66 +161,62 @@ func_cont: omap_mbox_disable_irq(dev_ctxt-mbox, IRQ_RX); if (pchnl-chnl_type == CHNL_PCPY) { /* This is a processor-copy channel. */ - if (!status CHNL_IS_OUTPUT(pchnl-chnl_mode)) { + if (CHNL_IS_OUTPUT(pchnl-chnl_mode)) { /* Check buffer size on output channels for fit. */ - if (byte_size - io_buf_size(pchnl-chnl_mgr_obj-hio_mgr)) + if (byte_size io_buf_size( + pchnl-chnl_mgr_obj-hio_mgr)) { status = -EINVAL; - - } - } - if (!status) { - /* Get a free chirp: */ - if (!list_empty(pchnl-free_packets_list)) { - chnl_packet_obj = list_first_entry( - pchnl-free_packets_list, - struct chnl_irp, link); - list_del(chnl_packet_obj-link); - } else { - status = -EIO;
[PATCH v3 11/12] staging: tidspbridge: pmgr code cleanup
Reorganized some code in the pmgr module to increase its readability. No functional changes were done. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/pmgr/cmm.c | 357 ++- drivers/staging/tidspbridge/pmgr/dev.c | 20 +-- 2 files changed, 167 insertions(+), 210 deletions(-) diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c index d7ca2a4..d4f55ec 100644 --- a/drivers/staging/tidspbridge/pmgr/cmm.c +++ b/drivers/staging/tidspbridge/pmgr/cmm.c @@ -250,26 +250,23 @@ int cmm_create(struct cmm_object **ph_cmm_mgr, *ph_cmm_mgr = NULL; /* create, zero, and tag a cmm mgr object */ cmm_obj = kzalloc(sizeof(struct cmm_object), GFP_KERNEL); - if (cmm_obj != NULL) { - if (mgr_attrts == NULL) - mgr_attrts = cmm_dfltmgrattrs; /* set defaults */ - - /* 4 bytes minimum */ - DBC_ASSERT(mgr_attrts-ul_min_block_size = 4); - /* save away smallest block allocation for this cmm mgr */ - cmm_obj-ul_min_block_size = mgr_attrts-ul_min_block_size; - cmm_obj-dw_page_size = PAGE_SIZE; - - /* Note: DSP SM seg table(aDSPSMSegTab[]) zero'd by -* MEM_ALLOC_OBJECT */ - - /* create node free list */ - INIT_LIST_HEAD(cmm_obj-node_free_list); - mutex_init(cmm_obj-cmm_lock); - *ph_cmm_mgr = cmm_obj; - } else { - status = -ENOMEM; - } + if (!cmm_obj) + return -ENOMEM; + + if (mgr_attrts == NULL) + mgr_attrts = cmm_dfltmgrattrs; /* set defaults */ + + /* 4 bytes minimum */ + DBC_ASSERT(mgr_attrts-ul_min_block_size = 4); + /* save away smallest block allocation for this cmm mgr */ + cmm_obj-ul_min_block_size = mgr_attrts-ul_min_block_size; + cmm_obj-dw_page_size = PAGE_SIZE; + + /* create node free list */ + INIT_LIST_HEAD(cmm_obj-node_free_list); + mutex_init(cmm_obj-cmm_lock); + *ph_cmm_mgr = cmm_obj; + return status; } @@ -346,13 +343,12 @@ void cmm_exit(void) * Purpose: * Free the given buffer. */ -int cmm_free_buf(struct cmm_object *hcmm_mgr, void *buf_pa, - u32 ul_seg_id) +int cmm_free_buf(struct cmm_object *hcmm_mgr, void *buf_pa, u32 ul_seg_id) { struct cmm_object *cmm_mgr_obj = (struct cmm_object *)hcmm_mgr; int status = -EFAULT; struct cmm_mnode *curr, *tmp; - struct cmm_allocator *allocator = NULL; + struct cmm_allocator *allocator; struct cmm_attrs *pattrs; DBC_REQUIRE(refs 0); @@ -366,21 +362,22 @@ int cmm_free_buf(struct cmm_object *hcmm_mgr, void *buf_pa, status = -EFAULT; return status; } - /* get the allocator for this segment id */ + allocator = get_allocator(cmm_mgr_obj, ul_seg_id); - if (allocator != NULL) { - mutex_lock(cmm_mgr_obj-cmm_lock); - list_for_each_entry_safe(curr, tmp, allocator-in_use_list, - link) { - if (curr-dw_pa == (u32) buf_pa) { - list_del(curr-link); - add_to_free_list(allocator, curr); - status = 0; - break; - } + if (!allocator) + return status; + + mutex_lock(cmm_mgr_obj-cmm_lock); + list_for_each_entry_safe(curr, tmp, allocator-in_use_list, link) { + if (curr-dw_pa == (u32) buf_pa) { + list_del(curr-link); + add_to_free_list(allocator, curr); + status = 0; + break; } - mutex_unlock(cmm_mgr_obj-cmm_lock); } + mutex_unlock(cmm_mgr_obj-cmm_lock); + return status; } @@ -438,31 +435,30 @@ int cmm_get_info(struct cmm_object *hcmm_mgr, for (ul_seg = 1; ul_seg = CMM_MAXGPPSEGS; ul_seg++) { /* get the allocator object for this segment id */ altr = get_allocator(cmm_mgr_obj, ul_seg); - if (altr != NULL) { - cmm_info_obj-ul_num_gppsm_segs++; - cmm_info_obj-seg_info[ul_seg - 1].dw_seg_base_pa = - altr-shm_base - altr-ul_dsp_size; - cmm_info_obj-seg_info[ul_seg - 1].ul_total_seg_size = - altr-ul_dsp_size + altr-ul_sm_size; - cmm_info_obj-seg_info[ul_seg - 1].dw_gpp_base_pa = - altr-shm_base; - cmm_info_obj-seg_info[ul_seg - 1].ul_gpp_size = - altr-ul_sm_size; - cmm_info_obj-seg_info[ul_seg - 1].dw_dsp_base_va = -
[PATCH v3 12/12] staging: tidspbridge: rmgr code cleanup
Reorganized some code in the rmgr module to increase its readability. No functional changes were done. Signed-off-by: Ionut Nicu ionut.n...@mindbit.ro --- drivers/staging/tidspbridge/rmgr/drv.c | 171 +--- drivers/staging/tidspbridge/rmgr/node.c | 81 +- drivers/staging/tidspbridge/rmgr/rmm.c | 266 +- 3 files changed, 229 insertions(+), 289 deletions(-) diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c index 2ca3a23..6e9fc2e 100644 --- a/drivers/staging/tidspbridge/rmgr/drv.c +++ b/drivers/staging/tidspbridge/rmgr/drv.c @@ -304,40 +304,28 @@ int drv_proc_update_strm_res(u32 num_bufs, void *strm_resources) */ int drv_create(struct drv_object **drv_obj) { - int status = 0; struct drv_object *pdrv_object = NULL; struct drv_data *drv_datap = dev_get_drvdata(bridge); DBC_REQUIRE(drv_obj != NULL); DBC_REQUIRE(refs 0); + if (!drv_datap) + return -EFAULT; + pdrv_object = kzalloc(sizeof(struct drv_object), GFP_KERNEL); - if (pdrv_object) { - /* Create and Initialize List of device objects */ - INIT_LIST_HEAD(pdrv_object-dev_list); - INIT_LIST_HEAD(pdrv_object-dev_node_string); - } else { - status = -ENOMEM; - } - /* Store the DRV Object in the driver data */ - if (!status) { - if (drv_datap) { - drv_datap-drv_object = (void *)pdrv_object; - } else { - status = -EPERM; - pr_err(%s: Failed to store DRV object\n, __func__); - } - } + if (!pdrv_object) + return -ENOMEM; - if (!status) { - *drv_obj = pdrv_object; - } else { - /* Free the DRV Object */ - kfree(pdrv_object); - } + /* Create and Initialize List of device objects */ + INIT_LIST_HEAD(pdrv_object-dev_list); + INIT_LIST_HEAD(pdrv_object-dev_node_string); - DBC_ENSURE(status || pdrv_object); - return status; + /* Store the DRV Object in the driver data */ + drv_datap-drv_object = (void *)pdrv_object; + *drv_obj = pdrv_object; + + return 0; } /* @@ -424,19 +412,19 @@ int drv_get_dev_object(u32 index, struct drv_object *hdrv_obj, */ u32 drv_get_first_dev_object(void) { - u32 dw_dev_object = 0; struct drv_object *pdrv_obj; struct drv_data *drv_datap = dev_get_drvdata(bridge); - if (drv_datap drv_datap-drv_object) { - pdrv_obj = drv_datap-drv_object; - if (!list_empty(pdrv_obj-dev_list)) - dw_dev_object = (u32) pdrv_obj-dev_list.next; - } else { + if (!drv_datap || !drv_datap-drv_object) { pr_err(%s: Failed to retrieve the object handle\n, __func__); + return 0; } - return dw_dev_object; + pdrv_obj = drv_datap-drv_object; + if (list_empty(pdrv_obj-dev_list)) + return 0; + + return (u32) pdrv_obj-dev_list.next; } /* @@ -447,21 +435,19 @@ u32 drv_get_first_dev_object(void) */ u32 drv_get_first_dev_extension(void) { - u32 dw_dev_extension = 0; struct drv_object *pdrv_obj; struct drv_data *drv_datap = dev_get_drvdata(bridge); - if (drv_datap drv_datap-drv_object) { - pdrv_obj = drv_datap-drv_object; - if (!list_empty(pdrv_obj-dev_node_string)) { - dw_dev_extension = - (u32) pdrv_obj-dev_node_string.next; - } - } else { + if (!drv_datap || !drv_datap-drv_object) { pr_err(%s: Failed to retrieve the object handle\n, __func__); + return 0; } - return dw_dev_extension; + pdrv_obj = drv_datap-drv_object; + if (list_empty(pdrv_obj-dev_node_string)) + return 0; + + return (u32) pdrv_obj-dev_node_string.next; } /* @@ -473,24 +459,25 @@ u32 drv_get_first_dev_extension(void) */ u32 drv_get_next_dev_object(u32 hdev_obj) { - u32 dw_next_dev_object = 0; struct drv_object *pdrv_obj; struct drv_data *drv_datap = dev_get_drvdata(bridge); struct list_head *curr; - if (drv_datap drv_datap-drv_object) { - pdrv_obj = drv_datap-drv_object; - if (!list_empty(pdrv_obj-dev_list)) { - curr = (struct list_head *)hdev_obj; - if (list_is_last(curr, pdrv_obj-dev_list)) - return 0; - dw_next_dev_object = (u32) curr-next; - } - } else { + if (!drv_datap || !drv_datap-drv_object) { pr_err(%s: Failed to retrieve the object handle\n, __func__); + return 0; } -
Re: [PATCH 1/1] serial: omap-serial: Add support for kernel debugger
Hi Cosmin, On Sat, 2010-11-20 at 21:51 +0100, Cosmin Cojocar wrote: The kgdb invokes the poll_put_char and poll_get_char when communicating with the host. This patch also changes the initialization order because the kgdb will check at the very beginning, if there is a valid serial driver. Signed-off-by: Cosmin Cojocar cosmin.cojo...@gmail.com --- drivers/serial/Makefile |2 +- drivers/serial/omap-serial.c | 38 -- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index c570576..ad86113 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -80,6 +80,7 @@ obj-$(CONFIG_SERIAL_NETX) += netx-serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o +obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o obj-$(CONFIG_SERIAL_QE) += ucc_uart.o obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o @@ -88,4 +89,3 @@ obj-$(CONFIG_SERIAL_ALTERA_JTAGUART) += altera_jtaguart.o obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o obj-$(CONFIG_SERIAL_MRST_MAX3110)+= mrst_max3110.o obj-$(CONFIG_SERIAL_MFD_HSU) += mfd.o -obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c index 03a96db..df6ba03 100644 --- a/drivers/serial/omap-serial.c +++ b/drivers/serial/omap-serial.c @@ -866,14 +866,44 @@ serial_omap_type(struct uart_port *port) return up-name; } +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) + +#ifdef CONFIG_CONSOLE_POLL +static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch) +{ + struct uart_omap_port *up = (struct uart_omap_port *)port; + unsigned int status; + + do { + status = serial_in(up, UART_LSR); + udelay(1); + } while ((status BOTH_EMPTY) != BOTH_EMPTY); + Shouldn't you use wait_for_xmitr() instead? If you do that, then you don't need to move the BOTH_EMPTY macro anymore. + serial_out(up, UART_TX, ch); +} + +static int serial_omap_poll_get_char(struct uart_port *port) +{ + struct uart_omap_port *up = (struct uart_omap_port *)port; + unsigned int status; + int ch; + + do { + status = serial_in(up, UART_LSR); + udelay(1); + } while ((status UART_LSR_DR) != UART_LSR_DR); + I think you should be returning NO_POLL_CHAR if the condition is false, instead of busy looping. + ch = (int)serial_in(up, UART_RX); + return ch; +} I don't think you need the extra ch variable. Just return serial_in(up, UART_RX). Cheers, Ionut. -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
newbie: can I ask a question about linux-omap-pm on this mailing list?
Hi. I want to ask a newbie questions regarding linux-omap-pm repositories(http://git.kernel.org/?p=linux/kernel/git/khilman/linux-omap-pm.git;a=summary). I know this mailing list is for the linux-omap repository. I have searched the web for a mailing list specific for linux-omap-pm without success. Is this the right mailing list to pose my question? If not, can you point me to a better one? Thank you, Gabi Voiculescu -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] serial: omap-serial: Add support for kernel debugger
Hi Ionut, Ionut Nicu wrote: Hi Cosmin, On Sat, 2010-11-20 at 21:51 +0100, Cosmin Cojocar wrote: The kgdb invokes the poll_put_char and poll_get_char when communicating with the host. This patch also changes the initialization order because the kgdb will check at the very beginning, if there is a valid serial driver. Signed-off-by: Cosmin Cojocar cosmin.cojo...@gmail.com --- drivers/serial/Makefile |2 +- drivers/serial/omap-serial.c | 38 -- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index c570576..ad86113 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -80,6 +80,7 @@ obj-$(CONFIG_SERIAL_NETX) += netx-serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o +obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o obj-$(CONFIG_SERIAL_QE) += ucc_uart.o obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o @@ -88,4 +89,3 @@ obj-$(CONFIG_SERIAL_ALTERA_JTAGUART) += altera_jtaguart.o obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o obj-$(CONFIG_SERIAL_MRST_MAX3110) += mrst_max3110.o obj-$(CONFIG_SERIAL_MFD_HSU)+= mfd.o -obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c index 03a96db..df6ba03 100644 --- a/drivers/serial/omap-serial.c +++ b/drivers/serial/omap-serial.c @@ -866,14 +866,44 @@ serial_omap_type(struct uart_port *port) return up-name; } +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) + +#ifdef CONFIG_CONSOLE_POLL +static void serial_omap_poll_put_char(struct uart_port *port, unsigned char ch) +{ +struct uart_omap_port *up = (struct uart_omap_port *)port; +unsigned int status; + +do { +status = serial_in(up, UART_LSR); +udelay(1); +} while ((status BOTH_EMPTY) != BOTH_EMPTY); + Shouldn't you use wait_for_xmitr() instead? If you do that, then you don't need to move the BOTH_EMPTY macro anymore. Initially, I had used the wait_for_xmitr, but the gdb couldn't establish a connection. I will retest it. +serial_out(up, UART_TX, ch); +} + +static int serial_omap_poll_get_char(struct uart_port *port) +{ +struct uart_omap_port *up = (struct uart_omap_port *)port; +unsigned int status; +int ch; + +do { +status = serial_in(up, UART_LSR); +udelay(1); +} while ((status UART_LSR_DR) != UART_LSR_DR); + I think you should be returning NO_POLL_CHAR if the condition is false, instead of busy looping. +ch = (int)serial_in(up, UART_RX); +return ch; +} I don't think you need the extra ch variable. Just return serial_in(up, UART_RX). Here, I agree with your comments. Cheers, Ionut. Regards, Cosmin -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 00/12] staging: tidspbridge: various cleanups
On Sun, Nov 21, 2010 at 12:46:18PM +0200, Ionut Nicu wrote: This set of patches replaces some of the redundant components of the tidspbridge driver, such as: snip As mentioned before, I need to take these from Omar as I don't trust anyone not to send me stuff that breaks the driver anymore :) So I'll wait for him to send me a pull request before applying them. thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/11] omap: clock: add clkdev aliases for EHCI clocks
Add clkdev aliases for the USBHOST and USBTLL clocks on OMAP3 and OMAP4, so that the driver can refer to the clocks using a common alias. This will disappear when the driver is converted to use the hwmod database, but until then this patch is needed. Signed-off-by: Anand Gadiyar gadi...@ti.com --- arch/arm/mach-omap2/clock3xxx_data.c |5 + arch/arm/mach-omap2/clock44xx_data.c |5 + 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index d85ecd5..a04cb03 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c @@ -3278,6 +3278,7 @@ static struct omap_clk omap3xxx_clks[] = { CLK(NULL, cpefuse_fck, cpefuse_fck, CK_3430ES2 | CK_AM35XX), CLK(NULL, ts_fck, ts_fck,CK_3430ES2 | CK_AM35XX), CLK(NULL, usbtll_fck, usbtll_fck,CK_3430ES2 | CK_AM35XX), + CLK(ehci-omap.0, usbtll_fck, usbtll_fck,CK_3430ES2 | CK_AM35XX), CLK(omap-mcbsp.1, prcm_fck, core_96m_fck, CK_3XXX), CLK(omap-mcbsp.5, prcm_fck, core_96m_fck, CK_3XXX), CLK(NULL, core_96m_fck, core_96m_fck, CK_3XXX), @@ -3313,6 +3314,7 @@ static struct omap_clk omap3xxx_clks[] = { CLK(NULL, pka_ick, pka_ick, CK_343X), CLK(NULL, core_l4_ick, core_l4_ick, CK_3XXX), CLK(NULL, usbtll_ick, usbtll_ick,CK_3430ES2 | CK_AM35XX), + CLK(ehci-omap.0, usbtll_ick, usbtll_ick,CK_3430ES2 | CK_AM35XX), CLK(mmci-omap-hs.2, ick, mmchs3_ick,CK_3430ES2 | CK_AM35XX), CLK(NULL, icr_ick, icr_ick, CK_343X), CLK(omap-aes, ick, aes2_ick, CK_343X), @@ -3358,8 +3360,11 @@ static struct omap_clk omap3xxx_clks[] = { CLK(NULL, cam_ick, cam_ick, CK_343X), CLK(NULL, csi2_96m_fck, csi2_96m_fck, CK_343X), CLK(NULL, usbhost_120m_fck, usbhost_120m_fck, CK_3430ES2 | CK_AM35XX), + CLK(ehci-omap.0, hs_fck, usbhost_120m_fck, CK_3430ES2 | CK_AM35XX), CLK(NULL, usbhost_48m_fck, usbhost_48m_fck, CK_3430ES2 | CK_AM35XX), + CLK(ehci-omap.0, fs_fck, usbhost_48m_fck, CK_3430ES2 | CK_AM35XX), CLK(NULL, usbhost_ick, usbhost_ick, CK_3430ES2 | CK_AM35XX), + CLK(ehci-omap.0, usbhost_ick, usbhost_ick, CK_3430ES2 | CK_AM35XX), CLK(NULL, usim_fck, usim_fck, CK_3430ES2), CLK(NULL, gpt1_fck, gpt1_fck, CK_3XXX), CLK(NULL, wkup_32k_fck, wkup_32k_fck, CK_3XXX), diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c index 1599836..f473e89 100644 --- a/arch/arm/mach-omap2/clock44xx_data.c +++ b/arch/arm/mach-omap2/clock44xx_data.c @@ -2937,6 +2937,7 @@ static struct omap_clk omap44xx_clks[] = { CLK(NULL, uart3_fck,uart3_fck, CK_443X), CLK(NULL, uart4_fck,uart4_fck, CK_443X), CLK(NULL, usb_host_fs_fck, usb_host_fs_fck, CK_443X), + CLK(ehci-omap.0, fs_fck, usb_host_fs_fck, CK_443X), CLK(NULL, usb_host_hs_utmi_p3_clk, usb_host_hs_utmi_p3_clk, CK_443X), CLK(NULL, usb_host_hs_hsic60m_p1_clk, usb_host_hs_hsic60m_p1_clk,CK_443X), CLK(NULL, usb_host_hs_hsic60m_p2_clk, usb_host_hs_hsic60m_p2_clk,CK_443X), @@ -2948,6 +2949,8 @@ static struct omap_clk omap44xx_clks[] = { CLK(NULL, usb_host_hs_hsic480m_p2_clk, usb_host_hs_hsic480m_p2_clk, CK_443X), CLK(NULL, usb_host_hs_func48mclk, usb_host_hs_func48mclk,CK_443X), CLK(NULL, usb_host_hs_fck, usb_host_hs_fck, CK_443X), + CLK(ehci-omap.0, hs_fck, usb_host_hs_fck, CK_443X), + CLK(ehci-omap.0, usbhost_ick, dummy_ck, CK_443X), CLK(NULL, otg_60m_gfclk,otg_60m_gfclk, CK_443X), CLK(NULL, usb_otg_hs_xclk, usb_otg_hs_xclk, CK_443X), CLK(musb_hdrc,ick, usb_otg_hs_ick,CK_443X), @@ -2956,6 +2959,8 @@ static struct omap_clk omap44xx_clks[] = { CLK(NULL, usb_tll_hs_usb_ch0_clk, usb_tll_hs_usb_ch0_clk,CK_443X), CLK(NULL, usb_tll_hs_usb_ch1_clk, usb_tll_hs_usb_ch1_clk,CK_443X), CLK(NULL, usb_tll_hs_ick, usb_tll_hs_ick, CK_443X), + CLK(ehci-omap.0, usbtll_ick, usb_tll_hs_ick, CK_443X), + CLK(ehci-omap.0, usbtll_fck, dummy_ck, CK_443X), CLK(NULL, usim_ck, usim_ck, CK_443X), CLK(NULL, usim_fclk,usim_fclk,
[PATCH 02/11] usb: ehci-omap: don't hard-code TLL channel count
From: Keshava Munegowda keshava_mgo...@ti.com Make the TLL channel count a parameter instead of a hardcoded value. This allows us to be flexible with future OMAP revisions which could have a different number of channels. Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com Signed-off-by: Anand Gadiyar gadi...@ti.com --- drivers/usb/host/ehci-omap.c |9 + 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index d042bde..d60efdc 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -191,13 +191,14 @@ struct ehci_hcd_omap { /*-*/ -static void omap_usb_utmi_init(struct ehci_hcd_omap *omap, u8 tll_channel_mask) +static void omap_usb_utmi_init(struct ehci_hcd_omap *omap, u8 tll_channel_mask, + u8 tll_channel_count) { unsigned reg; int i; /* Program the 3 TLL channels upfront */ - for (i = 0; i OMAP_TLL_CHANNEL_COUNT; i++) { + for (i = 0; i tll_channel_count; i++) { reg = ehci_omap_readl(omap-tll_base, OMAP_TLL_CHANNEL_CONF(i)); /* Disable AutoIdle, BitStuffing and use SDR Mode */ @@ -217,7 +218,7 @@ static void omap_usb_utmi_init(struct ehci_hcd_omap *omap, u8 tll_channel_mask) ehci_omap_writel(omap-tll_base, OMAP_TLL_SHARED_CONF, reg); /* Enable channels now */ - for (i = 0; i OMAP_TLL_CHANNEL_COUNT; i++) { + for (i = 0; i tll_channel_count; i++) { reg = ehci_omap_readl(omap-tll_base, OMAP_TLL_CHANNEL_CONF(i)); /* Enable only the reg that is needed */ @@ -438,7 +439,7 @@ static int omap_start_ehc(struct ehci_hcd_omap *omap, struct usb_hcd *hcd) tll_ch_mask |= OMAP_TLL_CHANNEL_3_EN_MASK; /* Enable UTMI mode for required TLL channels */ - omap_usb_utmi_init(omap, tll_ch_mask); + omap_usb_utmi_init(omap, tll_ch_mask, OMAP_TLL_CHANNEL_COUNT); } if (omap-phy_reset) { -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] omap4: 4430sdp: enable the ehci port on 4430SDP
From: Keshava Munegowda keshava_mgo...@ti.com Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com Signed-off-by: Anand Gadiyar gadi...@ti.com Cc: Tony Lindgren t...@atomide.com --- Depends on the series I just sent out for adding OMAP4 ehci support, but can be applied independently of that. arch/arm/mach-omap2/board-4430sdp.c | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index df5a425..d7cb968 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -42,6 +42,7 @@ #define ETH_KS8851_IRQ 34 #define ETH_KS8851_POWER_ON48 #define ETH_KS8851_QUART 138 +#define OMAP4SDP_MDM_PWR_EN_GPIO 157 #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 #define OMAP4_SFH7741_ENABLE_GPIO 188 @@ -225,6 +226,16 @@ static void __init omap_4430sdp_init_irq(void) omap_gpio_init(); } +static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { + .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, + .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, + .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, + .phy_reset = false, + .reset_gpio_port[0] = -EINVAL, + .reset_gpio_port[1] = -EINVAL, + .reset_gpio_port[2] = -EINVAL, +}; + static struct omap_musb_board_data musb_board_data = { .interface_type = MUSB_INTERFACE_UTMI, .mode = MUSB_PERIPHERAL, @@ -514,6 +525,15 @@ static void __init omap_4430sdp_init(void) platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); omap_serial_init(); omap4_twl6030_hsmmc_init(mmc); + + /* Power on the ULPI PHY */ + if (gpio_is_valid(OMAP4SDP_MDM_PWR_EN_GPIO)) { + /* FIXME: Assumes pad is already muxed for GPIO mode */ + gpio_request(OMAP4SDP_MDM_PWR_EN_GPIO, USBB1 PHY VMDM_3V3); + gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1); + } + usb_ehci_init(ehci_pdata); + /* OMAP4 SDP uses internal transceiver so register nop transceiver */ usb_nop_xceiv_register(); /* FIXME: allow multi-omap to boot until musb is updated for omap4 */ -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/11] usb: omap4: add platform init code for EHCI driver
- Add platform init code for EHCI on OMAP4 - Add pad configuration for PHY and TLL modes Signed-off-by: Anand Gadiyar gadi...@ti.com --- arch/arm/mach-omap2/usb-ehci.c | 144 +-- 1 files changed, 136 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c index b11bf38..25eeada 100644 --- a/arch/arm/mach-omap2/usb-ehci.c +++ b/arch/arm/mach-omap2/usb-ehci.c @@ -34,22 +34,15 @@ static struct resource ehci_resources[] = { { - .start = OMAP34XX_EHCI_BASE, - .end= OMAP34XX_EHCI_BASE + SZ_1K - 1, .flags = IORESOURCE_MEM, }, { - .start = OMAP34XX_UHH_CONFIG_BASE, - .end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1, .flags = IORESOURCE_MEM, }, { - .start = OMAP34XX_USBTLL_BASE, - .end= OMAP34XX_USBTLL_BASE + SZ_4K - 1, .flags = IORESOURCE_MEM, }, { /* general IRQ */ - .start = INT_34XX_EHCI_IRQ, .flags = IORESOURCE_IRQ, } }; @@ -214,13 +207,148 @@ static void setup_ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode) return; } +static void setup_4430ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode) +{ + switch (port_mode[0]) { + case EHCI_HCD_OMAP_MODE_PHY: + omap_mux_init_signal(usbb1_ulpiphy_stp, + OMAP_PIN_OUTPUT); + omap_mux_init_signal(usbb1_ulpiphy_clk, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dir, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_nxt, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat0, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat1, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat2, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat3, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat4, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat5, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat6, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpiphy_dat7, + OMAP_PIN_INPUT_PULLDOWN); + break; + case EHCI_HCD_OMAP_MODE_TLL: + omap_mux_init_signal(usbb1_ulpitll_stp, + OMAP_PIN_INPUT_PULLUP); + omap_mux_init_signal(usbb1_ulpitll_clk, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dir, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_nxt, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat0, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat1, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat2, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat3, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat4, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat5, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat6, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb1_ulpitll_dat7, + OMAP_PIN_INPUT_PULLDOWN); + break; + case EHCI_HCD_OMAP_MODE_UNKNOWN: + default: + break; + } + switch (port_mode[1]) { + case EHCI_HCD_OMAP_MODE_PHY: + omap_mux_init_signal(usbb2_ulpiphy_stp, + OMAP_PIN_OUTPUT); + omap_mux_init_signal(usbb2_ulpiphy_clk, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb2_ulpiphy_dir, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb2_ulpiphy_nxt, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb2_ulpiphy_dat0, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb2_ulpiphy_dat1, + OMAP_PIN_INPUT_PULLDOWN); + omap_mux_init_signal(usbb2_ulpiphy_dat2, + OMAP_PIN_INPUT_PULLDOWN); +
[PATCH 01/11] usb: ehci-omap: update clock names to be more generic
From: Keshava Munegowda keshava_mgo...@ti.com Rename usbhost2_120m_fck to usbhost_hs_fck and usbhost1_48m_fck to usbhost_fs_fck, to better reflect the clocks' functionalities. In OMAP4, the frequencies for the corresponding clocks are not necessarily the same as with OMAP3, however the functionalities are. Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com Signed-off-by: Anand Gadiyar gadi...@ti.com --- drivers/usb/host/ehci-omap.c | 44 +- 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 116ae28..d042bde 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -156,8 +156,8 @@ struct ehci_hcd_omap { struct device *dev; struct clk *usbhost_ick; - struct clk *usbhost2_120m_fck; - struct clk *usbhost1_48m_fck; + struct clk *usbhost_hs_fck; + struct clk *usbhost_fs_fck; struct clk *usbtll_fck; struct clk *usbtll_ick; @@ -286,19 +286,19 @@ static int omap_start_ehc(struct ehci_hcd_omap *omap, struct usb_hcd *hcd) } clk_enable(omap-usbhost_ick); - omap-usbhost2_120m_fck = clk_get(omap-dev, usbhost_120m_fck); - if (IS_ERR(omap-usbhost2_120m_fck)) { - ret = PTR_ERR(omap-usbhost2_120m_fck); + omap-usbhost_hs_fck = clk_get(omap-dev, usbhost_120m_fck); + if (IS_ERR(omap-usbhost_hs_fck)) { + ret = PTR_ERR(omap-usbhost_hs_fck); goto err_host_120m_fck; } - clk_enable(omap-usbhost2_120m_fck); + clk_enable(omap-usbhost_hs_fck); - omap-usbhost1_48m_fck = clk_get(omap-dev, usbhost_48m_fck); - if (IS_ERR(omap-usbhost1_48m_fck)) { - ret = PTR_ERR(omap-usbhost1_48m_fck); + omap-usbhost_fs_fck = clk_get(omap-dev, usbhost_48m_fck); + if (IS_ERR(omap-usbhost_fs_fck)) { + ret = PTR_ERR(omap-usbhost_fs_fck); goto err_host_48m_fck; } - clk_enable(omap-usbhost1_48m_fck); + clk_enable(omap-usbhost_fs_fck); if (omap-phy_reset) { /* Refer: ISSUE1 */ @@ -472,8 +472,8 @@ err_tll_ick: clk_put(omap-usbtll_fck); err_tll_fck: - clk_disable(omap-usbhost1_48m_fck); - clk_put(omap-usbhost1_48m_fck); + clk_disable(omap-usbhost_fs_fck); + clk_put(omap-usbhost_fs_fck); if (omap-phy_reset) { if (gpio_is_valid(omap-reset_gpio_port[0])) @@ -484,8 +484,8 @@ err_tll_fck: } err_host_48m_fck: - clk_disable(omap-usbhost2_120m_fck); - clk_put(omap-usbhost2_120m_fck); + clk_disable(omap-usbhost_hs_fck); + clk_put(omap-usbhost_hs_fck); err_host_120m_fck: clk_disable(omap-usbhost_ick); @@ -550,16 +550,16 @@ static void omap_stop_ehc(struct ehci_hcd_omap *omap, struct usb_hcd *hcd) omap-usbhost_ick = NULL; } - if (omap-usbhost1_48m_fck != NULL) { - clk_disable(omap-usbhost1_48m_fck); - clk_put(omap-usbhost1_48m_fck); - omap-usbhost1_48m_fck = NULL; + if (omap-usbhost_fs_fck != NULL) { + clk_disable(omap-usbhost_fs_fck); + clk_put(omap-usbhost_fs_fck); + omap-usbhost_fs_fck = NULL; } - if (omap-usbhost2_120m_fck != NULL) { - clk_disable(omap-usbhost2_120m_fck); - clk_put(omap-usbhost2_120m_fck); - omap-usbhost2_120m_fck = NULL; + if (omap-usbhost_hs_fck != NULL) { + clk_disable(omap-usbhost_hs_fck); + clk_put(omap-usbhost_hs_fck); + omap-usbhost_hs_fck = NULL; } if (omap-usbtll_ick != NULL) { -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/11] arm: omap4: select USB_ARCH_HAS_EHCI
The OMAP4 has an on-chip EHCI controller. Select USB_ARCH_HAS_EHCI to allow the EHCI driver to be built on OMAP4. Signed-off-by: Anand Gadiyar gadi...@ti.com --- arch/arm/mach-omap2/Kconfig |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index ab784bf..766727c 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -44,6 +44,7 @@ config ARCH_OMAP4 select ARM_GIC select PL310_ERRATA_588369 select ARM_ERRATA_720789 + select USB_ARCH_HAS_EHCI comment OMAP Core Type depends on ARCH_OMAP2 -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/11] usb: ehci-omap: add helpers for checking port mode
Introduce helper functions to test port mode. These checks are performed in several places in the driver, and these helpers improve readability. Signed-off-by: Anand Gadiyar gadi...@ti.com --- drivers/usb/host/ehci-omap.c | 21 - 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 7a4682c..dd9d5c1 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -127,6 +127,9 @@ #defineEHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 #defineEHCI_INSNREG05_ULPI_WRDATA_SHIFT0 +#define is_ehci_phy_mode(x)(x == EHCI_HCD_OMAP_MODE_PHY) +#define is_ehci_tll_mode(x)(x == EHCI_HCD_OMAP_MODE_TLL) + /*-*/ static inline void ehci_omap_writel(void __iomem *base, u32 reg, u32 val) @@ -387,27 +390,27 @@ static int omap_start_ehc(struct ehci_hcd_omap *omap, struct usb_hcd *hcd) /* Bypass the TLL module for PHY mode operation */ if (cpu_is_omap3430() (omap_rev() = OMAP3430_REV_ES2_1)) { dev_dbg(omap-dev, OMAP3 ES version = ES2.1\n); - if ((omap-port_mode[0] == EHCI_HCD_OMAP_MODE_PHY) || - (omap-port_mode[1] == EHCI_HCD_OMAP_MODE_PHY) || - (omap-port_mode[2] == EHCI_HCD_OMAP_MODE_PHY)) + if (is_ehci_phy_mode(omap-port_mode[0]) || + is_ehci_phy_mode(omap-port_mode[1]) || + is_ehci_phy_mode(omap-port_mode[2])) reg = ~OMAP_UHH_HOSTCONFIG_ULPI_BYPASS; else reg |= OMAP_UHH_HOSTCONFIG_ULPI_BYPASS; } else { dev_dbg(omap-dev, OMAP3 ES version ES2.1\n); - if (omap-port_mode[0] == EHCI_HCD_OMAP_MODE_PHY) + if (is_ehci_phy_mode(omap-port_mode[0])) reg = ~OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS; - else if (omap-port_mode[0] == EHCI_HCD_OMAP_MODE_TLL) + else if (is_ehci_tll_mode(omap-port_mode[0])) reg |= OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS; - if (omap-port_mode[1] == EHCI_HCD_OMAP_MODE_PHY) + if (is_ehci_phy_mode(omap-port_mode[1])) reg = ~OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS; - else if (omap-port_mode[1] == EHCI_HCD_OMAP_MODE_TLL) + else if (is_ehci_tll_mode(omap-port_mode[1])) reg |= OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS; - if (omap-port_mode[2] == EHCI_HCD_OMAP_MODE_PHY) + if (is_ehci_phy_mode(omap-port_mode[2])) reg = ~OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS; - else if (omap-port_mode[2] == EHCI_HCD_OMAP_MODE_TLL) + else if (is_ehci_tll_mode(omap-port_mode[2])) reg |= OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS; } -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/11] arm: omap4: add USBHOST and related base addresses
Add base addresses for USBHOST, USBTLL, EHCI and OHCI to the header file. This will disappear when the drivers are converted to use the hwmod database, however this patch is needed until then. Signed-off-by: Anand Gadiyar gadi...@ti.com --- arch/arm/plat-omap/include/plat/omap44xx.h |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h index 8b3f12f..ea2b8a6 100644 --- a/arch/arm/plat-omap/include/plat/omap44xx.h +++ b/arch/arm/plat-omap/include/plat/omap44xx.h @@ -52,5 +52,10 @@ #define OMAP4_MMU1_BASE0x55082000 #define OMAP4_MMU2_BASE0x4A066000 +#define OMAP44XX_USBTLL_BASE (L4_44XX_BASE + 0x62000) +#define OMAP44XX_UHH_CONFIG_BASE (L4_44XX_BASE + 0x64000) +#define OMAP44XX_HSUSB_OHCI_BASE (L4_44XX_BASE + 0x64800) +#define OMAP44XX_HSUSB_EHCI_BASE (L4_44XX_BASE + 0x64C00) + #endif /* __ASM_ARCH_OMAP44XX_H */ -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/12] usb: ehci-omap: add OMAP4 support
This series adds support for the EHCI controller on OMAP4 chips. (This enables the ethernet controller on the Pandaboard - finally!). I'm sorry for the really long delay - I know this has been in the works for a while. I've tested the series on an OMAP4 SDP and a Pandaboard. I'll be testing OMAP3 tomorrow. Dependencies: One patch depends on the mux framework patches by Benoit - which are already in linux-next; however the series compiles cleanly against current Linus' tree. What's pending: - OHCI support - Support for TLL and HSIC modes - Factoring out code common to ehci-omap and ohci-omap3 - Conversion to use omap_device and the hwmod database - Runtime PM support - Anand Anand Gadiyar (8): omap: clock: add clkdev aliases for EHCI clocks usb: ehci-omap: use clkdev aliases for functional clocks usb: ehci-omap: add helpers for checking port mode arm: omap4: add USBHOST and related base addresses usb: omap4: add platform init code for EHCI driver omap: usb: ehci: introduce HSIC mode usb: ehci-omap: Add OMAP4 support arm: omap4: select USB_ARCH_HAS_EHCI Keshava Munegowda (3): usb: ehci-omap: update clock names to be more generic usb: ehci-omap: don't hard-code TLL channel count usb: ehci: introduce CONFIG_USB_EHCI_HCD_OMAP arch/arm/mach-omap2/Kconfig|1 + arch/arm/mach-omap2/clock3xxx_data.c |5 + arch/arm/mach-omap2/clock44xx_data.c |5 + arch/arm/mach-omap2/usb-ehci.c | 144 - arch/arm/plat-omap/include/plat/omap44xx.h |5 + arch/arm/plat-omap/include/plat/usb.h |1 + drivers/usb/host/Kconfig |8 + drivers/usb/host/ehci-hcd.c|2 +- drivers/usb/host/ehci-omap.c | 314 +-- 9 files changed, 406 insertions(+), 79 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/11] usb: ehci-omap: Add OMAP4 support
Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com Signed-off-by: Anand Gadiyar gadi...@ti.com --- drivers/usb/host/ehci-omap.c | 258 ++--- 1 files changed, 214 insertions(+), 44 deletions(-) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index dd9d5c1..0374eb4 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -1,11 +1,12 @@ /* - * ehci-omap.c - driver for USBHOST on OMAP 34xx processor + * ehci-omap.c - driver for USBHOST on OMAP3/4 processors * - * Bus Glue for OMAP34xx USBHOST 3 port EHCI controller - * Tested on OMAP3430 ES2.0 SDP + * Bus Glue for the EHCI controllers in OMAP3/4 + * Tested on several OMAP3 boards, and OMAP4 Pandaboard * - * Copyright (C) 2007-2008 Texas Instruments, Inc. + * Copyright (C) 2007-2010 Texas Instruments, Inc. * Author: Vikram Pandita vikram.pand...@ti.com + * Author: Anand Gadiyar gadi...@ti.com * * Copyright (C) 2009 Nokia Corporation * Contact: Felipe Balbi felipe.ba...@nokia.com @@ -26,11 +27,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * TODO (last updated Feb 12, 2010): + * TODO (last updated Nov 21, 2010): * - add kernel-doc * - enable AUTOIDLE * - add suspend/resume * - move workarounds to board-files + * - factor out code common to OHCI + * - add HSIC and TLL support + * - convert to use hwmod and runtime PM */ #include linux/platform_device.h @@ -114,6 +118,23 @@ #define OMAP_UHH_HOSTCONFIG_P2_CONNECT_STATUS (1 9) #define OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS (1 10) +/* OMAP4-specific defines */ +#define OMAP4_UHH_SYSCONFIG_IDLEMODE_CLEAR (3 2) +#define OMAP4_UHH_SYSCONFIG_NOIDLE (1 2) + +#define OMAP4_UHH_SYSCONFIG_STDBYMODE_CLEAR(3 4) +#define OMAP4_UHH_SYSCONFIG_NOSTDBY(1 4) +#define OMAP4_UHH_SYSCONFIG_SOFTRESET (1 0) + +#define OMAP4_P1_MODE_CLEAR(3 16) +#define OMAP4_P1_MODE_TLL (1 16) +#define OMAP4_P1_MODE_HSIC (3 16) +#define OMAP4_P2_MODE_CLEAR(3 18) +#define OMAP4_P2_MODE_TLL (1 18) +#define OMAP4_P2_MODE_HSIC (3 18) + +#define OMAP_REV2_TLL_CHANNEL_COUNT2 + #defineOMAP_UHH_DEBUG_CSR (0x44) /* EHCI Register Set */ @@ -127,8 +148,16 @@ #defineEHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 #defineEHCI_INSNREG05_ULPI_WRDATA_SHIFT0 +/* Values of UHH_REVISION - Note: these are not given in the TRM */ +#define OMAP_EHCI_REV1 0x0010 /* OMAP3 */ +#define OMAP_EHCI_REV2 0x50700100 /* OMAP4 */ + +#define is_omap_ehci_rev1(x) (x-omap_ehci_rev == OMAP_EHCI_REV1) +#define is_omap_ehci_rev2(x) (x-omap_ehci_rev == OMAP_EHCI_REV2) + #define is_ehci_phy_mode(x)(x == EHCI_HCD_OMAP_MODE_PHY) #define is_ehci_tll_mode(x)(x == EHCI_HCD_OMAP_MODE_TLL) +#define is_ehci_hsic_mode(x) (x == EHCI_HCD_OMAP_MODE_HSIC) /*-*/ @@ -163,6 +192,10 @@ struct ehci_hcd_omap { struct clk *usbhost_fs_fck; struct clk *usbtll_fck; struct clk *usbtll_ick; + struct clk *xclk60mhsp1_ck; + struct clk *xclk60mhsp2_ck; + struct clk *utmi_p1_fck; + struct clk *utmi_p2_fck; /* FIXME the following two workarounds are * board specific not silicon-specific so these @@ -179,6 +212,9 @@ struct ehci_hcd_omap { /* phy reset workaround */ int phy_reset; + /* IP revision */ + u32 omap_ehci_rev; + /* desired phy_mode: TLL, PHY */ enum ehci_hcd_omap_mode port_mode[OMAP3_HS_USB_PORTS]; @@ -337,6 +373,80 @@ static int omap_start_ehc(struct ehci_hcd_omap *omap, struct usb_hcd *hcd) } clk_enable(omap-usbtll_ick); + omap-omap_ehci_rev = ehci_omap_readl(omap-uhh_base, + OMAP_UHH_REVISION); + dev_dbg(omap-dev, OMAP UHH_REVISION 0x%x\n, + omap-omap_ehci_rev); + + /* +* Enable per-port clocks as needed (newer controllers only). +* - External ULPI clock for PHY mode +* - Internal clocks for TLL and HSIC modes (TODO) +*/ + if (is_omap_ehci_rev2(omap)) { + switch (omap-port_mode[0]) { + case EHCI_HCD_OMAP_MODE_PHY: + omap-xclk60mhsp1_ck = clk_get(omap-dev, +
[PATCH 03/11] usb: ehci: introduce CONFIG_USB_EHCI_HCD_OMAP
From: Keshava Munegowda keshava_mgo...@ti.com Introduce the CONFIG_USB_EHCI_HCD_OMAP option to select EHCI support on OMAP3 and later chips. This scales better than having a long line of dependencies for each new OMAP with EHCI support. Signed-off-by: Keshava Munegowda keshava_mgo...@ti.com Signed-off-by: Anand Gadiyar gadi...@ti.com --- drivers/usb/host/Kconfig|8 drivers/usb/host/ehci-hcd.c |2 +- 2 files changed, 9 insertions(+), 1 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 2391c39..6a7c688 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -133,6 +133,14 @@ config USB_EHCI_MXC ---help--- Variation of ARC USB block used in some Freescale chips. +config USB_EHCI_HCD_OMAP + bool EHCI support for OMAP3 and later chips + depends on USB_EHCI_HCD ARCH_OMAP + default y + --- help --- + Enables support for the on-chip EHCI controller on + OMAP3 and later chips. + config USB_EHCI_HCD_PPC_OF bool EHCI support for PPC USB controller on OF platform bus depends on USB_EHCI_HCD PPC_OF diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 87157db..2f06ba4 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1171,7 +1171,7 @@ MODULE_LICENSE (GPL); #definePLATFORM_DRIVER ehci_hcd_au1xxx_driver #endif -#ifdef CONFIG_ARCH_OMAP3 +#ifdef CONFIG_USB_EHCI_HCD_OMAP #include ehci-omap.c #definePLATFORM_DRIVER ehci_hcd_omap_driver #endif -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/11] omap: usb: ehci: introduce HSIC mode
The EHCI controller in OMAP4 supports a new interface mode - HSIC. Add this to the list of modes supported on OMAP3. Signed-off-by: Anand Gadiyar gadi...@ti.com --- arch/arm/plat-omap/include/plat/usb.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h index 59c7fe7..9b1893f 100644 --- a/arch/arm/plat-omap/include/plat/usb.h +++ b/arch/arm/plat-omap/include/plat/usb.h @@ -11,6 +11,7 @@ enum ehci_hcd_omap_mode { EHCI_HCD_OMAP_MODE_UNKNOWN, EHCI_HCD_OMAP_MODE_PHY, EHCI_HCD_OMAP_MODE_TLL, + EHCI_HCD_OMAP_MODE_HSIC, }; enum ohci_omap3_port_mode { -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 5/5] OMAP: mailbox: add notification support for multiple readers
Felipe Balbi m...@felipebalbi.com wrote: Hi Hari, On Fri, 2010-11-19 at 22:01 -0600, Kanigeri, Hari wrote: Of course :), profiling was done before releasing this code and no difference observed with or without blocking notifier. All the OMAP4 would you share some numbers ? use cases are exercising this code. Just curious , are you doubting the blocking notifier mechanism ? a little bit. Yeah. It added about 600ms of time spent on musb's probe when we were using blocking notifier for charger detection. When we moved to atomic notifier, that was solved. Anyway, you can never be sure when that will be scheduled and if cpu is really busy, it might pose a great deal. -- balbi ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: No more software ECC in omap2.c NAND driver. Why?
On Friday 19 November 2010 03:33:24 Ghorai, Sukumar wrote: -Original Message- From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap- ow...@vger.kernel.org] On Behalf Of Charles Manning Sent: Thursday, November 18, 2010 6:36 AM To: linux-omap@vger.kernel.org Subject: No more software ECC in omap2.c NAND driver. Why? Between 2.6.35 and 2.6.36 there have need quite a few changes in the NAND driver, including a change from software to hardware ECC. The new code has hardware ECC forced on by: #define CONFIG_MTD_NAND_OMAP_HWECC I am surprised that this was done. Surely this should have been a Kconfig option to select either sw ECC or hw ECC? Does moving to hardware ECC to the exclusion of software ECC reduce functionality? [Ghorai] This is wrongly added by me, during last few patches. So I have send the fix as you mentioned too as. [PATCH] omap: nand: remove hardware ECC as default And please let me know still if it has any issue. Just recompiling with the CONFIG_MTD_NAND_OMAP_HWECC define commented out did not result in a working system. I suspect there is more tto the problem than this. And I am re-working on the patches for the different ecc schema including s/w, h/w or different, to pass it form board file. Does the new hwecc scheme still support sub-page writes or does it only provide full page writes? If sub-page writes are lost then this has a ripple effect in breaking the way some UBI stuff works. [Ghorai] 1. do you think this sub-page read/write support was there before, say in 2.6.35? And breaks in 2.6.36? 2.6.35 works with subpages of 512 bytes. Tested with UBIFS. 2. In that case would you please let know what are the size(s) used for sub-page/read write? AFAIK, 512 is all that is needed. There is no need for any smaller or larger. sub-page reads are not available on all flash types and sub-page writing causes extra write disturb. However, 512-byte sub-page writing is valuable. This of course needs the ECC to be partitioned and performed in chunks of 256 or 512 so that the subpages can be written individually. -- CHarles -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH ver. 2] PM: add synchronous runtime interface for interrupt handlers
On Saturday, November 20, 2010, Alan Stern wrote: On Sat, 20 Nov 2010, Rafael J. Wysocki wrote: On Friday, November 19, 2010, Alan Stern wrote: This patch (as1431b) makes the synchronous runtime-PM interface suitable for use in interrupt handlers. Subsystems can call the new pm_runtime_irq_safe() function to tell the PM core that a device's runtime-PM callbacks should be invoked with interrupts disabled (runtime_suspend and runtime_resume callbacks will be invoked with the spinlock held as well). This permits the pm_runtime_get_sync() and pm_runtime_put_sync() routines to be called from within interrupt handlers. When a device is declared irq-safe in this way, the PM core increments the parent's usage count, so the parent will never be runtime suspended. This prevents difficult situations in which an irq-safe device can't resume because it is forced to wait for its non-irq-safe parent. Signed-off-by: Alan Stern st...@rowland.harvard.edu --- usb-2.6.orig/drivers/base/power/runtime.c +++ usb-2.6/drivers/base/power/runtime.c @@ -223,11 +223,19 @@ static int rpm_idle(struct device *dev, callback = NULL; if (callback) { - spin_unlock_irq(dev-power.lock); + if (dev-power.irq_safe) { + spin_unlock(dev-power.lock); - callback(dev); + callback(dev); - spin_lock_irq(dev-power.lock); + spin_lock(dev-power.lock); + } else { + spin_unlock_irq(dev-power.lock); + + callback(dev); + + spin_lock_irq(dev-power.lock); + } } I didn't like this change before and I still don't like it. Quite frankly, I'm not sure I can convince Linus to pull it. :-) Why don't we simply execute the callback under the spinlock in the IRQ safe case? Because it wouldn't work. The job of the runtime_idle callback is to call pm_runtime_suspend when needed. But if the callback runs under the spinlock then pm_runtime_suspend would hang when it tries to grab the lock. Yes, in the _idle case. I actually should have put my comment under the change in rpm_callback(), which is what I really meant. Moreover, I'm not sure if we need an IRQ safe version of _idle. Why do we need it, exactly? I don't think Linus will object to this. Well, I guess we'll see. :-) Thanks, Rafael -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [linux-pm] [PATCH ver. 2] PM: add synchronous runtime interface for interrupt handlers
On Saturday, November 20, 2010, Alan Stern wrote: On Sat, 20 Nov 2010, Alan Stern wrote: On Sat, 20 Nov 2010, Rafael J. Wysocki wrote: On Friday, November 19, 2010, Alan Stern wrote: ... I don't think Linus will object to this. What he doesn't like is when some code drops a lock, reacquires it, and then behaves as though the lock had been held all along. That's not the case here; rpm_idle() does not depend on any state remaining unchanged across the callback. One other thing I forgot to mention... If Linus doesn't like the way the new code drops the spinlock and then reacquires it, then he must also not like the existing code, which does the same thing. The only difference lies in whether or not interrupts are re-enabled. The problem I have with this change is that switching interrupts off really is a part of the locking operation, so using spin_unlock() after spin_lock_irq...() is kind of like releasing the lock partially, which I don't think is valid (even if we're going to reacquire the lock immediately). Thanks, Rafael -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 6/14] OMAP4: dmtimer: add hwmod database
These comments are from other hwmod reviews. On Sat, Nov 20, 2010 at 08:09, Tarun Kanti DebBarma tarun.ka...@ti.com wrote: From: Cousson, Benoit b-cous...@ti.com Subject should be something like: ( See [1] ) OMAP4: hwmod data: add dmtimer Same is applicable to other hwmod DB patches for OMAP2420, OMAP2430 OMAP3 to add dmtimer data Add hwmod database for OMAP4. Signed-off-by: Cousson, Benoit b-cous...@ti.com Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 622 snip + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), +}; + +/* * 'wd_timer' class * 32-bit watchdog upward counter that generates a pulse on the reset pin on * overflow condition @@ -1068,6 +1678,18 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* mpu class */ omap44xx_mpu_hwmod, + /* timer class */ + omap44xx_timer1_hwmod, + omap44xx_timer2_hwmod, + omap44xx_timer3_hwmod, + omap44xx_timer4_hwmod, + omap44xx_timer5_hwmod, + omap44xx_timer6_hwmod, + omap44xx_timer7_hwmod, + omap44xx_timer8_hwmod, + omap44xx_timer9_hwmod, + omap44xx_timer10_hwmod, + omap44xx_timer11_hwmod, Add a blank line between each class. See [2] Same is applicable to other hwmod DB patches for OMAP2420, OMAP2430 OMAP3 to add dmtimer data [1] https://patchwork.kernel.org/patch/282472/ [2] https://patchwork.kernel.org/patch/308422/ /* wd_timer class */ omap44xx_wd_timer2_hwmod, omap44xx_wd_timer3_hwmod, -- 1.6.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: No more software ECC in omap2.c NAND driver. Why?
On 11/21/10 1:01 PM, Charles Manning wrote: Just recompiling with the CONFIG_MTD_NAND_OMAP_HWECC define commented out did not result in a working system. I suspect there is more tto the problem than this. FWIW, I had the exact same issues with my Mistral AM37x EVM board. I not only had to remove/deassert CONFIG_MTD_NAND_OMAP_HWECC, but also had to roll back nand_base.c and nand_bbt.c back to their 2.6.32 versions (later ones between .32 and .35 might have worked but I didn't bother trying) to be able to read, error-free and correctly, NAND that was erased and written with a .32-era kernel. Best, Grant Erickson -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCHv4 6/14] OMAP4: dmtimer: add hwmod database
-Original Message- From: Varadarajan, Charulatha Sent: Monday, November 22, 2010 11:32 AM To: DebBarma, Tarun Kanti Cc: linux-omap@vger.kernel.org; Cousson, Benoit Subject: Re: [PATCHv4 6/14] OMAP4: dmtimer: add hwmod database These comments are from other hwmod reviews. On Sat, Nov 20, 2010 at 08:09, Tarun Kanti DebBarma tarun.ka...@ti.com wrote: From: Cousson, Benoit b-cous...@ti.com Subject should be something like: ( See [1] ) OMAP4: hwmod data: add dmtimer Same is applicable to other hwmod DB patches for OMAP2420, OMAP2430 OMAP3 to add dmtimer data Ok. Add hwmod database for OMAP4. Signed-off-by: Cousson, Benoit b-cous...@ti.com Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com --- arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 622 snip + .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), +}; + +/* * 'wd_timer' class * 32-bit watchdog upward counter that generates a pulse on the reset pin on * overflow condition @@ -1068,6 +1678,18 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { /* mpu class */ omap44xx_mpu_hwmod, + /* timer class */ + omap44xx_timer1_hwmod, + omap44xx_timer2_hwmod, + omap44xx_timer3_hwmod, + omap44xx_timer4_hwmod, + omap44xx_timer5_hwmod, + omap44xx_timer6_hwmod, + omap44xx_timer7_hwmod, + omap44xx_timer8_hwmod, + omap44xx_timer9_hwmod, + omap44xx_timer10_hwmod, + omap44xx_timer11_hwmod, Add a blank line between each class. See [2] Same is applicable to other hwmod DB patches for OMAP2420, OMAP2430 OMAP3 to add dmtimer data Hmm... this is really funny! In fact in earlier patches I gave a blank line. This time I saw other implementations which does not have blank lines like these and thought that I should remove the blank line: /* dmm class */ omap44xx_dmm_hwmod, /* emif_fw class */ omap44xx_emif_fw_hwmod, /* l3 class */ omap44xx_l3_instr_hwmod, omap44xx_l3_main_1_hwmod, omap44xx_l3_main_2_hwmod, omap44xx_l3_main_3_hwmod, /* l4 class */ omap44xx_l4_abe_hwmod, omap44xx_l4_cfg_hwmod, omap44xx_l4_per_hwmod, omap44xx_l4_wkup_hwmod, Well, I can add blank lines with the hope that someone does not ask me to remove them again ;) -- Tarun [1] https://patchwork.kernel.org/patch/282472/ [2] https://patchwork.kernel.org/patch/308422/ /* wd_timer class */ omap44xx_wd_timer2_hwmod, omap44xx_wd_timer3_hwmod, -- 1.6.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 2/6] OMAP: powerdomain: Infrastructure to put arch specific code
Hi Thomas, -Original Message- From: Thomas Petazzoni [mailto:thomas.petazz...@free-electrons.com] Sent: Tuesday, November 16, 2010 9:41 PM To: Rajendra Nayak Cc: linux-omap@vger.kernel.org; p...@pwsan.com; b-cous...@ti.com; khil...@deeprootsystems.com Subject: Re: [PATCH 2/6] OMAP: powerdomain: Infrastructure to put arch specific code On Tue, 16 Nov 2010 21:08:02 +0530 Rajendra Nayak rna...@ti.com wrote: +struct pwrdm_functions { + int (*pwrdm_set_next_pwrst)(struct powerdomain *pwrdm, u8 pwrst); + int (*pwrdm_read_next_pwrst)(struct powerdomain *pwrdm); + int (*pwrdm_read_pwrst)(struct powerdomain *pwrdm); + int (*pwrdm_read_prev_pwrst)(struct powerdomain *pwrdm); + int (*pwrdm_set_logic_retst)(struct powerdomain *pwrdm, u8 pwrst); + int (*pwrdm_set_mem_onst)(struct powerdomain *pwrdm, u8 bank, u8 pwrst); + int (*pwrdm_set_mem_retst)(struct powerdomain *pwrdm, u8 bank, u8 pwrst); + int (*pwrdm_read_logic_pwrst)(struct powerdomain *pwrdm); + int (*pwrdm_read_prev_logic_pwrst)(struct powerdomain *pwrdm); + int (*pwrdm_read_logic_retst)(struct powerdomain *pwrdm); + int (*pwrdm_read_mem_pwrst)(struct powerdomain *pwrdm, u8 bank); + int (*pwrdm_read_prev_mem_pwrst)(struct powerdomain *pwrdm, u8 bank); + int (*pwrdm_read_mem_retst)(struct powerdomain *pwrdm, u8 bank); + int (*pwrdm_clear_all_prev_pwrst)(struct powerdomain *pwrdm); + int (*pwrdm_enable_hdwr_sar)(struct powerdomain *pwrdm); + int (*pwrdm_disable_hdwr_sar)(struct powerdomain *pwrdm); + int (*pwrdm_set_lowpwrstchange)(struct powerdomain *pwrdm); + int (*pwrdm_wait_transition)(struct powerdomain *pwrdm); +}; It would probably be great to have some short documentation on this structure, to detail what are the different operations, what they should do, etc. Sure, I can add some kerneldoc style headers to the structure to better understand what these functions should do on each OMAP. By the way, would pwrdm_operations be more linux-ish than pwrdm_functions ? I agree. I'll do this as well before I post a V2. Thanks for the review. Regards, Rajendra Thanks, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: No more software ECC in omap2.c NAND driver. Why?
-Original Message- From: Grant Erickson [mailto:maratho...@gmail.com] Sent: Monday, November 22, 2010 11:39 AM To: Charles Manning Cc: linux-omap@vger.kernel.org; Grazvydas Ignotas; Ghorai, Sukumar Subject: Re: No more software ECC in omap2.c NAND driver. Why? On 11/21/10 1:01 PM, Charles Manning wrote: Just recompiling with the CONFIG_MTD_NAND_OMAP_HWECC define commented out did not result in a working system. I suspect there is more tto the problem than this. FWIW, I had the exact same issues with my Mistral AM37x EVM board. I not only had to remove/deassert CONFIG_MTD_NAND_OMAP_HWECC, but also had to roll back nand_base.c and nand_bbt.c back to their 2.6.32 versions (later ones between .32 and .35 might have worked but I didn't bother trying) to be able to read, error-free and correctly, NAND that was erased and written with a .32-era kernel. [Ghorai] are you trying again? How do you flush the FS (form u-boot or from kernel, nandwrite)? And let me know the test you are doing, to know the steps to reproduce in my platform - zoom/sdp. Best, Grant Erickson -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 11/14] OMAP2+: dmtimer: convert to platform devices
On Sat, Nov 20, 2010 at 08:09, Tarun Kanti DebBarma tarun.ka...@ti.com wrote: From: Thara Gopinath th...@ti.com Add routines to converts dmtimers to platform devices. The device data is obtained from hwmod database of respective platform and is registered to device model after successful binding to driver. It also provides provision to access timers during early boot when pm_runtime framework is not completely up and running. Signed-off-by: Thara Gopinath th...@ti.com Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com [p-bas...@ti.com: pm_runtime logic] Where is runtime logic in this patch? The patch description says pm_runtime framework is not completely up and running Signed-off-by: Partha Basak p-bas...@ti.com --- arch/arm/mach-omap2/Makefile | 2 +- arch/arm/mach-omap2/dmtimer.c | 296 + 2 files changed, 297 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/dmtimer.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ce7b1f0..148f4d7 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -4,7 +4,7 @@ # Common support obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \ - common.o + common.o dmtimer.o omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o hwmod-common = omap_hwmod.o \ diff --git a/arch/arm/mach-omap2/dmtimer.c b/arch/arm/mach-omap2/dmtimer.c new file mode 100644 index 000..b5951b1 --- /dev/null +++ b/arch/arm/mach-omap2/dmtimer.c @@ -0,0 +1,296 @@ +/** + * OMAP2PLUS Dual-Mode Timers - platform device registration + * + * Contains first level initialization routines which extracts timers + * information from hwmod database and registers with linux device model. + * It also has low level function to chnage the timer input clock source. + * + * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ + * Tarun Kanti DebBarma tarun.ka...@ti.com + * + * Copyright (C) 2010 Texas Instruments Incorporated + * Thara Gopinath th...@ti.com Don't repeat the same copyright information twice: Copyright (C) 2010 Texas Instruments Incorporated + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed as is WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#undef DEBUG + +#include linux/clk.h +#include linux/delay.h +#include linux/io.h +#include linux/err.h +#include linux/slab.h + +#include mach/irqs.h +#include plat/dmtimer.h +#include plat/powerdomain.h +#include plat/omap_hwmod.h +#include plat/omap_device.h +#include linux/pm_runtime.h Why is linux/pm_runtime.h required in this file? I don't find any use here. Also check if plat/powerdomain.h is required. + +static int early_timer_count __initdata = 1; + +/** + * omap2_dm_timer_set_src - change the timer input clock source + * @pdev: timer platform device pointer + * @timer_clk: current clock source + * @source: array index of parent clock source + */ +static int omap2_dm_timer_set_src(struct platform_device *pdev, int source) +{ + int ret; + struct dmtimer_platform_data *pdata = pdev-dev.platform_data; + struct clk *fclk = clk_get(pdev-dev, fck); + struct clk *new_fclk; + char *fclk_name = 32k_ck; /* default name */ + + switch(source) { + case OMAP_TIMER_SRC_SYS_CLK: + fclk_name = sys_ck; + break; + + case OMAP_TIMER_SRC_32_KHZ: + fclk_name = 32k_ck; + break; + + case OMAP_TIMER_SRC_EXT_CLK: + if (pdata-timer_ip_type == OMAP_TIMER_IP_VERSION_1) { + fclk_name = alt_ck; + break; + } + dev_dbg(pdev-dev, %s:%d: invalid clk src.\n, + __func__, __LINE__); + return -EINVAL; + } + + + if (IS_ERR_OR_NULL(fclk)) { + dev_dbg(pdev-dev, %s:%d: clk_get() FAILED\n, + __func__, __LINE__); + return -EINVAL; + } + + new_fclk = clk_get(pdev-dev, fclk_name); + if (IS_ERR_OR_NULL(new_fclk)) { + dev_dbg(pdev-dev, %s:%d: clk_get() %s FAILED\n, + __func__, __LINE__, fclk_name); + clk_put(fclk); + return -EINVAL; + } + + ret = clk_set_parent(fclk, new_fclk); + if (IS_ERR_VALUE(ret)) { + dev_dbg(pdev-dev, %s:clk_set_parent() to %s FAILED\n, +
Re: No more software ECC in omap2.c NAND driver. Why?
On 11/21/10 10:27 PM, Ghorai, Sukumar wrote: -Original Message- From: Grant Erickson [mailto:maratho...@gmail.com] Sent: Monday, November 22, 2010 11:39 AM To: Charles Manning Cc: linux-omap@vger.kernel.org; Grazvydas Ignotas; Ghorai, Sukumar Subject: Re: No more software ECC in omap2.c NAND driver. Why? On 11/21/10 1:01 PM, Charles Manning wrote: Just recompiling with the CONFIG_MTD_NAND_OMAP_HWECC define commented out did not result in a working system. I suspect there is more tto the problem than this. FWIW, I had the exact same issues with my Mistral AM37x EVM board. I not only had to remove/deassert CONFIG_MTD_NAND_OMAP_HWECC, but also had to roll back nand_base.c and nand_bbt.c back to their 2.6.32 versions (later ones between .32 and .35 might have worked but I didn't bother trying) to be able to read, error-free and correctly, NAND that was erased and written with a .32-era kernel. [Ghorai] are you trying again? How do you flush the FS (form u-boot or from kernel, nandwrite)? And let me know the test you are doing, to know the steps to reproduce in my platform - zoom/sdp. The board (Mistral AM37x) NAND (Micron 256 MiB) was originally bootstrapped over SD/MMC from u-boot using the following script: mmc init mw.b ${loadaddr} 0xff 0x4 nand erase 0 0x4 fatload mmc 0 ${loadaddr} mlo nandecc hw nand write.i ${loadaddr} 0 0x4 mw.b ${loadaddr} 0xff 0x18 nand erase 0x0004 0x18 nand erase 0x001c 0x18 fatload mmc 0 ${loadaddr} u-boot.bin nandecc sw nand write.i ${loadaddr} 0x0004 0x18 nand write.i ${loadaddr} 0x001c 0x18 mw.b ${loadaddr} 0xff 0x80 nand erase 0x0040 0x80 nand erase 0x03a0 0x80 fatload mmc 0 ${loadaddr} uImage nand write.i ${loadaddr} 0x0040 0x80 nand write.i ${loadaddr} 0x03a0 0x80 mw.b ${loadaddr} 0xff 0x200 nand erase 0x00c0 0x200 nand erase 0x0420 0x200 fatload mmc 0 ${loadaddr} root.jff nand write.i ${loadaddr} 0x00c0 0x200 nand write.i ${loadaddr} 0x0420 0x200 Following that, the board is updated, from Linux, using 'flash_eraseall -q' and 'nandwrite -p -q' on all partitions, except that containing MLO. Best, Grant -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 12/14] OMAP: dmtimer: switch-over to platform device driver
snip -/* - * Reads timer registers in posted and non-posted mode. The posted mode bit - * is encoded in reg. Note that in posted mode write pending bit must be - * checked. Otherwise a read of a non completed write will produce an error. +/** + * omap_dm_timer_read_reg - read timer registers in posted and non-posted mode + * @timer: timer pointer over which read operation to perform + * @reg: lowest byte holds the register offset + * + * The posted mode bit is encoded in reg. Note that in posted mode write + * pending bit must be checked. Otherwise a read of a non completed write + * will produce an error. */ static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg) { + struct dmtimer_platform_data *pdata = timer-pdev-dev.platform_data; + + if (reg = OMAP_TIMER_WAKEUP_EN_REG) + reg += pdata-func_offst; + if (timer-posted) - while (readl(timer-io_base + (OMAP_TIMER_WRITE_PEND_REG 0xff)) - (reg WPSHIFT)) + while (readl(timer-io_base + + ((OMAP_TIMER_WRITE_PEND_REG + pdata-func_offst) + 0xff)) (reg WPSHIFT)) You may add a timeout in this. cpu_relax(); return readl(timer-io_base + (reg 0xff)); } -/* - * Writes timer registers in posted and non-posted mode. The posted mode bit - * is encoded in reg. Note that in posted mode the write pending bit must be - * checked. Otherwise a write on a register which has a pending write will be - * lost. +/** + * omap_dm_timer_write_reg - write timer registers in posted and non-posted mode + * @timer: timer pointer over which write operation is to perform + * @reg: lowest byte holds the register offset + * @value: data to write into the register + * + * The posted mode bit is encoded in reg. Note that in posted mode the write + * pending bit must be checked. Otherwise a write on a register which has a + * pending write will be lost. */ static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg, u32 value) { + struct dmtimer_platform_data *pdata = timer-pdev-dev.platform_data; + + if (reg = OMAP_TIMER_WAKEUP_EN_REG) + reg += pdata-func_offst; + if (timer-posted) - while (readl(timer-io_base + (OMAP_TIMER_WRITE_PEND_REG 0xff)) - (reg WPSHIFT)) + while (readl(timer-io_base + + ((OMAP_TIMER_WRITE_PEND_REG + pdata-func_offst) + 0xff)) (reg WPSHIFT)) Ditto. cpu_relax(); writel(value, timer-io_base + (reg 0xff)); } snip -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 14/14] OMAP: dmtimer: pm_runtime support
On Sat, Nov 20, 2010 at 08:09, Tarun Kanti DebBarma tarun.ka...@ti.com wrote: Add pm_runtime support to dmtimer. Since dmtimer is used during early boot before pm_runtime is initialized completely there are provisions to enable/disable clocks directly in the code during early boot. Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com [p-bas...@ti.com: added pm_runtime logic in probe()] Signed-off-by: Partha Basak p-bas...@ti.com --- arch/arm/plat-omap/dmtimer.c | 31 +-- 1 files changed, 29 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index f9285b1..83d0b66 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -45,6 +45,7 @@ #include linux/module.h #include linux/slab.h #include mach/hardware.h +#include linux/pm_runtime.h #include plat/dmtimer.h #include mach/irqs.h #include linux/err.h @@ -345,10 +346,22 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_free); void omap_dm_timer_enable(struct omap_dm_timer *timer) { + struct dmtimer_platform_data *pdata = timer-pdev-dev.platform_data; + if (timer-enabled) return; - clk_enable(timer-fclk); + if (unlikely(pdata-is_early_init)) { + clk_enable(timer-fclk); + timer-enabled = 1; + return; + } If timer-fclk is not going to be used after pdata-is_early_init is made zero, you may do a clk_put( ) of the timer-fclk because pm_runtime_* APIs are going to be used after pdata-is_early_init is made zero. + + if (pm_runtime_get_sync(timer-pdev-dev)) { + dev_dbg(timer-pdev-dev, %s:pm_runtime_get_sync() FAILED\n, + __func__); + return; + } timer-enabled = 1; } @@ -356,10 +369,22 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_enable); void omap_dm_timer_disable(struct omap_dm_timer *timer) { + struct dmtimer_platform_data *pdata = timer-pdev-dev.platform_data; + if (!timer-enabled) return; - clk_disable(timer-fclk); + if (unlikely(pdata-is_early_init)) { + clk_disable(timer-fclk); + timer-enabled = 0; Ditto + return; + } + + if (pm_runtime_put_sync(timer-pdev-dev)) { + dev_dbg(timer-pdev-dev, %s:pm_runtime_put_sync() FAILED\n, + __func__); + return; + } timer-enabled = 0; } snip -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCHv4 14/14] OMAP: dmtimer: pm_runtime support
-Original Message- From: Varadarajan, Charulatha [mailto:ch...@ti.com] Sent: Monday, November 22, 2010 12:34 PM To: DebBarma, Tarun Kanti Cc: linux-omap@vger.kernel.org; Basak, Partha Subject: Re: [PATCHv4 14/14] OMAP: dmtimer: pm_runtime support On Sat, Nov 20, 2010 at 08:09, Tarun Kanti DebBarma tarun.ka...@ti.com wrote: Add pm_runtime support to dmtimer. Since dmtimer is used during early boot before pm_runtime is initialized completely there are provisions to enable/disable clocks directly in the code during early boot. Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com [p-bas...@ti.com: added pm_runtime logic in probe()] Signed-off-by: Partha Basak p-bas...@ti.com --- arch/arm/plat-omap/dmtimer.c | 31 +-- 1 files changed, 29 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index f9285b1..83d0b66 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -45,6 +45,7 @@ #include linux/module.h #include linux/slab.h #include mach/hardware.h +#include linux/pm_runtime.h #include plat/dmtimer.h #include mach/irqs.h #include linux/err.h @@ -345,10 +346,22 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_free); void omap_dm_timer_enable(struct omap_dm_timer *timer) { + struct dmtimer_platform_data *pdata = timer-pdev- dev.platform_data; + if (timer-enabled) return; - clk_enable(timer-fclk); + if (unlikely(pdata-is_early_init)) { + clk_enable(timer-fclk); + timer-enabled = 1; + return; + } If timer-fclk is not going to be used after pdata-is_early_init is made zero, you may do a clk_put( ) of the timer-fclk because pm_runtime_* APIs are going to be used after pdata-is_early_init is made zero. We need fclk throughout to be used by client driver for computing rate. -- Tarun + + if (pm_runtime_get_sync(timer-pdev-dev)) { + dev_dbg(timer-pdev-dev, %s:pm_runtime_get_sync() FAILED\n, + __func__); + return; + } timer-enabled = 1; } @@ -356,10 +369,22 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_enable); void omap_dm_timer_disable(struct omap_dm_timer *timer) { + struct dmtimer_platform_data *pdata = timer-pdev- dev.platform_data; + if (!timer-enabled) return; - clk_disable(timer-fclk); + if (unlikely(pdata-is_early_init)) { + clk_disable(timer-fclk); + timer-enabled = 0; Ditto + return; + } + + if (pm_runtime_put_sync(timer-pdev-dev)) { + dev_dbg(timer-pdev-dev, %s:pm_runtime_put_sync() FAILED\n, + __func__); + return; + } timer-enabled = 0; } snip -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv4 8/14] OMAP: dmtimer: platform driver
snip +static struct platform_driver omap_dmtimer_driver = { + .probe = omap_dm_timer_probe, + .remove = omap_dm_timer_remove, + .driver = { + .name = omap-timer, Comment from Benoit on omap devices name ( see [1] ): If possible, it will be better to use the omap_ prefix in order to start having some consitency in the omap devices name. [1] https://patchwork.kernel.org/patch/305082/ + }, +}; + snip -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 1/7] OMAP: DSS2: Add dss_features for omap4 and overlay manager related features
Add support for LCD2 manager through introducing a new has_feature, Initialize a dss_features struct for omap4. Signed-off-by: Archit Taneja arc...@ti.com --- drivers/video/omap2/dss/dss_features.c | 43 ++- drivers/video/omap2/dss/dss_features.h |7 - 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index 854deba..8ab54ab 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c @@ -82,6 +82,18 @@ static const enum omap_display_type omap3_dss_supported_displays[] = { OMAP_DISPLAY_TYPE_VENC, }; +static const enum omap_display_type omap4_dss_supported_displays[] = { + /* OMAP_DSS_CHANNEL_LCD */ + OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI, + + /* OMAP_DSS_CHANNEL_DIGIT */ + OMAP_DISPLAY_TYPE_VENC, + + /* OMAP_DSS_CHANNEL_LCD2 */ + OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI | + OMAP_DISPLAY_TYPE_DSI, +}; + static const enum omap_color_mode omap2_dss_supported_color_modes[] = { /* OMAP_DSS_GFX */ OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 | @@ -127,6 +139,10 @@ static struct omap_dss_features omap2_dss_features = { .reg_fields = omap2_dss_reg_fields, .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields), + .has_feature= + FEAT_LCDENABLEPOL | FEAT_LCDENABLESIGNAL | + FEAT_PCKFREEENABLE | FEAT_FUNCGATED, + .num_mgrs = 2, .num_ovls = 3, .supported_displays = omap2_dss_supported_displays, @@ -138,7 +154,10 @@ static struct omap_dss_features omap3430_dss_features = { .reg_fields = omap3_dss_reg_fields, .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields), - .has_feature= FEAT_GLOBAL_ALPHA, + .has_feature= + FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL | + FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE | + FEAT_FUNCGATED, .num_mgrs = 2, .num_ovls = 3, @@ -150,7 +169,10 @@ static struct omap_dss_features omap3630_dss_features = { .reg_fields = omap3_dss_reg_fields, .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields), - .has_feature= FEAT_GLOBAL_ALPHA | FEAT_PRE_MULT_ALPHA, + .has_feature= + FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL | + FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE | + FEAT_PRE_MULT_ALPHA | FEAT_FUNCGATED, .num_mgrs = 2, .num_ovls = 3, @@ -158,6 +180,21 @@ static struct omap_dss_features omap3630_dss_features = { .supported_color_modes = omap3_dss_supported_color_modes, }; +/* OMAP4 DSS Features */ +static struct omap_dss_features omap4_dss_features = { + .reg_fields = omap3_dss_reg_fields, + .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields), + + .has_feature= + FEAT_GLOBAL_ALPHA | FEAT_PRE_MULT_ALPHA | + FEAT_MGR_LCD2, + + .num_mgrs = 3, + .num_ovls = 3, + .supported_displays = omap4_dss_supported_displays, + .supported_color_modes = omap3_dss_supported_color_modes, +}; + /* Functions returning values related to a DSS feature */ int dss_feat_get_num_mgrs(void) { @@ -202,4 +239,6 @@ void dss_features_init(void) omap_current_dss_features = omap3630_dss_features; else if (cpu_is_omap34xx()) omap_current_dss_features = omap3430_dss_features; + else + omap_current_dss_features = omap4_dss_features; } diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h index aeb2eea..161d378 100644 --- a/drivers/video/omap2/dss/dss_features.h +++ b/drivers/video/omap2/dss/dss_features.h @@ -20,7 +20,7 @@ #ifndef __OMAP2_DSS_FEATURES_H #define __OMAP2_DSS_FEATURES_H -#define MAX_DSS_MANAGERS 2 +#define MAX_DSS_MANAGERS 3 #define MAX_DSS_OVERLAYS 3 /* DSS has feature id */ @@ -28,6 +28,11 @@ enum dss_feat_id { FEAT_GLOBAL_ALPHA = 1 0, FEAT_GLOBAL_ALPHA_VID1 = 1 1, FEAT_PRE_MULT_ALPHA = 1 2, + FEAT_LCDENABLEPOL = 1 3, + FEAT_LCDENABLESIGNAL= 1 4, + FEAT_PCKFREEENABLE = 1 5, + FEAT_FUNCGATED = 1 6, + FEAT_MGR_LCD2 = 1 7, }; /* DSS register field id */ -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 2/7] OMAP: DSS2: Represent DISPC register defines with channel as parameter
From: Sumit Semwal sumit.sem...@ti.com Introduce new enum members for LCD2 Channel and corresponding Overlay Manager. Represent some of the DISPC register defines with channel as a parameter to differentiate between LCD, DIGIT and LCD2 channels. Replace the existing reads/writes to these registers in this new way. Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Mukund Mittal mmit...@ti.com Signed-off-by: Samreen samr...@ti.com Signed-off-by: Archit Taneja arc...@ti.com --- arch/arm/plat-omap/include/plat/display.h |2 + drivers/video/omap2/dss/dispc.c | 170 ++--- 2 files changed, 84 insertions(+), 88 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h index d433baf..586944d 100644 --- a/arch/arm/plat-omap/include/plat/display.h +++ b/arch/arm/plat-omap/include/plat/display.h @@ -64,6 +64,7 @@ enum omap_plane { enum omap_channel { OMAP_DSS_CHANNEL_LCD= 0, OMAP_DSS_CHANNEL_DIGIT = 1, + OMAP_DSS_CHANNEL_LCD2 = 2, }; enum omap_color_mode { @@ -142,6 +143,7 @@ enum omap_dss_display_state { enum omap_dss_overlay_managers { OMAP_DSS_OVL_MGR_LCD, OMAP_DSS_OVL_MGR_TV, + OMAP_DSS_OVL_MGR_LCD2, }; enum omap_dss_rotation_type { diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 54ba8d3..ca072fe 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -44,34 +44,40 @@ /* DISPC */ #define DISPC_BASE 0x48050400 -#define DISPC_SZ_REGS SZ_1K +#define DISPC_SZ_REGS SZ_4K struct dispc_reg { u16 idx; }; #define DISPC_REG(idx) ((const struct dispc_reg) { idx }) -/* DISPC common */ +/* + * DISPC common registers and + * DISPC channel registers , ch = 0 for LCD, ch = 1 for + * DIGIT, and ch = 2 for LCD2 + */ #define DISPC_REVISION DISPC_REG(0x) #define DISPC_SYSCONFIGDISPC_REG(0x0010) #define DISPC_SYSSTATUSDISPC_REG(0x0014) #define DISPC_IRQSTATUSDISPC_REG(0x0018) #define DISPC_IRQENABLEDISPC_REG(0x001C) #define DISPC_CONTROL DISPC_REG(0x0040) +#define DISPC_CONTROL2 DISPC_REG(0x0238) #define DISPC_CONFIG DISPC_REG(0x0044) +#define DISPC_CONFIG2 DISPC_REG(0x0620) #define DISPC_CAPABLE DISPC_REG(0x0048) -#define DISPC_DEFAULT_COLOR0 DISPC_REG(0x004C) -#define DISPC_DEFAULT_COLOR1 DISPC_REG(0x0050) -#define DISPC_TRANS_COLOR0 DISPC_REG(0x0054) -#define DISPC_TRANS_COLOR1 DISPC_REG(0x0058) +#define DISPC_DEFAULT_COLOR(ch)DISPC_REG(ch == 0 ? 0x004C : \ + (ch == 1 ? 0x0050 : 0x03AC)) +#define DISPC_TRANS_COLOR(ch) DISPC_REG(ch == 0 ? 0x0054 : \ + (ch == 1 ? 0x0058 : 0x03B0)) #define DISPC_LINE_STATUS DISPC_REG(0x005C) #define DISPC_LINE_NUMBER DISPC_REG(0x0060) -#define DISPC_TIMING_H DISPC_REG(0x0064) -#define DISPC_TIMING_V DISPC_REG(0x0068) -#define DISPC_POL_FREQ DISPC_REG(0x006C) -#define DISPC_DIVISOR DISPC_REG(0x0070) +#define DISPC_TIMING_H(ch) DISPC_REG(ch != 2 ? 0x0064 : 0x0400) +#define DISPC_TIMING_V(ch) DISPC_REG(ch != 2 ? 0x0068 : 0x0404) +#define DISPC_POL_FREQ(ch) DISPC_REG(ch != 2 ? 0x006C : 0x0408) +#define DISPC_DIVISOR(ch) DISPC_REG(ch != 2 ? 0x0070 : 0x040C) #define DISPC_GLOBAL_ALPHA DISPC_REG(0x0074) #define DISPC_SIZE_DIG DISPC_REG(0x0078) -#define DISPC_SIZE_LCD DISPC_REG(0x007C) +#define DISPC_SIZE_LCD(ch) DISPC_REG(ch != 2 ? 0x007C : 0x03CC) /* DISPC GFX plane */ #define DISPC_GFX_BA0 DISPC_REG(0x0080) @@ -86,13 +92,12 @@ struct dispc_reg { u16 idx; }; #define DISPC_GFX_WINDOW_SKIP DISPC_REG(0x00B4) #define DISPC_GFX_TABLE_BA DISPC_REG(0x00B8) -#define DISPC_DATA_CYCLE1 DISPC_REG(0x01D4) -#define DISPC_DATA_CYCLE2 DISPC_REG(0x01D8) -#define DISPC_DATA_CYCLE3 DISPC_REG(0x01DC) - -#define DISPC_CPR_COEF_R DISPC_REG(0x0220) -#define DISPC_CPR_COEF_G DISPC_REG(0x0224) -#define DISPC_CPR_COEF_B DISPC_REG(0x0228) +#define DISPC_DATA_CYCLE1(ch) DISPC_REG(ch != 2 ? 0x01D4 : 0x03C0) +#define DISPC_DATA_CYCLE2(ch) DISPC_REG(ch != 2 ? 0x01D8 : 0x03C4) +#define DISPC_DATA_CYCLE3(ch) DISPC_REG(ch != 2 ? 0x01DC : 0x03C8) +#define DISPC_CPR_COEF_R(ch) DISPC_REG(ch != 2 ? 0x0220 : 0x03BC) +#define DISPC_CPR_COEF_G(ch) DISPC_REG(ch != 2 ? 0x0224 : 0x03B8) +#define DISPC_CPR_COEF_B(ch)
[PATCH v5 3/7] OMAP: DSS2: Introduce omap_channel as a omap_dss_device parameter
From: Sumit Semwal sumit.sem...@ti.com A new member 'channel' is introduced in omap_dss_device structure to determine which channel the panel uses. The dss_recheck_connections() called in dss_driver_probe() to set the correct manager to the corresponding omap_dss_device. The interface drivers (dsi.c, sdi.c etc) now call dispc functions with dssdev-manager-id as a parameter to specify the DISPC channel. The following dispc functions are changed to incorporate channel as an argument: -dispc_enable_fifohandcheck() -dispc_set_lcd_size() -dispc_set_parallel_interface_mode() -dispc_set_tft_data_lines() -dispc_set_lcd_display_type() -dispc_set_lcd_timings() Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Mukund Mittal mmit...@ti.com Signed-off-by: Samreen samr...@ti.com Signed-off-by: Archit Taneja arc...@ti.com --- arch/arm/plat-omap/include/plat/display.h |2 + drivers/video/omap2/dss/dispc.c | 38 drivers/video/omap2/dss/dpi.c | 12 + drivers/video/omap2/dss/dsi.c | 14 ++ drivers/video/omap2/dss/dss.h | 19 -- drivers/video/omap2/dss/rfbi.c| 20 --- drivers/video/omap2/dss/sdi.c | 16 +++ 7 files changed, 71 insertions(+), 50 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h index 586944d..f184003 100644 --- a/arch/arm/plat-omap/include/plat/display.h +++ b/arch/arm/plat-omap/include/plat/display.h @@ -354,6 +354,8 @@ struct omap_dss_device { enum omap_display_type type; + enum omap_channel channel; + union { struct { u8 data_lines; diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index ca072fe..d855da2 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -941,13 +941,13 @@ void dispc_enable_replication(enum omap_plane plane, bool enable) enable_clocks(0); } -void dispc_set_lcd_size(u16 width, u16 height) +void dispc_set_lcd_size(enum omap_channel channel, u16 width, u16 height) { u32 val; BUG_ON((width (1 11)) || (height (1 11))); val = FLD_VAL(height - 1, 26, 16) | FLD_VAL(width - 1, 10, 0); enable_clocks(1); - dispc_write_reg(DISPC_SIZE_LCD(OMAP_DSS_CHANNEL_LCD), val); + dispc_write_reg(DISPC_SIZE_LCD(channel), val); enable_clocks(0); } @@ -1886,7 +1886,7 @@ void dispc_pck_free_enable(bool enable) enable_clocks(0); } -void dispc_enable_fifohandcheck(bool enable) +void dispc_enable_fifohandcheck(enum omap_channel channel, bool enable) { enable_clocks(1); REG_FLD_MOD(DISPC_CONFIG, enable ? 1 : 0, 16, 16); @@ -1894,7 +1894,8 @@ void dispc_enable_fifohandcheck(bool enable) } -void dispc_set_lcd_display_type(enum omap_lcd_display_type type) +void dispc_set_lcd_display_type(enum omap_channel channel, + enum omap_lcd_display_type type) { int mode; @@ -2037,7 +2038,7 @@ bool dispc_trans_key_enabled(enum omap_channel ch) } -void dispc_set_tft_data_lines(u8 data_lines) +void dispc_set_tft_data_lines(enum omap_channel channel, u8 data_lines) { int code; @@ -2064,7 +2065,8 @@ void dispc_set_tft_data_lines(u8 data_lines) enable_clocks(0); } -void dispc_set_parallel_interface_mode(enum omap_parallel_interface_mode mode) +void dispc_set_parallel_interface_mode(enum omap_channel channel, + enum omap_parallel_interface_mode mode) { u32 l; int stallmode; @@ -2097,9 +2099,11 @@ void dispc_set_parallel_interface_mode(enum omap_parallel_interface_mode mode) l = dispc_read_reg(DISPC_CONTROL); l = FLD_MOD(l, stallmode, 11, 11); - l = FLD_MOD(l, gpout0, 15, 15); - l = FLD_MOD(l, gpout1, 16, 16); + if (channel == OMAP_DSS_CHANNEL_LCD) { + l = FLD_MOD(l, gpout0, 15, 15); + l = FLD_MOD(l, gpout1, 16, 16); + } dispc_write_reg(DISPC_CONTROL, l); enable_clocks(0); @@ -2136,8 +2140,8 @@ bool dispc_lcd_timings_ok(struct omap_video_timings *timings) timings-vfp, timings-vbp); } -static void _dispc_set_lcd_timings(int hsw, int hfp, int hbp, - int vsw, int vfp, int vbp) +static void _dispc_set_lcd_timings(enum omap_channel channel, int hsw, + int hfp, int hbp, int vsw, int vfp, int vbp) { u32 timing_h, timing_v; @@ -2156,13 +2160,14 @@ static void _dispc_set_lcd_timings(int hsw, int hfp, int hbp, } enable_clocks(1); - dispc_write_reg(DISPC_TIMING_H(OMAP_DSS_CHANNEL_LCD), timing_h); - dispc_write_reg(DISPC_TIMING_V(OMAP_DSS_CHANNEL_LCD), timing_v); + dispc_write_reg(DISPC_TIMING_H(channel), timing_h); +
[PATCH v5 4/7] OMAP: DSS2: Change remaining Dispc functions for new 'channel' argument
From: Sumit Semwal sumit.sem...@ti.com The following dispc functions are changed to incorporate channel as an argument: -dispc_lclk_rate() -dispc_pclk_rate() -dispc_set_pol_freq() -dispc_set_clock_div() -dispc_get_clock_div() Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Mukund Mittal mmit...@ti.com Signed-off-by: Samreen samr...@ti.com Signed-off-by: Archit Taneja arc...@ti.com --- drivers/video/omap2/dss/dispc.c | 62 ++- drivers/video/omap2/dss/dpi.c | 26 +--- drivers/video/omap2/dss/dsi.c | 11 --- drivers/video/omap2/dss/dss.h | 13 +--- drivers/video/omap2/dss/sdi.c |8 ++-- 5 files changed, 67 insertions(+), 53 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index d855da2..82499e6 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -1444,12 +1444,13 @@ static void calc_dma_rotation_offset(u8 rotation, bool mirror, } } -static unsigned long calc_fclk_five_taps(u16 width, u16 height, - u16 out_width, u16 out_height, enum omap_color_mode color_mode) +static unsigned long calc_fclk_five_taps(enum omap_channel channel, u16 width, + u16 height, u16 out_width, u16 out_height, + enum omap_color_mode color_mode) { u32 fclk = 0; /* FIXME venc pclk? */ - u64 tmp, pclk = dispc_pclk_rate(); + u64 tmp, pclk = dispc_pclk_rate(channel); if (height out_height) { /* FIXME get real display PPL */ @@ -1481,8 +1482,8 @@ static unsigned long calc_fclk_five_taps(u16 width, u16 height, return fclk; } -static unsigned long calc_fclk(u16 width, u16 height, - u16 out_width, u16 out_height) +static unsigned long calc_fclk(enum omap_channel channel, u16 width, + u16 height, u16 out_width, u16 out_height) { unsigned int hf, vf; @@ -1506,7 +1507,7 @@ static unsigned long calc_fclk(u16 width, u16 height, vf = 1; /* FIXME venc pclk? */ - return dispc_pclk_rate() * vf * hf; + return dispc_pclk_rate(channel) * vf * hf; } void dispc_set_channel_out(enum omap_plane plane, enum omap_channel channel_out) @@ -1625,7 +1626,7 @@ static int _dispc_setup_plane(enum omap_plane plane, five_taps = height out_height * 2; if (!five_taps) { - fclk = calc_fclk(width, height, + fclk = calc_fclk(OMAP_DSS_CHANNEL_LCD, width, height, out_width, out_height); /* Try 5-tap filter if 3-tap fclk is too high */ @@ -1640,8 +1641,9 @@ static int _dispc_setup_plane(enum omap_plane plane, } if (five_taps) - fclk = calc_fclk_five_taps(width, height, - out_width, out_height, color_mode); + fclk = calc_fclk_five_taps(OMAP_DSS_CHANNEL_LCD, width, + height, out_width, out_height, + color_mode); DSSDBG(required fclk rate = %lu Hz\n, fclk); DSSDBG(current fclk rate = %lu Hz\n, dispc_fclk_rate()); @@ -2198,13 +2200,14 @@ void dispc_set_lcd_timings(enum omap_channel channel, DSSDBG(hsync %luHz, vsync %luHz\n, ht, vt); } -static void dispc_set_lcd_divisor(u16 lck_div, u16 pck_div) +static void dispc_set_lcd_divisor(enum omap_channel channel, u16 lck_div, + u16 pck_div) { BUG_ON(lck_div 1); BUG_ON(pck_div 2); enable_clocks(1); - dispc_write_reg(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD), + dispc_write_reg(DISPC_DIVISOR(channel), FLD_VAL(lck_div, 23, 16) | FLD_VAL(pck_div, 7, 0)); enable_clocks(0); } @@ -2232,13 +2235,13 @@ unsigned long dispc_fclk_rate(void) return r; } -unsigned long dispc_lclk_rate(void) +unsigned long dispc_lclk_rate(enum omap_channel channel) { int lcd; unsigned long r; u32 l; - l = dispc_read_reg(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD)); + l = dispc_read_reg(DISPC_DIVISOR(channel)); lcd = FLD_GET(l, 23, 16); @@ -2247,13 +2250,13 @@ unsigned long dispc_lclk_rate(void) return r / lcd; } -unsigned long dispc_pclk_rate(void) +unsigned long dispc_pclk_rate(enum omap_channel channel) { int lcd, pcd; unsigned long r; u32 l; - l = dispc_read_reg(DISPC_DIVISOR(OMAP_DSS_CHANNEL_LCD)); + l = dispc_read_reg(DISPC_DIVISOR(channel)); lcd = FLD_GET(l, 23, 16); pcd = FLD_GET(l, 7, 0); @@ -2278,8 +2281,10 @@ void dispc_dump_clocks(struct seq_file *s) dss1_alwon_fclk : dsi1_pll_fclk); seq_printf(s, fck\t\t%-16lu\n, dispc_fclk_rate()); -
[PATCH v5 5/7] OMAP: DSS2: LCD2 Channel Changes for DISPC
From: Sumit Semwal sumit.sem...@ti.com Modify DISPC functions to work with LCD2 as the DISPC Channel. Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Mukund Mittal mmit...@ti.com Signed-off-by: Samreen samr...@ti.com Signed-off-by: Archit Taneja arc...@ti.com --- arch/arm/plat-omap/include/plat/display.h |4 + drivers/video/omap2/dss/dispc.c | 281 + drivers/video/omap2/dss/dpi.c |2 +- 3 files changed, 247 insertions(+), 40 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h index f184003..537f4e4 100644 --- a/arch/arm/plat-omap/include/plat/display.h +++ b/arch/arm/plat-omap/include/plat/display.h @@ -42,6 +42,10 @@ #define DISPC_IRQ_SYNC_LOST(1 14) #define DISPC_IRQ_SYNC_LOST_DIGIT (1 15) #define DISPC_IRQ_WAKEUP (1 16) +#define DISPC_IRQ_SYNC_LOST2 (1 17) +#define DISPC_IRQ_VSYNC2 (1 18) +#define DISPC_IRQ_ACBIAS_COUNT_STAT2 (1 21) +#define DISPC_IRQ_FRAMEDONE2 (1 22) struct omap_dss_device; struct omap_overlay_manager; diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 82499e6..6c06160 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -234,6 +234,17 @@ void dispc_save_context(void) SR(GLOBAL_ALPHA); SR(SIZE_DIG); SR(SIZE_LCD(0)); + if (dss_has_feature(FEAT_MGR_LCD2)) { + SR(CONTROL2); + SR(DEFAULT_COLOR(2)); + SR(TRANS_COLOR(2)); + SR(SIZE_LCD(2)); + SR(TIMING_H(2)); + SR(TIMING_V(2)); + SR(POL_FREQ(2)); + SR(DIVISOR(2)); + SR(CONFIG2); + } SR(GFX_BA0); SR(GFX_BA1); @@ -253,6 +264,15 @@ void dispc_save_context(void) SR(CPR_COEF_R(0)); SR(CPR_COEF_G(0)); SR(CPR_COEF_B(0)); + if (dss_has_feature(FEAT_MGR_LCD2)) { + SR(CPR_COEF_B(2)); + SR(CPR_COEF_G(2)); + SR(CPR_COEF_R(2)); + + SR(DATA_CYCLE1(2)); + SR(DATA_CYCLE2(2)); + SR(DATA_CYCLE3(2)); + } SR(GFX_PRELOAD); @@ -373,6 +393,16 @@ void dispc_restore_context(void) RR(GLOBAL_ALPHA); RR(SIZE_DIG); RR(SIZE_LCD(0)); + if (dss_has_feature(FEAT_MGR_LCD2)) { + RR(DEFAULT_COLOR(2)); + RR(TRANS_COLOR(2)); + RR(SIZE_LCD(2)); + RR(TIMING_H(2)); + RR(TIMING_V(2)); + RR(POL_FREQ(2)); + RR(DIVISOR(2)); + RR(CONFIG2); + } RR(GFX_BA0); RR(GFX_BA1); @@ -392,6 +422,15 @@ void dispc_restore_context(void) RR(CPR_COEF_R(0)); RR(CPR_COEF_G(0)); RR(CPR_COEF_B(0)); + if (dss_has_feature(FEAT_MGR_LCD2)) { + RR(DATA_CYCLE1(2)); + RR(DATA_CYCLE2(2)); + RR(DATA_CYCLE3(2)); + + RR(CPR_COEF_B(2)); + RR(CPR_COEF_G(2)); + RR(CPR_COEF_R(2)); + } RR(GFX_PRELOAD); @@ -495,7 +534,8 @@ void dispc_restore_context(void) /* enable last, because LCD DIGIT enable are here */ RR(CONTROL); - + if (dss_has_feature(FEAT_MGR_LCD2)) + RR(CONTROL2); /* clear spurious SYNC_LOST_DIGIT interrupts */ dispc_write_reg(DISPC_IRQSTATUS, DISPC_IRQ_SYNC_LOST_DIGIT); @@ -521,42 +561,63 @@ bool dispc_go_busy(enum omap_channel channel) { int bit; - if (channel == OMAP_DSS_CHANNEL_LCD) + if (channel == OMAP_DSS_CHANNEL_LCD || + channel == OMAP_DSS_CHANNEL_LCD2) bit = 5; /* GOLCD */ else bit = 6; /* GODIGIT */ - return REG_GET(DISPC_CONTROL, bit, bit) == 1; + if (channel == OMAP_DSS_CHANNEL_LCD2) + return REG_GET(DISPC_CONTROL2, bit, bit) == 1; + else + return REG_GET(DISPC_CONTROL, bit, bit) == 1; } void dispc_go(enum omap_channel channel) { int bit; + bool enable_bit, go_bit; enable_clocks(1); - if (channel == OMAP_DSS_CHANNEL_LCD) + if (channel == OMAP_DSS_CHANNEL_LCD || + channel == OMAP_DSS_CHANNEL_LCD2) bit = 0; /* LCDENABLE */ else bit = 1; /* DIGITALENABLE */ /* if the channel is not enabled, we don't need GO */ - if (REG_GET(DISPC_CONTROL, bit, bit) == 0) + if (channel == OMAP_DSS_CHANNEL_LCD2) + enable_bit = REG_GET(DISPC_CONTROL2, bit, bit) == 1; + else + enable_bit = REG_GET(DISPC_CONTROL, bit, bit) == 1; + + if (!enable_bit) goto end; - if (channel == OMAP_DSS_CHANNEL_LCD) + if (channel == OMAP_DSS_CHANNEL_LCD || +
[PATCH v5 6/7] OMAP: DSS2: Use dss_features to handle DISPC bits removed on OMAP4
DISPC_CONFIG bits LCDENABLEPOL, LCDENABLESIGNAL, PCKFREEENABLE and FUNCGATED have been removed from OMAP4, use dss_features to handle them correctly. Signed-off-by: Archit Taneja arc...@ti.com --- drivers/video/omap2/dss/dispc.c | 12 +++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 6c06160..ad8fbcc 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -1965,6 +1965,9 @@ void dispc_enable_channel(enum omap_channel channel, bool enable) void dispc_lcd_enable_signal_polarity(bool act_high) { + if (!dss_has_feature(FEAT_LCDENABLEPOL)) + return; + enable_clocks(1); REG_FLD_MOD(DISPC_CONTROL, act_high ? 1 : 0, 29, 29); enable_clocks(0); @@ -1972,6 +1975,9 @@ void dispc_lcd_enable_signal_polarity(bool act_high) void dispc_lcd_enable_signal(bool enable) { + if (!dss_has_feature(FEAT_LCDENABLESIGNAL)) + return; + enable_clocks(1); REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 28, 28); enable_clocks(0); @@ -1979,6 +1985,9 @@ void dispc_lcd_enable_signal(bool enable) void dispc_pck_free_enable(bool enable) { + if (!dss_has_feature(FEAT_PCKFREEENABLE)) + return; + enable_clocks(1); REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 27, 27); enable_clocks(0); @@ -3289,7 +3298,8 @@ static void _omap_dispc_initial_config(void) dispc_write_reg(DISPC_SYSCONFIG, l); /* FUNCGATED */ - REG_FLD_MOD(DISPC_CONFIG, 1, 9, 9); + if (dss_has_feature(FEAT_FUNCGATED)) + REG_FLD_MOD(DISPC_CONFIG, 1, 9, 9); /* L3 firewall setting: enable access to OCM RAM */ /* XXX this should be somewhere in plat-omap */ -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 7/7] OMAP: DSS2: Add new Overlay Manager
From: Sumit Semwal sumit.sem...@ti.com Add new Overlay Manager in manager.c, make changes needed for LCD2 channel. Signed-off-by: Sumit Semwal sumit.sem...@ti.com Signed-off-by: Mukund Mittal mmit...@ti.com Signed-off-by: Samreen samr...@ti.com --- drivers/video/omap2/dss/dispc.c | 21 +- drivers/video/omap2/dss/dss.h |4 +- drivers/video/omap2/dss/manager.c | 77 +++-- drivers/video/omap2/dss/overlay.c | 14 ++- 4 files changed, 72 insertions(+), 44 deletions(-) diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index ad8fbcc..1863bce 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -1610,8 +1610,8 @@ static int _dispc_setup_plane(enum omap_plane plane, bool ilace, enum omap_dss_rotation_type rotation_type, u8 rotation, int mirror, - u8 global_alpha, - u8 pre_mult_alpha) + u8 global_alpha, u8 pre_mult_alpha, + enum omap_channel channel) { const int maxdownscale = cpu_is_omap34xx() ? 4 : 2; bool five_taps = 0; @@ -1710,8 +1710,8 @@ static int _dispc_setup_plane(enum omap_plane plane, five_taps = height out_height * 2; if (!five_taps) { - fclk = calc_fclk(OMAP_DSS_CHANNEL_LCD, width, height, - out_width, out_height); + fclk = calc_fclk(channel, width, height, out_width, + out_height); /* Try 5-tap filter if 3-tap fclk is too high */ if (cpu_is_omap34xx() height out_height @@ -1725,9 +1725,8 @@ static int _dispc_setup_plane(enum omap_plane plane, } if (five_taps) - fclk = calc_fclk_five_taps(OMAP_DSS_CHANNEL_LCD, width, - height, out_width, out_height, - color_mode); + fclk = calc_fclk_five_taps(channel, width, height, + out_width, out_height, color_mode); DSSDBG(required fclk rate = %lu Hz\n, fclk); DSSDBG(current fclk rate = %lu Hz\n, dispc_fclk_rate()); @@ -3374,17 +3373,17 @@ int dispc_setup_plane(enum omap_plane plane, bool ilace, enum omap_dss_rotation_type rotation_type, u8 rotation, bool mirror, u8 global_alpha, - u8 pre_mult_alpha) + u8 pre_mult_alpha, enum omap_channel channel) { int r = 0; DSSDBG(dispc_setup_plane %d, pa %x, sw %d, %d,%d, %dx%d - - %dx%d, ilace %d, cmode %x, rot %d, mir %d\n, + %dx%d, ilace %d, cmode %x, rot %d, mir %d chan %d\n, plane, paddr, screen_width, pos_x, pos_y, width, height, out_width, out_height, ilace, color_mode, - rotation, mirror); + rotation, mirror, channel); enable_clocks(1); @@ -3397,7 +3396,7 @@ int dispc_setup_plane(enum omap_plane plane, rotation_type, rotation, mirror, global_alpha, - pre_mult_alpha); + pre_mult_alpha, channel); enable_clocks(0); diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 2959f82..dd51d3f 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -359,8 +359,8 @@ int dispc_setup_plane(enum omap_plane plane, bool ilace, enum omap_dss_rotation_type rotation_type, u8 rotation, bool mirror, - u8 global_alpha, - u8 pre_mult_alpha); + u8 global_alpha, u8 pre_mult_alpha, + enum omap_channel channel); bool dispc_go_busy(enum omap_channel channel); void dispc_go(enum omap_channel channel); diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 873b334..172d4e6 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c @@ -513,11 +513,14 @@ static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr) unsigned long timeout = msecs_to_jiffies(500); u32 irq; - if (mgr-device-type == OMAP_DISPLAY_TYPE_VENC) + if (mgr-device-type == OMAP_DISPLAY_TYPE_VENC) { irq = DISPC_IRQ_EVSYNC_ODD; - else - irq = DISPC_IRQ_VSYNC; - + } else { + if (mgr-id == OMAP_DSS_CHANNEL_LCD) + irq = DISPC_IRQ_VSYNC; + else + irq = DISPC_IRQ_VSYNC2; + } return
RE: [PATCHv4 11/14] OMAP2+: dmtimer: convert to platform devices
-Original Message- From: Varadarajan, Charulatha Sent: Monday, November 22, 2010 12:04 PM To: DebBarma, Tarun Kanti Cc: linux-omap@vger.kernel.org; Gopinath, Thara; Basak, Partha Subject: Re: [PATCHv4 11/14] OMAP2+: dmtimer: convert to platform devices On Sat, Nov 20, 2010 at 08:09, Tarun Kanti DebBarma tarun.ka...@ti.com wrote: From: Thara Gopinath th...@ti.com Add routines to converts dmtimers to platform devices. The device data is obtained from hwmod database of respective platform and is registered to device model after successful binding to driver. It also provides provision to access timers during early boot when pm_runtime framework is not completely up and running. Signed-off-by: Thara Gopinath th...@ti.com Signed-off-by: Tarun Kanti DebBarma tarun.ka...@ti.com [p-bas...@ti.com: pm_runtime logic] Where is runtime logic in this patch? The patch description says pm_runtime framework is not completely up and running I have put in the wrong place. Signed-off-by: Partha Basak p-bas...@ti.com --- arch/arm/mach-omap2/Makefile |2 +- arch/arm/mach-omap2/dmtimer.c | 296 + 2 files changed, 297 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/dmtimer.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ce7b1f0..148f4d7 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -4,7 +4,7 @@ # Common support obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \ -common.o +common.o dmtimer.o omap-2-3-common= irq.o sdrc.o prm2xxx_3xxx.o hwmod-common = omap_hwmod.o \ diff --git a/arch/arm/mach-omap2/dmtimer.c b/arch/arm/mach- omap2/dmtimer.c new file mode 100644 index 000..b5951b1 --- /dev/null +++ b/arch/arm/mach-omap2/dmtimer.c @@ -0,0 +1,296 @@ +/** + * OMAP2PLUS Dual-Mode Timers - platform device registration + * + * Contains first level initialization routines which extracts timers + * information from hwmod database and registers with linux device model. + * It also has low level function to chnage the timer input clock source. + * + * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ + * Tarun Kanti DebBarma tarun.ka...@ti.com + * + * Copyright (C) 2010 Texas Instruments Incorporated + * Thara Gopinath th...@ti.com Don't repeat the same copyright information twice: Copyright (C) 2010 Texas Instruments Incorporated + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed as is WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#undef DEBUG + +#include linux/clk.h +#include linux/delay.h +#include linux/io.h +#include linux/err.h +#include linux/slab.h + +#include mach/irqs.h +#include plat/dmtimer.h +#include plat/powerdomain.h +#include plat/omap_hwmod.h +#include plat/omap_device.h +#include linux/pm_runtime.h Why is linux/pm_runtime.h required in this file? I don't find any use here. Also check if plat/powerdomain.h is required. Thanks, this is a clean up problem. Lot of implementations were optimized. But missed to cleanup the headers which include powerdomain.h, delay.h and Irqs.h + +static int early_timer_count __initdata = 1; + +/** + * omap2_dm_timer_set_src - change the timer input clock source + * @pdev: timer platform device pointer + * @timer_clk: current clock source + * @source:array index of parent clock source + */ +static int omap2_dm_timer_set_src(struct platform_device *pdev, int source) +{ + int ret; + struct dmtimer_platform_data *pdata = pdev-dev.platform_data; + struct clk *fclk = clk_get(pdev-dev, fck); + struct clk *new_fclk; + char *fclk_name = 32k_ck; /* default name */ + + switch(source) { + case OMAP_TIMER_SRC_SYS_CLK: + fclk_name = sys_ck; + break; + + case OMAP_TIMER_SRC_32_KHZ: + fclk_name = 32k_ck; + break; + + case OMAP_TIMER_SRC_EXT_CLK: + if (pdata-timer_ip_type == OMAP_TIMER_IP_VERSION_1) { + fclk_name = alt_ck; + break; + } + dev_dbg(pdev-dev, %s:%d: invalid clk src.\n, + __func__, __LINE__); + return -EINVAL; + } + + + if (IS_ERR_OR_NULL(fclk)) { + dev_dbg(pdev-dev,
RE: [PATCHv4 8/14] OMAP: dmtimer: platform driver
-Original Message- From: Varadarajan, Charulatha [mailto:ch...@ti.com] Sent: Monday, November 22, 2010 12:43 PM To: DebBarma, Tarun Kanti Cc: linux-omap@vger.kernel.org; Gopinath, Thara Subject: Re: [PATCHv4 8/14] OMAP: dmtimer: platform driver snip +static struct platform_driver omap_dmtimer_driver = { + .probe = omap_dm_timer_probe, + .remove = omap_dm_timer_remove, + .driver = { + .name = omap-timer, Comment from Benoit on omap devices name ( see [1] ): If possible, it will be better to use the omap_ prefix in order to start having some consitency in the omap devices name. I can change. -- Tarun [1] https://patchwork.kernel.org/patch/305082/ + }, +}; + snip -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: No more software ECC in omap2.c NAND driver. Why?
[..snip..] The board (Mistral AM37x) NAND (Micron 256 MiB) was originally bootstrapped over SD/MMC from u-boot using the following script: [Ghorai] let me know the nand details - x8/x16, small/big page? [..snip..] nandecc sw [..snip..] fatload mmc 0 ${loadaddr} root.jff [Ghorai] How you create the root.jff mkfs.jffs2 --output=root.jffs2 --root=.. --pagesize=?? --eraseblock=?? -n nand write.i ${loadaddr} 0x00c0 0x200 nand write.i ${loadaddr} 0x0420 0x200 [Ghorai] why you writing in two places? Following that, the board is updated, from Linux, using 'flash_eraseall - q' and 'nandwrite -p -q' on all partitions, except that containing MLO. [Ghorai] 1. can you send the exact comment you used to write in nand? Which partition? 2. What is the last kernel you used and was working perfectly? 3. If possible revert the following patches and let me know the status? f450d86790ebf72ac93c7ea5addd6fa278aae64c..2430f9df61e2ea47ea468dfe22b7e2db97111fb4 2c01946c6b9ebaa5a89710bc42ca224a7f52f227 948d38e799f0ab87cf8ed9113fcdaaee61acf321 -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html