Re: [PATCH v2 04/23] staging: rtl8192e: Remove unused enums

2015-07-14 Thread Jakub Sitnicki
On Tue, Jul 14, 2015 at 10:04 PM CEST, Mateusz Kulikowski 
 wrote:
> Remove ack_policy enum and some unused RTL_DEBUG enums.
>
> Signed-off-by: Mateusz Kulikowski 
> ---

[snip]

> diff --git a/drivers/staging/rtl8192e/rtllib_debug.h 
> b/drivers/staging/rtl8192e/rtllib_debug.h
> index 42e88d6..2f47a7c 100644
> --- a/drivers/staging/rtl8192e/rtllib_debug.h
> +++ b/drivers/staging/rtl8192e/rtllib_debug.h
> @@ -40,10 +40,7 @@ enum RTL_DEBUG {
>   COMP_DBG= (1 << 1),
>   COMP_INIT   = (1 << 2),
>   COMP_RECV   = (1 << 3),
> - COMP_SEND   = (1 << 4),
> - COMP_CMD= (1 << 5),
>   COMP_POWER  = (1 << 6),
> - COMP_EPROM  = (1 << 7),
>   COMP_SWBW   = (1 << 8),
>   COMP_SEC= (1 << 9),
>   COMP_LPS= (1 << 10),
> @@ -58,15 +55,12 @@ enum RTL_DEBUG {
>   COMP_CH = (1 << 19),
>   COMP_RF = (1 << 20),
>   COMP_FIRMWARE   = (1 << 21),
> - COMP_HT = (1 << 22),
>   COMP_RESET  = (1 << 23),
>   COMP_CMDPKT = (1 << 24),
>   COMP_SCAN   = (1 << 25),
>   COMP_PS = (1 << 26),
>   COMP_DOWN   = (1 << 27),
>   COMP_INTR   = (1 << 28),
> - COMP_LED= (1 << 29),
> - COMP_MLME   = (1 << 30),
>   COMP_ERR= (1 << 31)
>  };

Is it possible that this change will make future readers wonder why
there are holes in the enum values, and hence hurts readability?

Cheers,
Jakub
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] mm/page_owner: fix possible access violation

2015-07-14 Thread Joonsoo Kim
When I tested my new patches, I found that page pointer which is used
for setting page_owner information is changed. This is because page
pointer is used to set new migratetype in loop. After this work,
page pointer could be out of bound. If this wrong pointer is used for
page_owner, access violation happens. Below is error message that I got.

[ 6175.025217] BUG: unable to handle kernel paging request at 00b00018
[ 6175.026400] IP: [] save_stack_address+0x30/0x40
[ 6175.027341] PGD 1af2d067 PUD 166e0067 PMD 0
[ 6175.028129] Oops: 0002 [#1] SMP
snip...
[ 6175.055349] Call Trace:
[ 6175.055780]  [] print_context_stack+0xcf/0x100
[ 6175.056794]  [] ? __module_text_address+0x12/0x70
[ 6175.057848]  [] dump_trace+0x15f/0x320
[ 6175.058751]  [] ? do_flush_tlb_all+0x50/0x50
[ 6175.059732]  [] ? smp_call_function_single+0xb9/0x120
[ 6175.060856]  [] save_stack_trace+0x2f/0x50
[ 6175.061812]  [] __set_page_owner+0x46/0x70
[ 6175.062774]  [] __isolate_free_page+0x1f7/0x210
[ 6175.063804]  [] split_free_page+0x21/0xb0
[ 6175.064757]  [] isolate_freepages_block+0x1e2/0x410
[ 6175.065855]  [] compaction_alloc+0x22d/0x2d0
[ 6175.066850]  [] migrate_pages+0x289/0x8b0
[ 6175.067798]  [] ? isolate_migratepages_block+0x28a/0x6e0
[ 6175.068960]  [] ? kmalloc_slab+0xa0/0xa0
[ 6175.069892]  [] ? 
ftrace_raw_event_mm_compaction_deplete_template+0xc0/0xc0
[ 6175.071327]  [] compact_zone+0x409/0x880
[ 6175.072261]  [] compact_zone_order+0x6d/0x90
[ 6175.073250]  [] try_to_compact_pages+0x110/0x210
[ 6175.074297]  [] __alloc_pages_direct_compact+0x3d/0xe6
[ 6175.075427]  [] __alloc_pages_nodemask+0x6cd/0x9a0
[ 6175.076517]  [] alloc_pages_current+0x91/0x100
[ 6175.077545]  [] runtest_store+0x296/0xa50
[ 6175.078497]  [] ? simple_strtoull+0x2c/0x50
[ 6175.079465]  [] simple_attr_write+0xbd/0xe0
[ 6175.080458]  [] __vfs_write+0x28/0xf0
[ 6175.081349]  [] ? __sb_start_write+0x49/0xf0
[ 6175.082345]  [] ? security_file_permission+0x45/0xd0
[ 6175.083453]  [] vfs_write+0xa9/0x1b0
[ 6175.084334]  [] SyS_write+0x46/0xb0
[ 6175.085196]  [] ? context_tracking_user_enter+0x13/0x20
[ 6175.086339]  [] ? syscall_trace_leave+0xa5/0x120
[ 6175.087389]  [] system_call_fastpath+0x16/0x75

This patch fixes this error by moving up set_page_owner().

Signed-off-by: Joonsoo Kim 
---
 mm/page_alloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index afd5459..70d6a85 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2003,6 +2003,8 @@ int __isolate_free_page(struct page *page, unsigned int 
order)
zone->free_area[order].nr_free--;
rmv_page_order(page);
 
+   set_page_owner(page, order, 0);
+
/* Set the pageblock if the isolated page is at least a pageblock */
if (order >= pageblock_order - 1) {
struct page *endpage = page + (1 << order) - 1;
@@ -2014,7 +2016,7 @@ int __isolate_free_page(struct page *page, unsigned int 
order)
}
}
 
-   set_page_owner(page, order, 0);
+
return 1UL << order;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] mm/page_owner: set correct gfp_mask on page_owner

2015-07-14 Thread Joonsoo Kim
Currently, we set wrong gfp_mask to page_owner info in case of
isolated freepage by compaction and split page. It causes incorrect
mixed pageblock report that we can get from '/proc/pagetypeinfo'.
This metric is really useful to measure fragmentation effect so
should be accurate. This patch fixes it by setting correct
information.

Without this patch, after kernel build workload is finished, number
of mixed pageblock is 112 among roughly 210 movable pageblocks.

But, with this fix, output shows that mixed pageblock is just 57.

Signed-off-by: Joonsoo Kim 
---
 include/linux/page_owner.h | 13 +
 mm/page_alloc.c|  8 +---
 mm/page_owner.c|  7 +++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h
index b48c347..cacaabe 100644
--- a/include/linux/page_owner.h
+++ b/include/linux/page_owner.h
@@ -8,6 +8,7 @@ extern struct page_ext_operations page_owner_ops;
 extern void __reset_page_owner(struct page *page, unsigned int order);
 extern void __set_page_owner(struct page *page,
unsigned int order, gfp_t gfp_mask);
+extern gfp_t __get_page_owner_gfp(struct page *page);
 
 static inline void reset_page_owner(struct page *page, unsigned int order)
 {
@@ -25,6 +26,14 @@ static inline void set_page_owner(struct page *page,
 
__set_page_owner(page, order, gfp_mask);
 }
+
+static inline gfp_t get_page_owner_gfp(struct page *page)
+{
+   if (likely(!page_owner_inited))
+   return 0;
+
+   return __get_page_owner_gfp(page);
+}
 #else
 static inline void reset_page_owner(struct page *page, unsigned int order)
 {
@@ -33,6 +42,10 @@ static inline void set_page_owner(struct page *page,
unsigned int order, gfp_t gfp_mask)
 {
 }
+static inline gfp_t get_page_owner_gfp(struct page *page)
+{
+   return 0;
+}
 
 #endif /* CONFIG_PAGE_OWNER */
 #endif /* __LINUX_PAGE_OWNER_H */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 70d6a85..3ce3ec2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1957,6 +1957,7 @@ void free_hot_cold_page_list(struct list_head *list, bool 
cold)
 void split_page(struct page *page, unsigned int order)
 {
int i;
+   gfp_t gfp_mask;
 
VM_BUG_ON_PAGE(PageCompound(page), page);
VM_BUG_ON_PAGE(!page_count(page), page);
@@ -1970,10 +1971,11 @@ void split_page(struct page *page, unsigned int order)
split_page(virt_to_page(page[0].shadow), order);
 #endif
 
-   set_page_owner(page, 0, 0);
+   gfp_mask = get_page_owner_gfp(page);
+   set_page_owner(page, 0, gfp_mask);
for (i = 1; i < (1 << order); i++) {
set_page_refcounted(page + i);
-   set_page_owner(page + i, 0, 0);
+   set_page_owner(page + i, 0, gfp_mask);
}
 }
 EXPORT_SYMBOL_GPL(split_page);
@@ -2003,7 +2005,7 @@ int __isolate_free_page(struct page *page, unsigned int 
order)
zone->free_area[order].nr_free--;
rmv_page_order(page);
 
-   set_page_owner(page, order, 0);
+   set_page_owner(page, order, __GFP_MOVABLE);
 
/* Set the pageblock if the isolated page is at least a pageblock */
if (order >= pageblock_order - 1) {
diff --git a/mm/page_owner.c b/mm/page_owner.c
index 0993f5f..a3c4aed 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -76,6 +76,13 @@ void __set_page_owner(struct page *page, unsigned int order, 
gfp_t gfp_mask)
__set_bit(PAGE_EXT_OWNER, &page_ext->flags);
 }
 
+gfp_t __get_page_owner_gfp(struct page *page)
+{
+   struct page_ext *page_ext = lookup_page_ext(page);
+
+   return page_ext->gfp_mask;
+}
+
 static ssize_t
 print_page_owner(char __user *buf, size_t count, unsigned long pfn,
struct page *page, struct page_ext *page_ext)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 10/46] usb: gadget: bcm63xx_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c 
b/drivers/usb/gadget/udc/bcm63xx_udc.c
index 9db968b..c5e0894 100644
--- a/drivers/usb/gadget/udc/bcm63xx_udc.c
+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
@@ -44,9 +44,25 @@
 #define DRV_MODULE_NAME"bcm63xx_udc"
 
 static const char bcm63xx_ep0name[] = "ep0";
-static const char *const bcm63xx_ep_name[] = {
-   bcm63xx_ep0name,
-   "ep1in-bulk", "ep2out-bulk", "ep3in-int", "ep4out-int",
+
+static const struct {
+   const char *name;
+   const struct usb_ep_caps caps;
+} bcm63xx_ep_info[] = {
+#define EP_INFO(_name, _type, _dir) \
+   { \
+   .name = _name, \
+   .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
+   USB_EP_CAPS_DIR_ ## _dir), \
+   }
+
+   EP_INFO(bcm63xx_ep0name, CONTROL, ALL),
+   EP_INFO("ep1in-bulk",   BULK,   IN),
+   EP_INFO("ep2out-bulk",  BULK,   OUT),
+   EP_INFO("ep3in-int",INT,IN),
+   EP_INFO("ep4out-int",   INT,OUT),
+
+#undef EP_INFO
 };
 
 static bool use_fullspeed;
@@ -943,7 +959,8 @@ static int bcm63xx_init_udc_hw(struct bcm63xx_udc *udc)
for (i = 0; i < BCM63XX_NUM_EP; i++) {
struct bcm63xx_ep *bep = &udc->bep[i];
 
-   bep->ep.name = bcm63xx_ep_name[i];
+   bep->ep.name = bcm63xx_ep_info[i].name;
+   bep->ep.caps = bcm63xx_ep_info[i].caps;
bep->ep_num = i;
bep->ep.ops = &bcm63xx_udc_ep_ops;
list_add_tail(&bep->ep.ep_list, &udc->gadget.ep_list);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 08/46] usb: gadget: amd5536udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/amd5536udc.c | 57 ++---
 1 file changed, 47 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/udc/amd5536udc.c 
b/drivers/usb/gadget/udc/amd5536udc.c
index de7e5e2..1a1d91c 100644
--- a/drivers/usb/gadget/udc/amd5536udc.c
+++ b/drivers/usb/gadget/udc/amd5536udc.c
@@ -138,15 +138,51 @@ static DECLARE_TASKLET(disconnect_tasklet, 
udc_tasklet_disconnect,
 
 /* endpoint names used for print */
 static const char ep0_string[] = "ep0in";
-static const char *const ep_string[] = {
-   ep0_string,
-   "ep1in-int", "ep2in-bulk", "ep3in-bulk", "ep4in-bulk", "ep5in-bulk",
-   "ep6in-bulk", "ep7in-bulk", "ep8in-bulk", "ep9in-bulk", "ep10in-bulk",
-   "ep11in-bulk", "ep12in-bulk", "ep13in-bulk", "ep14in-bulk",
-   "ep15in-bulk", "ep0out", "ep1out-bulk", "ep2out-bulk", "ep3out-bulk",
-   "ep4out-bulk", "ep5out-bulk", "ep6out-bulk", "ep7out-bulk",
-   "ep8out-bulk", "ep9out-bulk", "ep10out-bulk", "ep11out-bulk",
-   "ep12out-bulk", "ep13out-bulk", "ep14out-bulk", "ep15out-bulk"
+static const struct {
+   const char *name;
+   const struct usb_ep_caps caps;
+} ep_info[] = {
+#define EP_INFO(_name, _type, _dir) \
+   { \
+   .name = _name, \
+   .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
+   USB_EP_CAPS_DIR_ ## _dir), \
+   }
+
+   EP_INFO(ep0_string, CONTROL, IN),
+   EP_INFO("ep1in-int",BULK,   IN),
+   EP_INFO("ep2in-bulk",   BULK,   IN),
+   EP_INFO("ep3in-bulk",   BULK,   IN),
+   EP_INFO("ep4in-bulk",   BULK,   IN),
+   EP_INFO("ep5in-bulk",   BULK,   IN),
+   EP_INFO("ep6in-bulk",   BULK,   IN),
+   EP_INFO("ep7in-bulk",   BULK,   IN),
+   EP_INFO("ep8in-bulk",   BULK,   IN),
+   EP_INFO("ep9in-bulk",   BULK,   IN),
+   EP_INFO("ep10in-bulk",  BULK,   IN),
+   EP_INFO("ep11in-bulk",  BULK,   IN),
+   EP_INFO("ep12in-bulk",  BULK,   IN),
+   EP_INFO("ep13in-bulk",  BULK,   IN),
+   EP_INFO("ep14in-bulk",  BULK,   IN),
+   EP_INFO("ep15in-bulk",  BULK,   IN),
+   EP_INFO("ep0out",   CONTROL, OUT),
+   EP_INFO("ep1out-bulk",  BULK,   OUT),
+   EP_INFO("ep2out-bulk",  BULK,   OUT),
+   EP_INFO("ep3out-bulk",  BULK,   OUT),
+   EP_INFO("ep4out-bulk",  BULK,   OUT),
+   EP_INFO("ep5out-bulk",  BULK,   OUT),
+   EP_INFO("ep6out-bulk",  BULK,   OUT),
+   EP_INFO("ep7out-bulk",  BULK,   OUT),
+   EP_INFO("ep8out-bulk",  BULK,   OUT),
+   EP_INFO("ep9out-bulk",  BULK,   OUT),
+   EP_INFO("ep10out-bulk", BULK,   OUT),
+   EP_INFO("ep11out-bulk", BULK,   OUT),
+   EP_INFO("ep12out-bulk", BULK,   OUT),
+   EP_INFO("ep13out-bulk", BULK,   OUT),
+   EP_INFO("ep14out-bulk", BULK,   OUT),
+   EP_INFO("ep15out-bulk", BULK,   OUT),
+
+#undef EP_INFO
 };
 
 /* DMA usage flag */
@@ -1517,7 +1553,8 @@ static void udc_setup_endpoints(struct udc *dev)
for (tmp = 0; tmp < UDC_EP_NUM; tmp++) {
ep = &dev->ep[tmp];
ep->dev = dev;
-   ep->ep.name = ep_string[tmp];
+   ep->ep.name = ep_info[tmp].name;
+   ep->ep.caps = ep_info[tmp].caps;
ep->num = tmp;
/* txfifo size is calculated at enable time */
ep->txfifo = dev->txfifo;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 18/46] usb: gadget: gr_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/gr_udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c
index c886887..8aa2593 100644
--- a/drivers/usb/gadget/udc/gr_udc.c
+++ b/drivers/usb/gadget/udc/gr_udc.c
@@ -2018,12 +2018,23 @@ static int gr_ep_init(struct gr_udc *dev, int num, int 
is_in, u32 maxplimit)
 
usb_ep_set_maxpacket_limit(&ep->ep, MAX_CTRL_PL_SIZE);
ep->bytes_per_buffer = MAX_CTRL_PL_SIZE;
+
+   ep->ep.caps.type_control = true;
} else {
usb_ep_set_maxpacket_limit(&ep->ep, (u16)maxplimit);
list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list);
+
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
}
list_add_tail(&ep->ep_list, &dev->ep_list);
 
+   if (is_in)
+   ep->ep.caps.dir_in = true;
+   else
+   ep->ep.caps.dir_out = true;
+
ep->tailbuf = dma_alloc_coherent(dev->dev, ep->ep.maxpacket_limit,
 &ep->tailbuf_paddr, GFP_ATOMIC);
if (!ep->tailbuf)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 17/46] usb: gadget: goku_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/goku_udc.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/gadget/udc/goku_udc.c 
b/drivers/usb/gadget/udc/goku_udc.c
index 9e8d842..46b8d14 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -1257,6 +1257,14 @@ static void udc_reinit (struct goku_udc *dev)
INIT_LIST_HEAD (&ep->queue);
 
ep_reset(NULL, ep);
+
+   if (i == 0)
+   ep->ep.caps.type_control = true;
+   else
+   ep->ep.caps.type_bulk = true;
+
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
}
 
dev->ep[0].reg_mode = NULL;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 14/46] usb: gadget: fsl_qe_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/fsl_qe_udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c 
b/drivers/usb/gadget/udc/fsl_qe_udc.c
index e0822f1..5fb6f8b 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -2417,6 +2417,17 @@ static int qe_ep_config(struct qe_udc *udc, unsigned 
char pipe_num)
strcpy(ep->name, ep_name[pipe_num]);
ep->ep.name = ep_name[pipe_num];
 
+   if (pipe_num == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
+
ep->ep.ops = &qe_ep_ops;
ep->stopped = 1;
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] mm/cma_debug: correct size input to bitmap function

2015-07-14 Thread Joonsoo Kim
In CMA, 1 bit in bitmap means 1 << order_per_bits pages so
size of bitmap is cma->count >> order_per_bits rather than
just cma->count. This patch fixes it.

Signed-off-by: Joonsoo Kim 
---
 mm/cma_debug.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index 22190a7..f8e4b60 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -39,7 +39,7 @@ static int cma_used_get(void *data, u64 *val)
 
mutex_lock(&cma->lock);
/* pages counter is smaller than sizeof(int) */
-   used = bitmap_weight(cma->bitmap, (int)cma->count);
+   used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma));
mutex_unlock(&cma->lock);
*val = (u64)used << cma->order_per_bit;
 
@@ -52,13 +52,14 @@ static int cma_maxchunk_get(void *data, u64 *val)
struct cma *cma = data;
unsigned long maxchunk = 0;
unsigned long start, end = 0;
+   unsigned long bitmap_maxno = cma_bitmap_maxno(cma);
 
mutex_lock(&cma->lock);
for (;;) {
-   start = find_next_zero_bit(cma->bitmap, cma->count, end);
+   start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end);
if (start >= cma->count)
break;
-   end = find_next_bit(cma->bitmap, cma->count, start);
+   end = find_next_bit(cma->bitmap, bitmap_maxno, start);
maxchunk = max(end - start, maxchunk);
}
mutex_unlock(&cma->lock);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC 0/4] change sb_writers to use percpu_rw_semaphore

2015-07-14 Thread Jan Kara
On Tue 14-07-15 14:41:13, Dave Hansen wrote:
> On 07/14/2015 02:22 PM, Oleg Nesterov wrote:
> >> Using my little write-1-byte test (under will-it-scale), your 4 patches
> >> improves the number of writes/sec by 12%.  My 3 patches improve the
> >> number of writes/sec by 32%.
> 
> I looked at it again.  I tested with this patch in addition to the ones
> modifying __sb_start/end_write():
> 
>   https://lkml.org/lkml/2015/6/24/682
> 
> That is where the performance delta came from.  Your patches (plus the
> fsnotify optimization) perform very similarly to my approach.
> 
> Yours remove so much code that I think they are the preferable approach.
> 
> They don't compile with lockdep on, btw. :)

Great, thanks for hashing it out. So I'm also in favor of Oleg's approach
as well. We just have to wait until he fixes the outstanding issues with
his code. Dave, just send your fsnotify patch separately to AKPM - he
usually merges fsnotify stuff. Thanks.

Honza
-- 
Jan Kara 
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 20/46] usb: gadget: m66592-udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/m66592-udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/m66592-udc.c 
b/drivers/usb/gadget/udc/m66592-udc.c
index 309706f..e404553 100644
--- a/drivers/usb/gadget/udc/m66592-udc.c
+++ b/drivers/usb/gadget/udc/m66592-udc.c
@@ -1644,6 +1644,17 @@ static int m66592_probe(struct platform_device *pdev)
ep->ep.name = m66592_ep_name[i];
ep->ep.ops = &m66592_ep_ops;
usb_ep_set_maxpacket_limit(&ep->ep, 512);
+
+   if (i == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
}
usb_ep_set_maxpacket_limit(&m66592->ep[0].ep, 64);
m66592->ep[0].pipenum = 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 23/46] usb: gadget: net2272: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/net2272.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
index 195baf3..34ec1ec 100644
--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -1404,6 +1404,17 @@ net2272_usb_reinit(struct net2272 *dev)
else
ep->fifo_size = 64;
net2272_ep_reset(ep);
+
+   if (i == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
}
usb_ep_set_maxpacket_limit(&dev->ep[0].ep, 64);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] lib/decompress: Set the compressor name to NULL on error

2015-07-14 Thread Aneesh Kumar K.V
Without this we end up using the previous name of the compressor
in the loop in unpack_rootfs. For example we get errors like
"compression method gzip not configured" even when we have
CONFIG_DECOMPRESS_GZIP enabled.

Signed-off-by: Aneesh Kumar K.V 
---
 lib/decompress.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/decompress.c b/lib/decompress.c
index 528ff932d8e4..62696dff5730 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -59,8 +59,11 @@ decompress_fn __init decompress_method(const unsigned char 
*inbuf, long len,
 {
const struct compress_format *cf;
 
-   if (len < 2)
+   if (len < 2) {
+   if (name)
+   *name = NULL;
return NULL;/* Need at least this much... */
+   }
 
pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 27/46] usb: gadget: pxa25x_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c 
b/drivers/usb/gadget/udc/pxa25x_udc.c
index f6cbe66..1301e29 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -1821,6 +1821,8 @@ static struct pxa25x_udc memory = {
.name   = ep0name,
.ops= &pxa25x_ep_ops,
.maxpacket  = EP0_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL,
+   USB_EP_CAPS_DIR_ALL),
},
.dev= &memory,
.reg_udccs  = &UDCCS0,
@@ -1833,6 +1835,8 @@ static struct pxa25x_udc memory = {
.name   = "ep1in-bulk",
.ops= &pxa25x_ep_ops,
.maxpacket  = BULK_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_IN),
},
.dev= &memory,
.fifo_size  = BULK_FIFO_SIZE,
@@ -1846,6 +1850,8 @@ static struct pxa25x_udc memory = {
.name   = "ep2out-bulk",
.ops= &pxa25x_ep_ops,
.maxpacket  = BULK_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_OUT),
},
.dev= &memory,
.fifo_size  = BULK_FIFO_SIZE,
@@ -1861,6 +1867,8 @@ static struct pxa25x_udc memory = {
.name   = "ep3in-iso",
.ops= &pxa25x_ep_ops,
.maxpacket  = ISO_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO,
+   USB_EP_CAPS_DIR_IN),
},
.dev= &memory,
.fifo_size  = ISO_FIFO_SIZE,
@@ -1874,6 +1882,8 @@ static struct pxa25x_udc memory = {
.name   = "ep4out-iso",
.ops= &pxa25x_ep_ops,
.maxpacket  = ISO_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO,
+   USB_EP_CAPS_DIR_OUT),
},
.dev= &memory,
.fifo_size  = ISO_FIFO_SIZE,
@@ -1888,6 +1898,8 @@ static struct pxa25x_udc memory = {
.name   = "ep5in-int",
.ops= &pxa25x_ep_ops,
.maxpacket  = INT_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
+   USB_EP_CAPS_DIR_IN),
},
.dev= &memory,
.fifo_size  = INT_FIFO_SIZE,
@@ -1903,6 +1915,8 @@ static struct pxa25x_udc memory = {
.name   = "ep6in-bulk",
.ops= &pxa25x_ep_ops,
.maxpacket  = BULK_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_IN),
},
.dev= &memory,
.fifo_size  = BULK_FIFO_SIZE,
@@ -1916,6 +1930,8 @@ static struct pxa25x_udc memory = {
.name   = "ep7out-bulk",
.ops= &pxa25x_ep_ops,
.maxpacket  = BULK_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_OUT),
},
.dev= &memory,
.fifo_size  = BULK_FIFO_SIZE,
@@ -1930,6 +1946,8 @@ static struct pxa25x_udc memory = {
.name   = "ep8in-iso",
.ops= &pxa25x_ep_ops,
.maxpacket  = ISO_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO,
+   USB_EP_CAPS_DIR_IN),
},
.dev= &memory,
.fifo_size  = ISO_FIFO_SIZE,
@@ -1943,6 +1961,8 @@ static struct pxa25x_udc memory = {
.name   = "ep9out-iso",
.ops= &pxa25x_ep_ops,
.maxpacket  = ISO_FI

[PATCH v3 29/46] usb: gadget: r8a66597-udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/r8a66597-udc.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c 
b/drivers/usb/gadget/udc/r8a66597-udc.c
index 0293f71..baa0609 100644
--- a/drivers/usb/gadget/udc/r8a66597-udc.c
+++ b/drivers/usb/gadget/udc/r8a66597-udc.c
@@ -1935,6 +1935,16 @@ static int r8a66597_probe(struct platform_device *pdev)
ep->ep.name = r8a66597_ep_name[i];
ep->ep.ops = &r8a66597_ep_ops;
usb_ep_set_maxpacket_limit(&ep->ep, 512);
+
+   if (i == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
}
usb_ep_set_maxpacket_limit(&r8a66597->ep[0].ep, 64);
r8a66597->ep[0].pipenum = 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 34/46] usb: musb: gadget: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/musb/musb_gadget.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 625d482f..043248a 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1729,6 +1729,7 @@ init_peripheral_ep(struct musb *musb, struct musb_ep *ep, 
u8 epnum, int is_in)
INIT_LIST_HEAD(&ep->end_point.ep_list);
if (!epnum) {
usb_ep_set_maxpacket_limit(&ep->end_point, 64);
+   ep->end_point.caps.type_control = true;
ep->end_point.ops = &musb_g_ep0_ops;
musb->g.ep0 = &ep->end_point;
} else {
@@ -1736,9 +1737,20 @@ init_peripheral_ep(struct musb *musb, struct musb_ep 
*ep, u8 epnum, int is_in)
usb_ep_set_maxpacket_limit(&ep->end_point, 
hw_ep->max_packet_sz_tx);
else
usb_ep_set_maxpacket_limit(&ep->end_point, 
hw_ep->max_packet_sz_rx);
+   ep->end_point.caps.type_iso = true;
+   ep->end_point.caps.type_bulk = true;
+   ep->end_point.caps.type_int = true;
ep->end_point.ops = &musb_ep_ops;
list_add_tail(&ep->end_point.ep_list, &musb->g.ep_list);
}
+
+   if (!epnum || hw_ep->is_shared_fifo) {
+   ep->end_point.caps.dir_in = true;
+   ep->end_point.caps.dir_out = true;
+   } else if (is_in)
+   ep->end_point.caps.dir_in = true;
+   else
+   ep->end_point.caps.dir_out = true;
 }
 
 /*
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] suspend: make sync() on suspend-to-RAM optional

2015-07-14 Thread Pavel Machek
On Tue 2015-07-14 22:24:51, Len Brown wrote:
> From: Len Brown 
> 
> The Linux kernel suspend path has traditionally invoked sys_sync().
> 
> But sys_sync() can be expensive, and some systems do not want
> to pay the cost of sys_sync() on every suspend.

Have you measured how expesive it can be, and why it is expensive?

> So make sys_sync on suspend optional.
> 
> Create sysfs attribute /sys/power/pm_suspend_do_sync.
> When set to 1, the kernel will sys_sync() on suspend,
> When set to 0, it will not.
> 
> This attribute can be changed by root at run-time.
> Kernel build parameter CONFIG_PM_SUSPEND_DO_SYNC_DEFAULT.
> As this is 1, by default, this patch does not change
> default behavior.

Why do you need CONFIG parameter?


Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 35/46] usb: renesas: gadget: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/renesas_usbhs/mod_gadget.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c 
b/drivers/usb/renesas_usbhs/mod_gadget.c
index dc2aa32..ed8d890 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -1041,12 +1041,18 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
if (usbhsg_is_dcp(uep)) {
gpriv->gadget.ep0 = &uep->ep;
usb_ep_set_maxpacket_limit(&uep->ep, 64);
+   uep->ep.caps.type_control = true;
}
/* init normal pipe */
else {
usb_ep_set_maxpacket_limit(&uep->ep, 512);
+   uep->ep.caps.type_iso = true;
+   uep->ep.caps.type_bulk = true;
+   uep->ep.caps.type_int = true;
list_add_tail(&uep->ep.ep_list, &gpriv->gadget.ep_list);
}
+   uep->ep.caps.dir_in = true;
+   uep->ep.caps.dir_out = true;
}
 
ret = usb_add_gadget_udc(dev, &gpriv->gadget);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: perf: fuzzer triggered warning in intel_pmu_drain_pebs_nhm()

2015-07-14 Thread Stephane Eranian
On Fri, Jul 3, 2015 at 9:49 PM, Vince Weaver  wrote:
> On Fri, 3 Jul 2015, Peter Zijlstra wrote:
>
>> That said, its far too warm and I might just not be making sense.
>
> you need to come visit Maine!  Although I am not sure the cooler weather
> necessarily improves my kernel debugging skills.
>
> I managed to lock the machine (again this is with the patch applied).
>
I can reproduce the problem on my HSW running the fuzzer.

I can see why this could be happening if you are mixing PEBS and non PEBS events
in the bottom 4 counters. I suspect:
for (bit = 0; bit < x86_pmu.max_pebs_events; bit++) {
if ((counts[bit] == 0) && (error[bit] == 0))
continue;

This test is not correct when you have non-PEBS events mixed with PEBS
events and
they overflow at the same time. They will have counts[i] != 0 but
error[i] == 0, and thus
you fall thru the loop and hit the assert. Or it is something along those lines.


> [  299.366027] [ cut here ]
> [  299.370985] WARNING: CPU: 2 PID: 8241 at 
> arch/x86/kernel/cpu/perf_event_intel_ds.c:1198 
> intel_pmu_drain_pebs_nhm+0x283/0x2e0()
> [  299.456929] CPU: 2 PID: 8241 Comm: perf_fuzzer Tainted: GW   
> 4.1.0+ #164
> [  299.465750] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 
> 01/26/2014
> [  299.474274]  81a105a0 88011ea85b10 8169f823 
> 
> [  299.482864]   88011ea85b50 8106ec8a 
> 88011ea85ba0
> [  299.491488]   0001 88011ea8bd80 
> 8801190400c0
> [  299.500029] Call Trace:
> [  299.503190][] dump_stack+0x45/0x57
> [  299.509936]  [] warn_slowpath_common+0x8a/0xc0
> [  299.516901]  [] warn_slowpath_null+0x1a/0x20
> [  299.523715]  [] intel_pmu_drain_pebs_nhm+0x283/0x2e0
> [  299.531268]  [] intel_pmu_handle_irq+0x255/0x440
> [  299.538487]  [] perf_event_nmi_handler+0x26/0x40
> [  299.545638]  [] nmi_handle+0x9d/0x140
> [  299.551772]  [] ? nmi_handle+0x5/0x140
> [  299.558013]  [] default_do_nmi+0x4a/0x120
> [  299.564527]  [] do_nmi+0x8d/0xc0
> [  299.570185]  [] end_repeat_nmi+0x1e/0x2e
> [  299.576580]  [] ? check_poison_obj+0x92/0x230
> [  299.583390]  [] ? check_poison_obj+0x92/0x230
> [  299.590163]  [] ? check_poison_obj+0x92/0x230
> [  299.596922]  <>  [] ? perf_event_alloc+0x58/0x680
> [  299.604594]  [] 
> cache_alloc_debugcheck_after.isra.51+0x1cd/0x250
> [  299.613140]  [] kmem_cache_alloc_trace+0xa6/0x510
> [  299.620330]  [] ? perf_event_alloc+0x58/0x680
> [  299.627088]  [] ? get_online_cpus+0x58/0x70
> [  299.633688]  [] perf_event_alloc+0x58/0x680
> [  299.640319]  [] SYSC_perf_event_open+0x3c7/0xd40
> [  299.647353]  [] ? __do_page_fault+0x1ab/0x3f0
> [  299.654172]  [] SyS_perf_event_open+0x9/0x10
> [  299.660871]  [] entry_SYSCALL_64_fastpath+0x16/0x7a
> [  299.668236] ---[ end trace 3356c74581c13f1d ]---
> [  299.673648] Uhhuh. NMI received for unknown reason 31 on CPU 2.
> [  299.680427] Do you have a strange power saving mode enabled?
> [  299.686963] Dazed and confused, but trying to continue
> [  299.692904] Uhhuh. NMI received for unknown reason 31 on CPU 2.
> [  299.699748] Do you have a strange power saving mode enabled?
> [  299.706227] Dazed and confused, but trying to continue
> [  299.712172] Uhhuh. NMI received for unknown reason 31 on CPU 2.
> [  299.718946] Do you have a strange power saving mode enabled?
> [  299.725446] Dazed and confused, but trying to continue
> [  299.731419] Uhhuh. NMI received for unknown reason 31 on CPU 2.
> [  299.738235] Do you have a strange power saving mode enabled?
> [  299.744740] Dazed and confused, but trying to continue
> [  299.750660] Uhhuh. NMI received for unknown reason 21 on CPU 2.
> [  299.757398] Do you have a strange power saving mode enabled?
> [  299.763862] Dazed and confused, but trying to continue
>
> (machine eventually locks up after lots of these messages)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 40/46] usb: gadget: epautoconf: rework ep_matches() function

2015-07-14 Thread Robert Baldyga
Rework ep_matches() function to make it shorter and more readable.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 87 +
 1 file changed, 35 insertions(+), 52 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 7bb28f1..4fa6f5d 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -30,16 +30,29 @@ ep_matches (
struct usb_ss_ep_comp_descriptor *ep_comp
 )
 {
-   u8  type;
-   u16 max;
-
-   int num_req_streams = 0;
+   u8  type;
+   u16 max;
+   int num_req_streams = 0;
 
/* endpoint already claimed? */
if (ep->claimed)
return 0;
 
type = usb_endpoint_type(desc);
+   max = 0x7ff & usb_endpoint_maxp(desc);
+
+   if (usb_endpoint_dir_in(desc) && !ep->caps.dir_in)
+   return 0;
+   else if (!ep->caps.dir_out)
+   return 0;
+
+   if (max > ep->maxpacket_limit)
+   return 0;
+
+   /* "high bandwidth" works only at high speed */
+   if (!gadget_is_dualspeed(gadget) && usb_endpoint_maxp(desc) & (3<<11))
+   return 0;
+
switch (type) {
case USB_ENDPOINT_XFER_CONTROL:
/* only support ep0 for portable CONTROL traffic */
@@ -47,66 +60,36 @@ ep_matches (
case USB_ENDPOINT_XFER_ISOC:
if (!ep->caps.type_iso)
return 0;
+   /* ISO:  limit 1023 bytes full speed,
+* 1024 high/super speed
+*/
+   if (!gadget_is_dualspeed(gadget) && max > 1023)
+   return 0;
break;
case USB_ENDPOINT_XFER_BULK:
if (!ep->caps.type_bulk)
return 0;
+   if (ep_comp && gadget_is_superspeed(gadget)) {
+   /* Get the number of required streams from the
+* EP companion descriptor and see if the EP
+* matches it
+*/
+   num_req_streams = ep_comp->bmAttributes & 0x1f;
+   if (num_req_streams > ep->max_streams)
+   return 0;
+   }
break;
case USB_ENDPOINT_XFER_INT:
-   /* bulk endpoints handle interrupt transfers,
+   /* Bulk endpoints handle interrupt transfers,
 * except the toggle-quirky iso-synch kind
 */
if (!ep->caps.type_int && !ep->caps.type_bulk)
return 0;
-   break;
-   }
-
-   if (usb_endpoint_dir_in(desc)) {
-   if (!ep->caps.dir_in)
-   return 0;
-   } else {
-   if (!ep->caps.dir_out)
-   return 0;
-   }
-
-   /*
-* Get the number of required streams from the EP companion
-* descriptor and see if the EP matches it
-*/
-   if (usb_endpoint_xfer_bulk(desc)) {
-   if (ep_comp && gadget->max_speed >= USB_SPEED_SUPER) {
-   num_req_streams = ep_comp->bmAttributes & 0x1f;
-   if (num_req_streams > ep->max_streams)
-   return 0;
-   }
-
-   }
-
-   /* endpoint maxpacket size is an input parameter, except for bulk
-* where it's an output parameter representing the full speed limit.
-* the usb spec fixes high speed bulk maxpacket at 512 bytes.
-*/
-   max = 0x7ff & usb_endpoint_maxp(desc);
-   switch (type) {
-   case USB_ENDPOINT_XFER_INT:
-   /* INT:  limit 64 bytes full speed, 1024 high/super speed */
+   /* INT:  limit 64 bytes full speed,
+* 1024 high/super speed
+*/
if (!gadget_is_dualspeed(gadget) && max > 64)
return 0;
-   /* FALLTHROUGH */
-
-   case USB_ENDPOINT_XFER_ISOC:
-   /* ISO:  limit 1023 bytes full speed, 1024 high/super speed */
-   if (ep->maxpacket_limit < max)
-   return 0;
-   if (!gadget_is_dualspeed(gadget) && max > 1023)
-   return 0;
-
-   /* BOTH:  "high bandwidth" works only at high speed */
-   if ((desc->wMaxPacketSize & cpu_to_le16(3<<11))) {
-   if (!gadget_is_dualspeed(gadget))
-   return 0;
-   /* configure your hardware with enough buffering!! */
-   }
break;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ

Re: [PATCH 0/2] ARM-OMAP2+: Deletion of unnecessary checks before two function calls

2015-07-14 Thread Tony Lindgren
* SF Markus Elfring  [150625 04:35]:
> From: Markus Elfring 
> Date: Thu, 25 Jun 2015 13:24:35 +0200
> 
> Some functions which release a system resource tolerate the passing
> of a null pointer. I do not see a need because of this fact
> that a function caller repeats a corresponding check.
> 
> Markus Elfring (2):
>   Delete a check before the function call "omap_device_delete"
>   Delete a check before the function call "of_node_put"
> 
>  arch/arm/mach-omap2/omap_device.c | 3 +--
>  arch/arm/mach-omap2/timer.c   | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)

Applying both into omap-for-v4.3/soc thanks.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 7/8] mfd: pm8921: Implement irq_get_irqchip_state

2015-07-14 Thread Bjorn Andersson
Implement irq_chip->irq_get_irqchip_state to make it possible for PMIC
block drivers to access the IRQ real time status bits. The status bits
are used for various kinds of input signals, e.g. GPIO.

Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Drop extra check for !chip
- Simplify return value

 drivers/mfd/pm8921-core.c | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index 5a92646a2ccb..00856a67d34b 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -236,11 +236,49 @@ static int pm8xxx_irq_set_type(struct irq_data *d, 
unsigned int flow_type)
return pm8xxx_config_irq(chip, block, config);
 }
 
+static int pm8xxx_irq_get_irqchip_state(struct irq_data *d,
+   enum irqchip_irq_state which,
+   bool *state)
+{
+   struct pm_irq_chip *chip = irq_data_get_irq_chip_data(d);
+   unsigned int pmirq = irqd_to_hwirq(d);
+   unsigned int bits;
+   int irq_bit;
+   u8 block;
+   int rc;
+
+   if (which != IRQCHIP_STATE_LINE_LEVEL)
+   return -EINVAL;
+
+   block = pmirq / 8;
+   irq_bit = pmirq % 8;
+
+   spin_lock(&chip->pm_irq_lock);
+   rc = regmap_write(chip->regmap, SSBI_REG_ADDR_IRQ_BLK_SEL, block);
+   if (rc) {
+   pr_err("Failed Selecting Block %d rc=%d\n", block, rc);
+   goto bail;
+   }
+
+   rc = regmap_read(chip->regmap, SSBI_REG_ADDR_IRQ_RT_STATUS, &bits);
+   if (rc) {
+   pr_err("Failed Reading Status rc=%d\n", rc);
+   goto bail;
+   }
+
+   *state = !!(bits & BIT(irq_bit));
+bail:
+   spin_unlock(&chip->pm_irq_lock);
+
+   return rc;
+}
+
 static struct irq_chip pm8xxx_irq_chip = {
.name   = "pm8xxx",
.irq_mask_ack   = pm8xxx_irq_mask_ack,
.irq_unmask = pm8xxx_irq_unmask,
.irq_set_type   = pm8xxx_irq_set_type,
+   .irq_get_irqchip_state = pm8xxx_irq_get_irqchip_state,
.flags  = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_SKIP_SET_WAKE,
 };
 
-- 
1.8.2.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 8/8] pinctrl: qcom: ssbi: Family A gpio & mpp drivers

2015-07-14 Thread Bjorn Andersson
This introduces pinctrl drivers for gpio and mpp blocks found in family A
PMICs.

Tested-by: Srinivas Kandagatla  

   
Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Update platform_driver name
- Use of_device_get_match_data()

 .../devicetree/bindings/pinctrl/qcom,pmic-mpp.txt  |   5 +
 drivers/pinctrl/qcom/Kconfig   |  12 +
 drivers/pinctrl/qcom/Makefile  |   2 +
 drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c   | 791 ++
 drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c| 882 +
 include/dt-bindings/pinctrl/qcom,pmic-mpp.h|  51 ++
 6 files changed, 1743 insertions(+)
 create mode 100644 drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
 create mode 100644 drivers/pinctrl/qcom/pinctrl-ssbi-mpp.c

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
index b096d8351b8f..d7803a2a94e9 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
@@ -7,8 +7,13 @@ of PMIC's from Qualcomm.
Usage: required
Value type: 
Definition: Should contain one of:
+   "qcom,pm8018-mpp",
+   "qcom,pm8038-mpp",
+   "qcom,pm8821-mpp",
"qcom,pm8841-mpp",
"qcom,pm8916-mpp",
+   "qcom,pm8917-mpp",
+   "qcom,pm8921-mpp",
"qcom,pm8941-mpp",
"qcom,pma8084-mpp",
 
diff --git a/drivers/pinctrl/qcom/Kconfig b/drivers/pinctrl/qcom/Kconfig
index 58f5632b27f4..8eef820b216e 100644
--- a/drivers/pinctrl/qcom/Kconfig
+++ b/drivers/pinctrl/qcom/Kconfig
@@ -76,4 +76,16 @@ config PINCTRL_QCOM_SPMI_PMIC
  which are using SPMI for communication with SoC. Example PMIC's
  devices are pm8841, pm8941 and pma8084.
 
+config PINCTRL_QCOM_SSBI_PMIC
+   tristate "Qualcomm SSBI PMIC pin controller driver"
+   depends on GPIOLIB && OF
+   select PINMUX
+   select PINCONF
+   select GENERIC_PINCONF
+   help
+ This is the pinctrl, pinmux, pinconf and gpiolib driver for the
+ Qualcomm GPIO and MPP blocks found in the Qualcomm PMIC's chips,
+ which are using SSBI for communication with SoC. Example PMIC's
+ devices are pm8058 and pm8921.
+
 endif
diff --git a/drivers/pinctrl/qcom/Makefile b/drivers/pinctrl/qcom/Makefile
index 3666c703ce88..e321f7ab325b 100644
--- a/drivers/pinctrl/qcom/Makefile
+++ b/drivers/pinctrl/qcom/Makefile
@@ -9,3 +9,5 @@ obj-$(CONFIG_PINCTRL_MSM8X74)   += pinctrl-msm8x74.o
 obj-$(CONFIG_PINCTRL_MSM8916)  += pinctrl-msm8916.o
 obj-$(CONFIG_PINCTRL_QCOM_SPMI_PMIC) += pinctrl-spmi-gpio.o
 obj-$(CONFIG_PINCTRL_QCOM_SPMI_PMIC) += pinctrl-spmi-mpp.o
+obj-$(CONFIG_PINCTRL_QCOM_SSBI_PMIC) += pinctrl-ssbi-gpio.o
+obj-$(CONFIG_PINCTRL_QCOM_SSBI_PMIC) += pinctrl-ssbi-mpp.o
diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c 
b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
new file mode 100644
index ..c978b311031b
--- /dev/null
+++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
@@ -0,0 +1,791 @@
+/*
+ * Copyright (c) 2015, Sony Mobile Communications AB.
+ * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "../core.h"
+#include "../pinctrl-utils.h"
+
+/* mode */
+#define PM8XXX_GPIO_MODE_ENABLED   BIT(0)
+#define PM8XXX_GPIO_MODE_INPUT 0
+#define PM8XXX_GPIO_MODE_OUTPUT2
+
+/* output buffer */
+#define PM8XXX_GPIO_PUSH_PULL  0
+#define PM8XXX_GPIO_OPEN_DRAIN 1
+
+/* bias */
+#define PM8XXX_GPIO_BIAS_PU_30 0
+#define PM8XXX_GPIO_BIAS_PU_1P51
+#define PM8XXX_GPIO_BIAS_PU_31P5   2
+#define PM8XXX_GPIO_BIAS_PU_1P5_30 3
+#define PM8XXX_GPIO_BIAS_PD4
+#define PM8XXX_GPIO_BIAS_NP5
+
+/* GPIO registers */
+#define SSBI_REG_ADDR_GPIO_BASE0x150
+#define SSBI_REG_ADDR_GPIO(n)  (SSBI_REG_ADDR_GPIO_BASE + n)
+
+#define PM8XXX_BANK_WRITE  BIT(7)
+
+#define PM8XXX_MAX_GPIOS   44
+
+/* custom pinconf parameters */
+#define PM8XXX_QCOM_DRIVE_STRENGH  (

[PATCH v2 5/8] pinctrl: qcom: spmi-mpp: Add support for setting analog output level

2015-07-14 Thread Bjorn Andersson
When the MPP is configured for analog output the output level is selected by
the AOUT_CTL register, this patch makes it possible to control this.

Signed-off-by: Bjorn Andersson 
---

Changes since v1:
- Assign aout_level in pmic_mpp_populate()

 .../devicetree/bindings/pinctrl/qcom,pmic-mpp.txt  |  7 +++
 drivers/pinctrl/qcom/pinctrl-spmi-mpp.c| 23 ++
 2 files changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
index d29fb96a57d3..0e4d4e62e220 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.txt
@@ -127,6 +127,13 @@ to specify in a pin configuration subnode:
Definition: Selects the power source for the specified pins. Valid power
sources are defined in 
 
+- qcom,analog-level:
+   Usage: optional
+   Value type: 
+   Definition: Selects the source for analog output. Valued values are
+   defined in 
+   PMIC_MPP_AOUT_LVL_*
+
 - qcom,analog-mode:
Usage: optional
Value type: 
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c 
b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
index 9dde023640ba..e52a72348a67 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
@@ -61,6 +61,7 @@
 #define PMIC_MPP_REG_DIG_PULL_CTL  0x42
 #define PMIC_MPP_REG_DIG_IN_CTL0x43
 #define PMIC_MPP_REG_EN_CTL0x46
+#define PMIC_MPP_REG_AOUT_CTL  0x48
 #define PMIC_MPP_REG_AIN_CTL   0x4a
 #define PMIC_MPP_REG_SINK_CTL  0x4c
 
@@ -100,6 +101,7 @@
 #define PMIC_MPP_CONF_AMUX_ROUTE   (PIN_CONFIG_END + 1)
 #define PMIC_MPP_CONF_ANALOG_MODE  (PIN_CONFIG_END + 2)
 #define PMIC_MPP_CONF_SINK_MODE(PIN_CONFIG_END + 3)
+#define PMIC_MPP_CONF_ANALOG_LEVEL (PIN_CONFIG_END + 4)
 
 /**
  * struct pmic_mpp_pad - keep current MPP settings
@@ -115,6 +117,7 @@
  * @num_sources: Number of power-sources supported by this MPP.
  * @power_source: Current power-source used.
  * @amux_input: Set the source for analog input.
+ * @aout_level: Analog output level
  * @pullup: Pullup resistor value. Valid in Bidirectional mode only.
  * @function: See pmic_mpp_functions[].
  * @drive_strength: Amount of current in sink mode
@@ -131,6 +134,7 @@ struct pmic_mpp_pad {
unsigned intnum_sources;
unsigned intpower_source;
unsigned intamux_input;
+   unsigned intaout_level;
unsigned intpullup;
unsigned intfunction;
unsigned intdrive_strength;
@@ -145,6 +149,7 @@ struct pmic_mpp_state {
 
 static const struct pinconf_generic_params pmic_mpp_bindings[] = {
{"qcom,amux-route", PMIC_MPP_CONF_AMUX_ROUTE,   0},
+   {"qcom,analog-level",   PMIC_MPP_CONF_ANALOG_LEVEL, 0},
{"qcom,analog-mode",PMIC_MPP_CONF_ANALOG_MODE,  0},
{"qcom,sink-mode",  PMIC_MPP_CONF_SINK_MODE,0},
 };
@@ -152,6 +157,7 @@ static const struct pinconf_generic_params 
pmic_mpp_bindings[] = {
 #ifdef CONFIG_DEBUG_FS
 static const struct pin_config_item pmic_conf_items[] = {
PCONFDUMP(PMIC_MPP_CONF_AMUX_ROUTE, "analog mux", NULL, true),
+   PCONFDUMP(PMIC_MPP_CONF_ANALOG_LEVEL, "analog level", NULL, true),
PCONFDUMP(PMIC_MPP_CONF_ANALOG_MODE, "analog output", NULL, false),
PCONFDUMP(PMIC_MPP_CONF_SINK_MODE, "sink mode", NULL, false),
 };
@@ -358,6 +364,9 @@ static int pmic_mpp_config_get(struct pinctrl_dev *pctldev,
case PIN_CONFIG_DRIVE_STRENGTH:
arg = pad->drive_strength;
break;
+   case PMIC_MPP_CONF_ANALOG_LEVEL:
+   arg = pad->aout_level;
+   break;
case PMIC_MPP_CONF_ANALOG_MODE:
arg = pad->analog_mode;
break;
@@ -433,6 +442,9 @@ static int pmic_mpp_config_set(struct pinctrl_dev *pctldev, 
unsigned int pin,
return -EINVAL;
pad->amux_input = arg;
break;
+   case PMIC_MPP_CONF_ANALOG_LEVEL:
+   pad->aout_level = arg;
+   break;
case PMIC_MPP_CONF_ANALOG_MODE:
pad->analog_mode = !!arg;
break;
@@ -462,6 +474,10 @@ static int pmic_mpp_config_set(struct pinctrl_dev 
*pctldev, unsigned int pin,
if (ret < 0)
return ret;
 
+   ret = pmic_mpp_write(state, pad, PMIC_MPP_REG_AOUT_CTL, 
pad->aout_level);
+   if (ret < 0)
+   return ret;
+
ret = pmic_mpp_write_mode_ctl(state, pad);
if (ret < 0)
return ret;
@@ -507,6 +523,7 @@ static void pmic_mpp_config_dbg_show(struc

[PATCH v3 41/46] usb: gadget: add 'ep_match' callback to usb_gadget_ops

2015-07-14 Thread Robert Baldyga
Add callback that is called by epautoconf to allow UDC driver match the
best endpoint for specific descriptor. It's intended to supply mechanism
which allows to get rid of chip-specific endpoint matching code from
epautoconf.

If gadget has set 'ep_match' callback we prefer to call it first, and
if it fails to find matching endpoint, then we try to use default matching
algorithm.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 6 ++
 include/linux/usb/gadget.h  | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 4fa6f5d..1b1fee0 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -165,6 +165,12 @@ struct usb_ep *usb_ep_autoconfig_ss(
 
type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
 
+   if (gadget->ops->match_ep) {
+   ep = gadget->ops->match_ep(gadget, desc, ep_comp);
+   if (ep)
+   goto found_ep;
+   }
+
/* First, apply chip-specific "best usage" knowledge.
 * This might make a good usb_gadget_ops hook ...
 */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e6cbc25..0041bb9 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -534,6 +534,9 @@ struct usb_gadget_ops {
int (*udc_start)(struct usb_gadget *,
struct usb_gadget_driver *);
int (*udc_stop)(struct usb_gadget *);
+   struct usb_ep *(*match_ep)(struct usb_gadget *,
+   struct usb_endpoint_descriptor *,
+   struct usb_ss_ep_comp_descriptor *);
 };
 
 /**
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 45/46] usb: gadget: goku_udc: add goku_match_ep() function

2015-07-14 Thread Robert Baldyga
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching
process. Function does the same that was done by chip-specific code inside
of epautoconf. Now this code can be removed from there to separate generic code
from platform specific logic.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c   | 20 ++--
 drivers/usb/gadget/udc/goku_udc.c | 25 +
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index d41fd82..da45371 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -86,24 +86,8 @@ struct usb_ep *usb_ep_autoconfig_ss(
/* First, apply chip-specific "best usage" knowledge.
 * This might make a good usb_gadget_ops hook ...
 */
-   if (gadget_is_goku (gadget)) {
-   if (USB_ENDPOINT_XFER_INT == type) {
-   /* single buffering is enough */
-   ep = gadget_find_ep_by_name(gadget, "ep3-bulk");
-   if (ep && usb_gadget_ep_match_desc(gadget,
-   ep, desc, ep_comp))
-   goto found_ep;
-   } else if (USB_ENDPOINT_XFER_BULK == type
-   && (USB_DIR_IN & desc->bEndpointAddress)) {
-   /* DMA may be available */
-   ep = gadget_find_ep_by_name(gadget, "ep2-bulk");
-   if (ep && usb_gadget_ep_match_desc(gadget,
-   ep, desc, ep_comp))
-   goto found_ep;
-   }
-
 #ifdef CONFIG_BLACKFIN
-   } else if (gadget_is_musbhdrc(gadget)) {
+   if (gadget_is_musbhdrc(gadget)) {
if ((USB_ENDPOINT_XFER_BULK == type) ||
(USB_ENDPOINT_XFER_ISOC == type)) {
if (USB_DIR_IN & desc->bEndpointAddress)
@@ -119,8 +103,8 @@ struct usb_ep *usb_ep_autoconfig_ss(
ep = NULL;
if (ep && usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
goto found_ep;
-#endif
}
+#endif
 
/* Second, look at endpoints until an unclaimed one looks usable */
list_for_each_entry (ep, &gadget->ep_list, ep_list) {
diff --git a/drivers/usb/gadget/udc/goku_udc.c 
b/drivers/usb/gadget/udc/goku_udc.c
index 46b8d14..d5a93ea 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -990,6 +990,30 @@ static int goku_get_frame(struct usb_gadget *_gadget)
return -EOPNOTSUPP;
 }
 
+static struct usb_ep *goku_match_ep(struct usb_gadget *g,
+   struct usb_endpoint_descriptor *desc,
+   struct usb_ss_ep_comp_descriptor *ep_comp)
+{
+   struct goku_udc *dev = to_goku_udc(g);
+   struct usb_ep *ep;
+   u8 type = usb_endpoint_type(desc);
+
+   if (type == USB_ENDPOINT_XFER_INT) {
+   /* single buffering is enough */
+   ep = &dev->ep[3].ep;
+   if (ep && usb_gadget_ep_match_desc(g, ep, desc, ep_comp))
+   return ep;
+   } else if (type == USB_ENDPOINT_XFER_BULK
+   && usb_endpoint_dir_in(desc)) {
+   /* DMA may be available */
+   ep = &dev->ep[2].ep;
+   if (ep && usb_gadget_ep_match_desc(g, ep, desc, ep_comp))
+   return ep;
+   }
+
+   return NULL;
+}
+
 static int goku_udc_start(struct usb_gadget *g,
struct usb_gadget_driver *driver);
 static int goku_udc_stop(struct usb_gadget *g);
@@ -998,6 +1022,7 @@ static const struct usb_gadget_ops goku_ops = {
.get_frame  = goku_get_frame,
.udc_start  = goku_udc_start,
.udc_stop   = goku_udc_stop,
+   .match_ep   = goku_match_ep,
// no remote wakeup
// not selfpowered
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 43/46] usb: gadget: move find_ep() from epautoconf to gadget.h

2015-07-14 Thread Robert Baldyga
Move find_ep() function to gadget.h, rename it to gadget_find_ep_by_name()
and make it static inline. It can be used in UDC drivers, especially in
'match_ep' callback after moving chip-specific endpoint matching logic from
epautoconf to UDC drivers.

Replace all calls of find_ep() function with gadget_find_ep_by_name().

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 30 +-
 include/linux/usb/gadget.h  | 18 ++
 2 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 3f0a380..cc0b084 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -22,18 +22,6 @@
 
 #include "gadget_chips.h"
 
-static struct usb_ep *
-find_ep (struct usb_gadget *gadget, const char *name)
-{
-   struct usb_ep   *ep;
-
-   list_for_each_entry (ep, &gadget->ep_list, ep_list) {
-   if (0 == strcmp (ep->name, name))
-   return ep;
-   }
-   return NULL;
-}
-
 /**
  * usb_ep_autoconfig_ss() - choose an endpoint matching the ep
  * descriptor and ep companion descriptor
@@ -103,11 +91,11 @@ struct usb_ep *usb_ep_autoconfig_ss(
 
if (type == USB_ENDPOINT_XFER_INT) {
/* ep-e, ep-f are PIO with only 64 byte fifos */
-   ep = find_ep(gadget, "ep-e");
+   ep = gadget_find_ep_by_name(gadget, "ep-e");
if (ep && usb_gadget_ep_match_desc(gadget,
ep, desc, ep_comp))
goto found_ep;
-   ep = find_ep(gadget, "ep-f");
+   ep = gadget_find_ep_by_name(gadget, "ep-f");
if (ep && usb_gadget_ep_match_desc(gadget,
ep, desc, ep_comp))
goto found_ep;
@@ -116,20 +104,20 @@ struct usb_ep *usb_ep_autoconfig_ss(
/* USB3380: use same address for usb and hardware endpoints */
snprintf(name, sizeof(name), "ep%d%s", usb_endpoint_num(desc),
usb_endpoint_dir_in(desc) ? "in" : "out");
-   ep = find_ep(gadget, name);
+   ep = gadget_find_ep_by_name(gadget, name);
if (ep && usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
goto found_ep;
} else if (gadget_is_goku (gadget)) {
if (USB_ENDPOINT_XFER_INT == type) {
/* single buffering is enough */
-   ep = find_ep(gadget, "ep3-bulk");
+   ep = gadget_find_ep_by_name(gadget, "ep3-bulk");
if (ep && usb_gadget_ep_match_desc(gadget,
ep, desc, ep_comp))
goto found_ep;
} else if (USB_ENDPOINT_XFER_BULK == type
&& (USB_DIR_IN & desc->bEndpointAddress)) {
/* DMA may be available */
-   ep = find_ep(gadget, "ep2-bulk");
+   ep = gadget_find_ep_by_name(gadget, "ep2-bulk");
if (ep && usb_gadget_ep_match_desc(gadget,
ep, desc, ep_comp))
goto found_ep;
@@ -140,14 +128,14 @@ struct usb_ep *usb_ep_autoconfig_ss(
if ((USB_ENDPOINT_XFER_BULK == type) ||
(USB_ENDPOINT_XFER_ISOC == type)) {
if (USB_DIR_IN & desc->bEndpointAddress)
-   ep = find_ep (gadget, "ep5in");
+   ep = gadget_find_ep_by_name(gadget, "ep5in");
else
-   ep = find_ep (gadget, "ep6out");
+   ep = gadget_find_ep_by_name(gadget, "ep6out");
} else if (USB_ENDPOINT_XFER_INT == type) {
if (USB_DIR_IN & desc->bEndpointAddress)
-   ep = find_ep(gadget, "ep1in");
+   ep = gadget_find_ep_by_name(gadget, "ep1in");
else
-   ep = find_ep(gadget, "ep2out");
+   ep = gadget_find_ep_by_name(gadget, "ep2out");
} else
ep = NULL;
if (ep && usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 77e2c1e..42e951b 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -629,6 +629,24 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct 
device *dev)
 #define gadget_for_each_ep(tmp, gadget) \
list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
 
+/**
+ * gadget_find_ep_by_name - returns ep whose name is the same as sting passed

[PATCH] clk: mediatek: Export CPU mux clocks for CPU frequency control

2015-07-14 Thread Pi-Cheng Chen
From: "pi-cheng.chen" 

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver
for intermediate clock source switching.

Signed-off-by: Pi-Cheng Chen 
Reviewed-by: Daniel Kurtz 
---
Changes in v4:
- Address comments for v3
- Rebase to the patch that adds 13mhz clock for MT8173[1]

Changes in v3:
- Rebase to 4.2-rc1
- Fix some issues of v2

Changes in v2:
- Remove use of .determine_rate callback

[1] http://patchwork.kernerl.xyz/patch/6777041/
---
 drivers/clk/mediatek/Makefile  |   2 +-
 drivers/clk/mediatek/clk-cpumux.c  | 127 +
 drivers/clk/mediatek/clk-cpumux.h  |  22 ++
 drivers/clk/mediatek/clk-mt8173.c  |  23 ++
 include/dt-bindings/clock/mt8173-clk.h |   4 +-
 5 files changed, 176 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-cpumux.c
 create mode 100644 drivers/clk/mediatek/clk-cpumux.h

diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index 8e4b2a4..299917a 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -1,4 +1,4 @@
-obj-y += clk-mtk.o clk-pll.o clk-gate.o
+obj-y += clk-mtk.o clk-pll.o clk-gate.o clk-cpumux.o
 obj-$(CONFIG_RESET_CONTROLLER) += reset.o
 obj-y += clk-mt8135.o
 obj-y += clk-mt8173.o
diff --git a/drivers/clk/mediatek/clk-cpumux.c 
b/drivers/clk/mediatek/clk-cpumux.c
new file mode 100644
index 000..fb04fe1
--- /dev/null
+++ b/drivers/clk/mediatek/clk-cpumux.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2015 Linaro Ltd.
+ * Author: Pi-Cheng Chen 
+ *
+ * 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 in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+
+#include "clk-mtk.h"
+#include "clk-cpumux.h"
+
+struct mtk_clk_cpumux {
+   struct clk_hw   hw;
+   struct regmap   *regmap;
+   u32 reg;
+   u32 mask;
+   u8  shift;
+};
+
+static inline struct mtk_clk_cpumux *to_clk_mux(struct clk_hw *_hw)
+{
+   return container_of(_hw, struct mtk_clk_cpumux, hw);
+}
+
+static u8 clk_cpumux_get_parent(struct clk_hw *hw)
+{
+   struct mtk_clk_cpumux *mux = to_clk_mux(hw);
+   int num_parents = __clk_get_num_parents(hw->clk);
+   unsigned int val;
+
+   regmap_read(mux->regmap, mux->reg, &val);
+
+   val >>= mux->shift;
+   val &= mux->mask;
+
+   if (val >= num_parents)
+   return -EINVAL;
+
+   return val;
+}
+
+static int clk_cpumux_set_parent(struct clk_hw *hw, u8 index)
+{
+   struct mtk_clk_cpumux *mux = to_clk_mux(hw);
+   u32 mask, val;
+
+   val = index << mux->shift;
+   mask = mux->mask << mux->shift;
+
+   return regmap_update_bits(mux->regmap, mux->reg, mask, val);
+}
+
+static const struct clk_ops clk_cpumux_ops = {
+   .get_parent = clk_cpumux_get_parent,
+   .set_parent = clk_cpumux_set_parent,
+};
+
+static struct clk __init *mtk_clk_register_cpumux(const struct mtk_composite 
*mux,
+  struct regmap *regmap)
+{
+   struct mtk_clk_cpumux *cpumux;
+   struct clk *clk;
+   struct clk_init_data init;
+
+   cpumux = kzalloc(sizeof(*cpumux), GFP_KERNEL);
+   if (!cpumux)
+   return ERR_PTR(-ENOMEM);
+
+   init.name = mux->name;
+   init.ops = &clk_cpumux_ops;
+   init.parent_names = mux->parent_names;
+   init.num_parents = mux->num_parents;
+   init.flags = mux->flags;
+
+   cpumux->reg = mux->mux_reg;
+   cpumux->shift = mux->mux_shift;
+   cpumux->mask = BIT(mux->mux_width) - 1;
+   cpumux->regmap = regmap;
+   cpumux->hw.init = &init;
+
+   clk = clk_register(NULL, &cpumux->hw);
+   if (IS_ERR(clk))
+   kfree(cpumux);
+
+   return clk;
+}
+
+int __init mtk_clk_register_cpumuxes(struct device_node *node,
+ const struct mtk_composite *clks, int num,
+ struct clk_onecell_data *clk_data)
+{
+   int i;
+   struct clk *clk;
+   struct regmap *regmap;
+
+   regmap = syscon_node_to_regmap(node);
+   if (IS_ERR(regmap)) {
+   pr_err("Cannot find regmap for %s: %ld\n", node->full_name,
+  PTR_ERR(regmap));
+   return PTR_ERR(regmap);
+   }
+
+   for (i = 0; i < num; i++) {
+   const struct mtk_composite *mux = &clks[i];
+
+   clk = mtk_clk_register_cpumux(mux, regmap);
+   if (IS_ERR(clk)) {
+   pr_err("Failed to register clk %s: %ld\n",
+  mux->name, PTR_ERR(clk));
+

[PATCH v3 46/46] usb: musb: gadget: add musb_match_ep() function

2015-07-14 Thread Robert Baldyga
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching
process. Function does the same that was done by chip-specific code inside
of epautoconf. Now this code can be removed from there to separate generic code
from platform specific logic.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 23 ---
 drivers/usb/musb/musb_gadget.c  | 34 ++
 2 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index da45371..254ece7 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -83,29 +83,6 @@ struct usb_ep *usb_ep_autoconfig_ss(
goto found_ep;
}
 
-   /* First, apply chip-specific "best usage" knowledge.
-* This might make a good usb_gadget_ops hook ...
-*/
-#ifdef CONFIG_BLACKFIN
-   if (gadget_is_musbhdrc(gadget)) {
-   if ((USB_ENDPOINT_XFER_BULK == type) ||
-   (USB_ENDPOINT_XFER_ISOC == type)) {
-   if (USB_DIR_IN & desc->bEndpointAddress)
-   ep = gadget_find_ep_by_name(gadget, "ep5in");
-   else
-   ep = gadget_find_ep_by_name(gadget, "ep6out");
-   } else if (USB_ENDPOINT_XFER_INT == type) {
-   if (USB_DIR_IN & desc->bEndpointAddress)
-   ep = gadget_find_ep_by_name(gadget, "ep1in");
-   else
-   ep = gadget_find_ep_by_name(gadget, "ep2out");
-   } else
-   ep = NULL;
-   if (ep && usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
-   goto found_ep;
-   }
-#endif
-
/* Second, look at endpoints until an unclaimed one looks usable */
list_for_each_entry (ep, &gadget->ep_list, ep_list) {
if (usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 043248a..3a64cf2 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1684,6 +1684,39 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, 
int is_on)
return 0;
 }
 
+#ifdef CONFIG_BLACKFIN
+static struct usb_ep *musb_match_ep(struct usb_gadget *g,
+   struct usb_endpoint_descriptor *desc,
+   struct usb_ss_ep_comp_descriptor *ep_comp)
+{
+   struct usb_ep *ep = NULL;
+   u8 type = usb_endpoint_type(desc);
+
+   switch(type) {
+   case USB_ENDPOINT_XFER_ISOC:
+   case USB_ENDPOINT_XFER_BULK:
+   if (usb_endpoint_dir_in(desc))
+   ep = gadget_find_ep_by_name(g, "ep5in");
+   else
+   ep = gadget_find_ep_by_name(g, "ep6out");
+   break;
+   case USB_ENDPOINT_XFER_INT:
+   if (usb_endpoint_dir_in(desc))
+   ep = gadget_find_ep_by_name(g, "ep1in");
+   else
+   ep = gadget_find_ep_by_name(g, "ep2out");
+   default:
+   }
+
+   if (ep && usb_gadget_ep_match_desc(g, ep, desc, ep_comp))
+   return ep;
+
+   return NULL;
+}
+#else
+#define musb_match_ep NULL
+#endif
+
 static int musb_gadget_start(struct usb_gadget *g,
struct usb_gadget_driver *driver);
 static int musb_gadget_stop(struct usb_gadget *g);
@@ -1697,6 +1730,7 @@ static const struct usb_gadget_ops musb_gadget_operations 
= {
.pullup = musb_gadget_pullup,
.udc_start  = musb_gadget_start,
.udc_stop   = musb_gadget_stop,
+   .match_ep   = musb_match_ep,
 };
 
 /* --- */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 39/46] usb: gadget: epautoconf: remove ep and desc configuration from ep_matches()

2015-07-14 Thread Robert Baldyga
As function ep_matches() is used to match endpoint with usb descriptor it's
highly unintuitive that it modifies endpoint and descriptor structures fields.
This patch moves code configuring ep and desc from ep_matches() to
usb_ep_autoconfig_ss(), so now function ep_matches() does nothing more than
its name suggests.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 66 +
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 4f66e9d73..7bb28f1 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -82,13 +82,6 @@ ep_matches (
 
}
 
-   /*
-* If the protocol driver hasn't yet decided on wMaxPacketSize
-* and wants to know the maximum possible, provide the info.
-*/
-   if (desc->wMaxPacketSize == 0)
-   desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket_limit);
-
/* endpoint maxpacket size is an input parameter, except for bulk
 * where it's an output parameter representing the full speed limit.
 * the usb spec fixes high speed bulk maxpacket at 512 bytes.
@@ -119,31 +112,6 @@ ep_matches (
 
/* MATCH!! */
 
-   /* report address */
-   desc->bEndpointAddress &= USB_DIR_IN;
-   if (isdigit (ep->name [2])) {
-   u8  num = simple_strtoul (&ep->name [2], NULL, 10);
-   desc->bEndpointAddress |= num;
-   } else if (desc->bEndpointAddress & USB_DIR_IN) {
-   if (++gadget->in_epnum > 15)
-   return 0;
-   desc->bEndpointAddress = USB_DIR_IN | gadget->in_epnum;
-   } else {
-   if (++gadget->out_epnum > 15)
-   return 0;
-   desc->bEndpointAddress |= gadget->out_epnum;
-   }
-
-   /* report (variable) full speed bulk maxpacket */
-   if ((USB_ENDPOINT_XFER_BULK == type) && !ep_comp) {
-   int size = ep->maxpacket_limit;
-
-   /* min() doesn't work on bitfields with gcc-3.5 */
-   if (size > 64)
-   size = 64;
-   desc->wMaxPacketSize = cpu_to_le16(size);
-   }
-   ep->address = desc->bEndpointAddress;
return 1;
 }
 
@@ -280,6 +248,40 @@ struct usb_ep *usb_ep_autoconfig_ss(
/* Fail */
return NULL;
 found_ep:
+
+   /*
+* If the protocol driver hasn't yet decided on wMaxPacketSize
+* and wants to know the maximum possible, provide the info.
+*/
+   if (desc->wMaxPacketSize == 0)
+   desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket_limit);
+
+   /* report address */
+   desc->bEndpointAddress &= USB_DIR_IN;
+   if (isdigit(ep->name[2])) {
+   u8 num = simple_strtoul(&ep->name[2], NULL, 10);
+   desc->bEndpointAddress |= num;
+   } else if (desc->bEndpointAddress & USB_DIR_IN) {
+   if (++gadget->in_epnum > 15)
+   return 0;
+   desc->bEndpointAddress = USB_DIR_IN | gadget->in_epnum;
+   } else {
+   if (++gadget->out_epnum > 15)
+   return 0;
+   desc->bEndpointAddress |= gadget->out_epnum;
+   }
+
+   /* report (variable) full speed bulk maxpacket */
+   if ((type == USB_ENDPOINT_XFER_BULK) && !ep_comp) {
+   int size = ep->maxpacket_limit;
+
+   /* min() doesn't work on bitfields with gcc-3.5 */
+   if (size > 64)
+   size = 64;
+   desc->wMaxPacketSize = cpu_to_le16(size);
+   }
+
+   ep->address = desc->bEndpointAddress;
ep->desc = NULL;
ep->comp_desc = NULL;
ep->claimed = true;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 42/46] usb: gadget: move ep_matches() from epautoconf to udc-core

2015-07-14 Thread Robert Baldyga
Move ep_matches() function to udc-core and rename it to
usb_gadget_ep_match_desc(). This function can be used by UDC drivers
in 'match_ep' callback to avoid writing lots of repetitive code.

Replace all calls of ep_matches() with usb_gadget_ep_match_desc().

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c   | 95 +--
 drivers/usb/gadget/udc/udc-core.c | 69 
 include/linux/usb/gadget.h|  8 
 3 files changed, 88 insertions(+), 84 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 1b1fee0..3f0a380 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -22,82 +22,6 @@
 
 #include "gadget_chips.h"
 
-static int
-ep_matches (
-   struct usb_gadget   *gadget,
-   struct usb_ep   *ep,
-   struct usb_endpoint_descriptor  *desc,
-   struct usb_ss_ep_comp_descriptor *ep_comp
-)
-{
-   u8  type;
-   u16 max;
-   int num_req_streams = 0;
-
-   /* endpoint already claimed? */
-   if (ep->claimed)
-   return 0;
-
-   type = usb_endpoint_type(desc);
-   max = 0x7ff & usb_endpoint_maxp(desc);
-
-   if (usb_endpoint_dir_in(desc) && !ep->caps.dir_in)
-   return 0;
-   else if (!ep->caps.dir_out)
-   return 0;
-
-   if (max > ep->maxpacket_limit)
-   return 0;
-
-   /* "high bandwidth" works only at high speed */
-   if (!gadget_is_dualspeed(gadget) && usb_endpoint_maxp(desc) & (3<<11))
-   return 0;
-
-   switch (type) {
-   case USB_ENDPOINT_XFER_CONTROL:
-   /* only support ep0 for portable CONTROL traffic */
-   return 0;
-   case USB_ENDPOINT_XFER_ISOC:
-   if (!ep->caps.type_iso)
-   return 0;
-   /* ISO:  limit 1023 bytes full speed,
-* 1024 high/super speed
-*/
-   if (!gadget_is_dualspeed(gadget) && max > 1023)
-   return 0;
-   break;
-   case USB_ENDPOINT_XFER_BULK:
-   if (!ep->caps.type_bulk)
-   return 0;
-   if (ep_comp && gadget_is_superspeed(gadget)) {
-   /* Get the number of required streams from the
-* EP companion descriptor and see if the EP
-* matches it
-*/
-   num_req_streams = ep_comp->bmAttributes & 0x1f;
-   if (num_req_streams > ep->max_streams)
-   return 0;
-   }
-   break;
-   case USB_ENDPOINT_XFER_INT:
-   /* Bulk endpoints handle interrupt transfers,
-* except the toggle-quirky iso-synch kind
-*/
-   if (!ep->caps.type_int && !ep->caps.type_bulk)
-   return 0;
-   /* INT:  limit 64 bytes full speed,
-* 1024 high/super speed
-*/
-   if (!gadget_is_dualspeed(gadget) && max > 64)
-   return 0;
-   break;
-   }
-
-   /* MATCH!! */
-
-   return 1;
-}
-
 static struct usb_ep *
 find_ep (struct usb_gadget *gadget, const char *name)
 {
@@ -180,10 +104,12 @@ struct usb_ep *usb_ep_autoconfig_ss(
if (type == USB_ENDPOINT_XFER_INT) {
/* ep-e, ep-f are PIO with only 64 byte fifos */
ep = find_ep(gadget, "ep-e");
-   if (ep && ep_matches(gadget, ep, desc, ep_comp))
+   if (ep && usb_gadget_ep_match_desc(gadget,
+   ep, desc, ep_comp))
goto found_ep;
ep = find_ep(gadget, "ep-f");
-   if (ep && ep_matches(gadget, ep, desc, ep_comp))
+   if (ep && usb_gadget_ep_match_desc(gadget,
+   ep, desc, ep_comp))
goto found_ep;
}
 
@@ -191,20 +117,21 @@ struct usb_ep *usb_ep_autoconfig_ss(
snprintf(name, sizeof(name), "ep%d%s", usb_endpoint_num(desc),
usb_endpoint_dir_in(desc) ? "in" : "out");
ep = find_ep(gadget, name);
-   if (ep && ep_matches(gadget, ep, desc, ep_comp))
+   if (ep && usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
goto found_ep;
} else if (gadget_is_goku (gadget)) {
if (USB_ENDPOINT_XFER_INT == type) {
/* single buffering is enough */
ep = find_ep(gadget, "ep3-bulk");
-   if (ep && ep_matches(gadget, ep, desc, ep_comp))
+   if (ep && usb_gadget_ep_

[PATCH v3 36/46] usb: gadget: atmel_usba_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 37d414e..267d84f 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -2067,6 +2067,17 @@ static struct usba_ep * usba_udc_pdata(struct 
platform_device *pdev,
ep->can_dma = pdata->ep[i].can_dma;
ep->can_isoc = pdata->ep[i].can_isoc;
 
+   if (i == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = ep->can_isoc;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
+
if (i)
list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 44/46] usb: gadget: net2280: add net2280_match_ep() function

2015-07-14 Thread Robert Baldyga
Add 'match_ep' callback to utilize chip-specific knowledge in endpoint matching
process. Function does the same that was done by chip-specific code inside
of epautoconf. Now this code can be removed from there to separate generic code
from platform specific logic.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c  | 23 +--
 drivers/usb/gadget/udc/net2280.c | 31 +++
 2 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index cc0b084..d41fd82 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -86,28 +86,7 @@ struct usb_ep *usb_ep_autoconfig_ss(
/* First, apply chip-specific "best usage" knowledge.
 * This might make a good usb_gadget_ops hook ...
 */
-   if (gadget_is_net2280(gadget)) {
-   char name[8];
-
-   if (type == USB_ENDPOINT_XFER_INT) {
-   /* ep-e, ep-f are PIO with only 64 byte fifos */
-   ep = gadget_find_ep_by_name(gadget, "ep-e");
-   if (ep && usb_gadget_ep_match_desc(gadget,
-   ep, desc, ep_comp))
-   goto found_ep;
-   ep = gadget_find_ep_by_name(gadget, "ep-f");
-   if (ep && usb_gadget_ep_match_desc(gadget,
-   ep, desc, ep_comp))
-   goto found_ep;
-   }
-
-   /* USB3380: use same address for usb and hardware endpoints */
-   snprintf(name, sizeof(name), "ep%d%s", usb_endpoint_num(desc),
-   usb_endpoint_dir_in(desc) ? "in" : "out");
-   ep = gadget_find_ep_by_name(gadget, name);
-   if (ep && usb_gadget_ep_match_desc(gadget, ep, desc, ep_comp))
-   goto found_ep;
-   } else if (gadget_is_goku (gadget)) {
+   if (gadget_is_goku (gadget)) {
if (USB_ENDPOINT_XFER_INT == type) {
/* single buffering is enough */
ep = gadget_find_ep_by_name(gadget, "ep3-bulk");
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 0295cf7..41e6568 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -1533,6 +1533,36 @@ static int net2280_pullup(struct usb_gadget *_gadget, 
int is_on)
return 0;
 }
 
+static struct usb_ep *net2280_match_ep(struct usb_gadget *_gadget,
+   struct usb_endpoint_descriptor *desc,
+   struct usb_ss_ep_comp_descriptor *ep_comp)
+{
+   char name[8];
+   struct usb_ep *ep;
+   u8 type;
+
+   type = usb_endpoint_type(desc);
+
+   if (type == USB_ENDPOINT_XFER_INT) {
+   /* ep-e, ep-f are PIO with only 64 byte fifos */
+   ep = gadget_find_ep_by_name(_gadget, "ep-e");
+   if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
+   return ep;
+   ep = gadget_find_ep_by_name(_gadget, "ep-f");
+   if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
+   return ep;
+   }
+
+   /* USB3380: use same address for usb and hardware endpoints */
+   snprintf(name, sizeof(name), "ep%d%s", usb_endpoint_num(desc),
+   usb_endpoint_dir_in(desc) ? "in" : "out");
+   ep = gadget_find_ep_by_name(_gadget, name);
+   if (ep && usb_gadget_ep_match_desc(_gadget, ep, desc, ep_comp))
+   return ep;
+
+   return NULL;
+}
+
 static int net2280_start(struct usb_gadget *_gadget,
struct usb_gadget_driver *driver);
 static int net2280_stop(struct usb_gadget *_gadget);
@@ -1544,6 +1574,7 @@ static const struct usb_gadget_ops net2280_ops = {
.pullup = net2280_pullup,
.udc_start  = net2280_start,
.udc_stop   = net2280_stop,
+   .match_ep   = net2280_match_ep,
 };
 
 /*-*/
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 38/46] usb: gadget: epautoconf: remove pxa quirk from ep_matches()

2015-07-14 Thread Robert Baldyga
The same effect can be achieved by using capabilities flags, so now we can
get rid of handling of hardware specific limitations in generic code.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 5 -
 drivers/usb/gadget/udc/pxa25x_udc.c | 9 +++--
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index af4b10a..4f66e9d73 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -58,11 +58,6 @@ ep_matches (
 */
if (!ep->caps.type_int && !ep->caps.type_bulk)
return 0;
-   /* for now, avoid PXA "interrupt-in";
-* it's documented as never using DATA1.
-*/
-   if (gadget_is_pxa(gadget) && ep->caps.type_int)
-   return 0;
break;
}
 
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c 
b/drivers/usb/gadget/udc/pxa25x_udc.c
index 1301e29..f53e526 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -1898,8 +1898,7 @@ static struct pxa25x_udc memory = {
.name   = "ep5in-int",
.ops= &pxa25x_ep_ops,
.maxpacket  = INT_FIFO_SIZE,
-   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
-   USB_EP_CAPS_DIR_IN),
+   .caps   = USB_EP_CAPS(0, 0),
},
.dev= &memory,
.fifo_size  = INT_FIFO_SIZE,
@@ -1977,8 +1976,7 @@ static struct pxa25x_udc memory = {
.name   = "ep10in-int",
.ops= &pxa25x_ep_ops,
.maxpacket  = INT_FIFO_SIZE,
-   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
-   USB_EP_CAPS_DIR_IN),
+   .caps   = USB_EP_CAPS(0, 0),
},
.dev= &memory,
.fifo_size  = INT_FIFO_SIZE,
@@ -2056,8 +2054,7 @@ static struct pxa25x_udc memory = {
.name   = "ep15in-int",
.ops= &pxa25x_ep_ops,
.maxpacket  = INT_FIFO_SIZE,
-   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
-   USB_EP_CAPS_DIR_IN),
+   .caps   = USB_EP_CAPS(0, 0),
},
.dev= &memory,
.fifo_size  = INT_FIFO_SIZE,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 37/46] usb: gadget: epautoconf: add endpoint capabilities flags verification

2015-07-14 Thread Robert Baldyga
Introduce endpoint matching mechanism basing on endpoint capabilities
flags. We check if endpoint supports transfer type and direction requested
in ep descriptor. Since we have this new endpoint matching mechanism
there is no need to have old code guessing endpoint capabilities basing
on its name, so we are getting rid of it. Remove also the obsolete comment.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 96 +
 1 file changed, 30 insertions(+), 66 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 8e00ca7..af4b10a 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -22,22 +22,6 @@
 
 #include "gadget_chips.h"
 
-/*
- * This should work with endpoints from controller drivers sharing the
- * same endpoint naming convention.  By example:
- *
- * - ep1, ep2, ... address is fixed, not direction or type
- * - ep1in, ep2out, ... address and direction are fixed, not type
- * - ep1-bulk, ep2-bulk, ... address and type are fixed, not direction
- * - ep1in-bulk, ep2out-iso, ... all three are fixed
- * - ep-* ... no functionality restrictions
- *
- * Type suffixes are "-bulk", "-iso", or "-int".  Numbers are decimal.
- * Less common restrictions are implied by gadget_is_*().
- *
- * NOTE:  each endpoint is unidirectional, as specified by its USB
- * descriptor; and isn't specific to a configuration or altsetting.
- */
 static int
 ep_matches (
struct usb_gadget   *gadget,
@@ -47,7 +31,6 @@ ep_matches (
 )
 {
u8  type;
-   const char  *tmp;
u16 max;
 
int num_req_streams = 0;
@@ -56,58 +39,39 @@ ep_matches (
if (ep->claimed)
return 0;
 
-   /* only support ep0 for portable CONTROL traffic */
type = usb_endpoint_type(desc);
-   if (USB_ENDPOINT_XFER_CONTROL == type)
-   return 0;
-
-   /* some other naming convention */
-   if ('e' != ep->name[0])
+   switch (type) {
+   case USB_ENDPOINT_XFER_CONTROL:
+   /* only support ep0 for portable CONTROL traffic */
return 0;
+   case USB_ENDPOINT_XFER_ISOC:
+   if (!ep->caps.type_iso)
+   return 0;
+   break;
+   case USB_ENDPOINT_XFER_BULK:
+   if (!ep->caps.type_bulk)
+   return 0;
+   break;
+   case USB_ENDPOINT_XFER_INT:
+   /* bulk endpoints handle interrupt transfers,
+* except the toggle-quirky iso-synch kind
+*/
+   if (!ep->caps.type_int && !ep->caps.type_bulk)
+   return 0;
+   /* for now, avoid PXA "interrupt-in";
+* it's documented as never using DATA1.
+*/
+   if (gadget_is_pxa(gadget) && ep->caps.type_int)
+   return 0;
+   break;
+   }
 
-   /* type-restriction:  "-iso", "-bulk", or "-int".
-* direction-restriction:  "in", "out".
-*/
-   if ('-' != ep->name[2]) {
-   tmp = strrchr (ep->name, '-');
-   if (tmp) {
-   switch (type) {
-   case USB_ENDPOINT_XFER_INT:
-   /* bulk endpoints handle interrupt transfers,
-* except the toggle-quirky iso-synch kind
-*/
-   if ('s' == tmp[2])  // == "-iso"
-   return 0;
-   /* for now, avoid PXA "interrupt-in";
-* it's documented as never using DATA1.
-*/
-   if (gadget_is_pxa (gadget)
-   && 'i' == tmp [1])
-   return 0;
-   break;
-   case USB_ENDPOINT_XFER_BULK:
-   if ('b' != tmp[1])  // != "-bulk"
-   return 0;
-   break;
-   case USB_ENDPOINT_XFER_ISOC:
-   if ('s' != tmp[2])  // != "-iso"
-   return 0;
-   }
-   } else {
-   tmp = ep->name + strlen (ep->name);
-   }
-
-   /* direction-restriction:  "..in-..", "out-.." */
-   tmp--;
-   if (!isdigit (*tmp)) {
-   if (desc->bEndpointAddress & USB_DIR_IN) {
-   if ('n' != *tmp)
-   return 0;
-   } else {
-   if ('t' != *tmp)
-   retur

[PATCH v3 31/46] usb: gadget: s3c2410_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/s3c2410_udc.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c 
b/drivers/usb/gadget/udc/s3c2410_udc.c
index 5d9aa81..eb3571e 100644
--- a/drivers/usb/gadget/udc/s3c2410_udc.c
+++ b/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -1691,6 +1691,8 @@ static struct s3c2410_udc memory = {
.name   = ep0name,
.ops= &s3c2410_ep_ops,
.maxpacket  = EP0_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL,
+   USB_EP_CAPS_DIR_ALL),
},
.dev= &memory,
},
@@ -1702,6 +1704,8 @@ static struct s3c2410_udc memory = {
.name   = "ep1-bulk",
.ops= &s3c2410_ep_ops,
.maxpacket  = EP_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_ALL),
},
.dev= &memory,
.fifo_size  = EP_FIFO_SIZE,
@@ -1714,6 +1718,8 @@ static struct s3c2410_udc memory = {
.name   = "ep2-bulk",
.ops= &s3c2410_ep_ops,
.maxpacket  = EP_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_ALL),
},
.dev= &memory,
.fifo_size  = EP_FIFO_SIZE,
@@ -1726,6 +1732,8 @@ static struct s3c2410_udc memory = {
.name   = "ep3-bulk",
.ops= &s3c2410_ep_ops,
.maxpacket  = EP_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_ALL),
},
.dev= &memory,
.fifo_size  = EP_FIFO_SIZE,
@@ -1738,6 +1746,8 @@ static struct s3c2410_udc memory = {
.name   = "ep4-bulk",
.ops= &s3c2410_ep_ops,
.maxpacket  = EP_FIFO_SIZE,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_ALL),
},
.dev= &memory,
.fifo_size  = EP_FIFO_SIZE,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 33/46] usb: isp1760: udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/isp1760/isp1760-udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/isp1760/isp1760-udc.c 
b/drivers/usb/isp1760/isp1760-udc.c
index 3699962..1c3d0fd 100644
--- a/drivers/usb/isp1760/isp1760-udc.c
+++ b/drivers/usb/isp1760/isp1760-udc.c
@@ -1383,13 +1383,24 @@ static void isp1760_udc_init_eps(struct isp1760_udc 
*udc)
 */
if (ep_num == 0) {
usb_ep_set_maxpacket_limit(&ep->ep, 64);
+   ep->ep.caps.type_control = true;
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
ep->maxpacket = 64;
udc->gadget.ep0 = &ep->ep;
} else {
usb_ep_set_maxpacket_limit(&ep->ep, 512);
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
ep->maxpacket = 0;
list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
}
+
+   if (is_in)
+   ep->ep.caps.dir_in = true;
+   else
+   ep->ep.caps.dir_out = true;
}
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 28/46] usb: gadget: pxa27x_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/pxa27x_udc.h | 33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h 
b/drivers/usb/gadget/udc/pxa27x_udc.h
index 11e1423..ded058c 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.h
+++ b/drivers/usb/gadget/udc/pxa27x_udc.h
@@ -234,25 +234,28 @@
 /*
  * Endpoint definition helpers
  */
-#define USB_EP_DEF(addr, bname, dir, type, maxpkt) \
-{ .usb_ep = { .name = bname, .ops = &pxa_ep_ops, .maxpacket = maxpkt, }, \
+#define USB_EP_DEF(addr, bname, dir, type, maxpkt, ctype, cdir) \
+{ .usb_ep = {  .name = bname, .ops = &pxa_ep_ops, .maxpacket = maxpkt, \
+   .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## ctype, \
+   USB_EP_CAPS_DIR_ ## cdir), }, \
   .desc = {.bEndpointAddress = addr | (dir ? USB_DIR_IN : 0), \
-   .bmAttributes = type, \
+   .bmAttributes = USB_ENDPOINT_XFER_ ## type, \
.wMaxPacketSize = maxpkt, }, \
   .dev = &memory \
 }
-#define USB_EP_BULK(addr, bname, dir) \
-  USB_EP_DEF(addr, bname, dir, USB_ENDPOINT_XFER_BULK, BULK_FIFO_SIZE)
-#define USB_EP_ISO(addr, bname, dir) \
-  USB_EP_DEF(addr, bname, dir, USB_ENDPOINT_XFER_ISOC, ISO_FIFO_SIZE)
-#define USB_EP_INT(addr, bname, dir) \
-  USB_EP_DEF(addr, bname, dir, USB_ENDPOINT_XFER_INT, INT_FIFO_SIZE)
-#define USB_EP_IN_BULK(n)  USB_EP_BULK(n, "ep" #n "in-bulk", 1)
-#define USB_EP_OUT_BULK(n) USB_EP_BULK(n, "ep" #n "out-bulk", 0)
-#define USB_EP_IN_ISO(n)   USB_EP_ISO(n,  "ep" #n "in-iso", 1)
-#define USB_EP_OUT_ISO(n)  USB_EP_ISO(n,  "ep" #n "out-iso", 0)
-#define USB_EP_IN_INT(n)   USB_EP_INT(n,  "ep" #n "in-int", 1)
-#define USB_EP_CTRLUSB_EP_DEF(0,  "ep0", 0, 0, EP0_FIFO_SIZE)
+#define USB_EP_BULK(addr, bname, dir, cdir) \
+   USB_EP_DEF(addr, bname, dir, BULK, BULK_FIFO_SIZE, BULK, cdir)
+#define USB_EP_ISO(addr, bname, dir, cdir) \
+   USB_EP_DEF(addr, bname, dir, ISOC, ISO_FIFO_SIZE, ISO, cdir)
+#define USB_EP_INT(addr, bname, dir, cdir) \
+   USB_EP_DEF(addr, bname, dir, INT, INT_FIFO_SIZE, INT, cdir)
+#define USB_EP_IN_BULK(n)  USB_EP_BULK(n, "ep" #n "in-bulk", 1, IN)
+#define USB_EP_OUT_BULK(n) USB_EP_BULK(n, "ep" #n "out-bulk", 0, OUT)
+#define USB_EP_IN_ISO(n)   USB_EP_ISO(n,  "ep" #n "in-iso", 1, IN)
+#define USB_EP_OUT_ISO(n)  USB_EP_ISO(n,  "ep" #n "out-iso", 0, OUT)
+#define USB_EP_IN_INT(n)   USB_EP_INT(n,  "ep" #n "in-int", 1, IN)
+#define USB_EP_CTRLUSB_EP_DEF(0,  "ep0", 0, CONTROL, \
+  EP0_FIFO_SIZE, CONTROL, ALL)
 
 #define PXA_EP_DEF(_idx, _addr, dir, _type, maxpkt, _config, iface, altset) \
 { \
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 26/46] usb: gadget: pch_ud: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/pch_udc.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/udc/pch_udc.c b/drivers/usb/gadget/udc/pch_udc.c
index 613547f..cc8fb3c 100644
--- a/drivers/usb/gadget/udc/pch_udc.c
+++ b/drivers/usb/gadget/udc/pch_udc.c
@@ -2895,11 +2895,21 @@ static void pch_udc_pcd_reinit(struct pch_udc_dev *dev)
ep->in = ~i & 1;
ep->ep.name = ep_string[i];
ep->ep.ops = &pch_udc_ep_ops;
-   if (ep->in)
+   if (ep->in) {
ep->offset_addr = ep->num * UDC_EP_REG_SHIFT;
-   else
+   ep->ep.caps.dir_in = true;
+   } else {
ep->offset_addr = (UDC_EPINT_OUT_SHIFT + ep->num) *
  UDC_EP_REG_SHIFT;
+   ep->ep.caps.dir_out = true;
+   }
+   if (i == UDC_EP0IN_IDX || i == UDC_EP0OUT_IDX) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
/* need to set ep->ep.maxpacket and set Default Configuration?*/
usb_ep_set_maxpacket_limit(&ep->ep, UDC_BULK_MAX_PKT_SIZE);
list_add_tail(&ep->ep.ep_list, &dev->gadget.ep_list);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 32/46] usb: gadget: udc-xilinx: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/udc-xilinx.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/udc/udc-xilinx.c 
b/drivers/usb/gadget/udc/udc-xilinx.c
index 1f24274..1cbb0ac 100644
--- a/drivers/usb/gadget/udc/udc-xilinx.c
+++ b/drivers/usb/gadget/udc/udc-xilinx.c
@@ -1317,12 +1317,21 @@ static void xudc_eps_init(struct xusb_udc *udc)
snprintf(ep->name, EPNAME_SIZE, "ep%d", ep_number);
ep->ep_usb.name = ep->name;
ep->ep_usb.ops = &xusb_ep_ops;
+
+   ep->ep_usb.caps.type_iso = true;
+   ep->ep_usb.caps.type_bulk = true;
+   ep->ep_usb.caps.type_int = true;
} else {
ep->ep_usb.name = ep0name;
usb_ep_set_maxpacket_limit(&ep->ep_usb, EP0_MAX_PACKET);
ep->ep_usb.ops = &xusb_ep0_ops;
+
+   ep->ep_usb.caps.type_control = true;
}
 
+   ep->ep_usb.caps.dir_in = true;
+   ep->ep_usb.caps.dir_out = true;
+
ep->udc = udc;
ep->epnumber = ep_number;
ep->desc = NULL;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 30/46] usb: gadget: s3c-hsudc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/s3c-hsudc.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/usb/gadget/udc/s3c-hsudc.c 
b/drivers/usb/gadget/udc/s3c-hsudc.c
index 85a712a..e9def42 100644
--- a/drivers/usb/gadget/udc/s3c-hsudc.c
+++ b/drivers/usb/gadget/udc/s3c-hsudc.c
@@ -1005,6 +1005,21 @@ static void s3c_hsudc_initep(struct s3c_hsudc *hsudc,
hsep->stopped = 0;
hsep->wedge = 0;
 
+   if (epnum == 0) {
+   hsep->ep.caps.type_control = true;
+   hsep->ep.caps.dir_in = true;
+   hsep->ep.caps.dir_out = true;
+   } else {
+   hsep->ep.caps.type_iso = true;
+   hsep->ep.caps.type_bulk = true;
+   hsep->ep.caps.type_int = true;
+   }
+
+   if (epnum & 1)
+   hsep->ep.caps.dir_in = true;
+   else
+   hsep->ep.caps.dir_out = true;
+
set_index(hsudc, epnum);
writel(hsep->ep.maxpacket, hsudc->regs + S3C_MPR);
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 25/46] usb: gadget: omap_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/omap_udc.c | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/drivers/usb/gadget/udc/omap_udc.c 
b/drivers/usb/gadget/udc/omap_udc.c
index e2fcdb8..9b7d394 100644
--- a/drivers/usb/gadget/udc/omap_udc.c
+++ b/drivers/usb/gadget/udc/omap_udc.c
@@ -2579,6 +2579,28 @@ omap_ep_setup(char *name, u8 addr, u8 type,
ep->double_buf = dbuf;
ep->udc = udc;
 
+   switch (type) {
+   case USB_ENDPOINT_XFER_CONTROL:
+   ep->ep.caps.type_control = true;
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
+   break;
+   case USB_ENDPOINT_XFER_ISOC:
+   ep->ep.caps.type_iso = true;
+   break;
+   case USB_ENDPOINT_XFER_BULK:
+   ep->ep.caps.type_bulk = true;
+   break;
+   case USB_ENDPOINT_XFER_INT:
+   ep->ep.caps.type_int = true;
+   break;
+   };
+
+   if (addr & USB_DIR_IN)
+   ep->ep.caps.dir_in = true;
+   else
+   ep->ep.caps.dir_out = true;
+
ep->ep.name = ep->name;
ep->ep.ops = &omap_ep_ops;
ep->maxpacket = maxp;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 22/46] usb: gadget: mv_udc_core: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/mv_udc_core.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/udc/mv_udc_core.c 
b/drivers/usb/gadget/udc/mv_udc_core.c
index d32160d..306a7ff 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -1257,6 +1257,9 @@ static int eps_init(struct mv_udc *udc)
ep->wedge = 0;
ep->stopped = 0;
usb_ep_set_maxpacket_limit(&ep->ep, EP0_MAX_PKT_SIZE);
+   ep->ep.caps.type_control = true;
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
ep->ep_num = 0;
ep->ep.desc = &mv_ep0_desc;
INIT_LIST_HEAD(&ep->queue);
@@ -1269,14 +1272,20 @@ static int eps_init(struct mv_udc *udc)
if (i % 2) {
snprintf(name, sizeof(name), "ep%din", i / 2);
ep->direction = EP_DIR_IN;
+   ep->ep.caps.dir_in = true;
} else {
snprintf(name, sizeof(name), "ep%dout", i / 2);
ep->direction = EP_DIR_OUT;
+   ep->ep.caps.dir_out = true;
}
ep->udc = udc;
strncpy(ep->name, name, sizeof(ep->name));
ep->ep.name = ep->name;
 
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+
ep->ep.ops = &mv_ep_ops;
ep->stopped = 0;
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 24/46] usb: gadget: net2280: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/net2280.c | 50 ++--
 1 file changed, 38 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 2bee912..0295cf7 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -74,19 +74,41 @@ static const char driver_desc[] = DRIVER_DESC;
 
 static const u32 ep_bit[9] = { 0, 17, 2, 19, 4, 1, 18, 3, 20 };
 static const char ep0name[] = "ep0";
-static const char *const ep_name[] = {
-   ep0name,
-   "ep-a", "ep-b", "ep-c", "ep-d",
-   "ep-e", "ep-f", "ep-g", "ep-h",
-};
 
-/* Endpoint names for usb3380 advance mode */
-static const char *const ep_name_adv[] = {
-   ep0name,
-   "ep1in", "ep2out", "ep3in", "ep4out",
-   "ep1out", "ep2in", "ep3out", "ep4in",
+#define EP_INFO(_name, _type, _dir) \
+   { \
+   .name = _name, \
+   .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
+   USB_EP_CAPS_DIR_ ## _dir), \
+   }
+
+static const struct {
+   const char *name;
+   const struct usb_ep_caps caps;
+} ep_info_dft[] = { /* Default endpoint configuration */
+   EP_INFO(ep0name, CONTROL, ALL),
+   EP_INFO("ep-a", ALL,ALL),
+   EP_INFO("ep-b", ALL,ALL),
+   EP_INFO("ep-c", ALL,ALL),
+   EP_INFO("ep-d", ALL,ALL),
+   EP_INFO("ep-e", ALL,ALL),
+   EP_INFO("ep-f", ALL,ALL),
+   EP_INFO("ep-g", ALL,ALL),
+   EP_INFO("ep-h", ALL,ALL),
+}, ep_info_adv[] = { /* Endpoints for usb3380 advance mode */
+   EP_INFO(ep0name, CONTROL, ALL),
+   EP_INFO("ep1in",ALL,IN),
+   EP_INFO("ep2out",   ALL,OUT),
+   EP_INFO("ep3in",ALL,IN),
+   EP_INFO("ep4out",   ALL,OUT),
+   EP_INFO("ep1out",   ALL,OUT),
+   EP_INFO("ep2in",ALL,IN),
+   EP_INFO("ep3out",   ALL,OUT),
+   EP_INFO("ep4in",ALL,IN),
 };
 
+#undef EP_INFO
+
 /* mode 0 == ep-{a,b,c,d} 1K fifo each
  * mode 1 == ep-{a,b} 2K fifo each, ep-{c,d} unavailable
  * mode 2 == ep-a 2K fifo, ep-{b,c} 1K each, ep-d unavailable
@@ -2055,7 +2077,8 @@ static void usb_reinit_228x(struct net2280 *dev)
for (tmp = 0; tmp < 7; tmp++) {
struct net2280_ep   *ep = &dev->ep[tmp];
 
-   ep->ep.name = ep_name[tmp];
+   ep->ep.name = ep_info_dft[tmp].name;
+   ep->ep.caps = ep_info_dft[tmp].caps;
ep->dev = dev;
ep->num = tmp;
 
@@ -2095,7 +2118,10 @@ static void usb_reinit_338x(struct net2280 *dev)
for (i = 0; i < dev->n_ep; i++) {
struct net2280_ep *ep = &dev->ep[i];
 
-   ep->ep.name = dev->enhanced_mode ? ep_name_adv[i] : ep_name[i];
+   ep->ep.name = dev->enhanced_mode ? ep_info_adv[i].name :
+  ep_info_dft[i].name;
+   ep->ep.caps = dev->enhanced_mode ? ep_info_adv[i].caps :
+  ep_info_dft[i].caps;
ep->dev = dev;
ep->num = i;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 19/46] usb: gadget: lpc32xx_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/lpc32xx_udc.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c 
b/drivers/usb/gadget/udc/lpc32xx_udc.c
index 3b6a785..00b5006 100644
--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
@@ -2575,6 +2575,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep0",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 64,
.hwep_num_base  = 0,
@@ -2586,6 +2588,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep1-int",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 64,
.hwep_num_base  = 2,
@@ -2597,6 +2601,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep2-bulk",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 64,
.hwep_num_base  = 4,
@@ -2608,6 +2614,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep3-iso",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 1023,
.hwep_num_base  = 6,
@@ -2619,6 +2627,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep4-int",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 64,
.hwep_num_base  = 8,
@@ -2630,6 +2640,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep5-bulk",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 64,
.hwep_num_base  = 10,
@@ -2641,6 +2653,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep6-iso",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 1023,
.hwep_num_base  = 12,
@@ -2652,6 +2666,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep7-int",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 64,
.hwep_num_base  = 14,
@@ -2663,6 +2679,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep8-bulk",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 64,
.hwep_num_base  = 16,
@@ -2674,6 +2692,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep9-iso",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO,
+   USB_EP_CAPS_DIR_ALL),
},
.maxpacket  = 1023,
.hwep_num_base  = 18,
@@ -2685,6 +2705,8 @@ static const struct lpc32xx_udc controller_template = {
.ep = {
.name   = "ep10-int",
.ops= &lpc32xx_ep_ops,
+   .caps   = USB_EP_CAPS(USB_EP_CAPS_TYPE_INT,
+   USB_EP_CAPS_DIR_ALL),
},
   

[PATCH v3 21/46] usb: gadget: mv_u3d_core: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/mv_u3d_core.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c 
b/drivers/usb/gadget/udc/mv_u3d_core.c
index ea35a24..4c48969 100644
--- a/drivers/usb/gadget/udc/mv_u3d_core.c
+++ b/drivers/usb/gadget/udc/mv_u3d_core.c
@@ -1324,6 +1324,9 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
ep->ep.ops = &mv_u3d_ep_ops;
ep->wedge = 0;
usb_ep_set_maxpacket_limit(&ep->ep, MV_U3D_EP0_MAX_PKT_SIZE);
+   ep->ep.caps.type_control = true;
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
ep->ep_num = 0;
ep->ep.desc = &mv_u3d_ep0_desc;
INIT_LIST_HEAD(&ep->queue);
@@ -1339,14 +1342,20 @@ static int mv_u3d_eps_init(struct mv_u3d *u3d)
if (i & 1) {
snprintf(name, sizeof(name), "ep%din", i >> 1);
ep->direction = MV_U3D_EP_DIR_IN;
+   ep->ep.caps.dir_in = true;
} else {
snprintf(name, sizeof(name), "ep%dout", i >> 1);
ep->direction = MV_U3D_EP_DIR_OUT;
+   ep->ep.caps.dir_out = true;
}
ep->u3d = u3d;
strncpy(ep->name, name, sizeof(ep->name));
ep->ep.name = ep->name;
 
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+
ep->ep.ops = &mv_u3d_ep_ops;
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
ep->ep_num = i / 2;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] mm/cma_debug: fix debugging alloc/free interface

2015-07-14 Thread Joonsoo Kim
CMA has alloc/free interface for debugging. It is intended that alloc/free
occurs in specific CMA region, but, currently, alloc/free interface is
on root dir due to the bug so we can't select CMA region where alloc/free
happens.

This patch fixes this problem by making alloc/free interface per
CMA region.

Signed-off-by: Joonsoo Kim 
---
 mm/cma_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index 7621ee3..22190a7 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -170,10 +170,10 @@ static void cma_debugfs_add_one(struct cma *cma, int idx)
 
tmp = debugfs_create_dir(name, cma_debugfs_root);
 
-   debugfs_create_file("alloc", S_IWUSR, cma_debugfs_root, cma,
+   debugfs_create_file("alloc", S_IWUSR, tmp, cma,
&cma_alloc_fops);
 
-   debugfs_create_file("free", S_IWUSR, cma_debugfs_root, cma,
+   debugfs_create_file("free", S_IWUSR, tmp, cma,
&cma_free_fops);
 
debugfs_create_file("base_pfn", S_IRUGO, tmp,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 15/46] usb: gadget: fsl_udc_core: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c 
b/drivers/usb/gadget/udc/fsl_udc_core.c
index c60022b..aab5221 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2313,6 +2313,19 @@ static int struct_ep_setup(struct fsl_udc *udc, unsigned 
char index,
ep->ep.ops = &fsl_ep_ops;
ep->stopped = 0;
 
+   if (index == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+
+   if (index & 1)
+   ep->ep.caps.dir_in = true;
+   else
+   ep->ep.caps.dir_out = true;
+
/* for ep0: maxP defined in desc
 * for other eps, maxP is set by epautoconfig() called by gadget layer
 */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 16/46] usb: gadget: fusb300_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/fusb300_udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/fusb300_udc.c 
b/drivers/usb/gadget/udc/fusb300_udc.c
index 3970f45..948845c 100644
--- a/drivers/usb/gadget/udc/fusb300_udc.c
+++ b/drivers/usb/gadget/udc/fusb300_udc.c
@@ -1450,6 +1450,17 @@ static int fusb300_probe(struct platform_device *pdev)
ep->ep.name = fusb300_ep_name[i];
ep->ep.ops = &fusb300_ep_ops;
usb_ep_set_maxpacket_limit(&ep->ep, HS_BULK_MAX_PACKET_SIZE);
+
+   if (i == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
}
usb_ep_set_maxpacket_limit(&fusb300->ep[0]->ep, HS_CTL_MAX_PACKET_SIZE);
fusb300->ep[0]->epnum = 0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 12/46] usb: gadget: dummy-hcd: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/dummy_hcd.c | 65 +-
 1 file changed, 50 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/gadget/udc/dummy_hcd.c 
b/drivers/usb/gadget/udc/dummy_hcd.c
index 181112c..69fd29a 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -127,23 +127,57 @@ static inline struct dummy_request 
*usb_request_to_dummy_request
 
 static const char ep0name[] = "ep0";
 
-static const char *const ep_name[] = {
-   ep0name,/* everyone has ep0 */
+static const struct {
+   const char *name;
+   const struct usb_ep_caps caps;
+} ep_info[] = {
+#define EP_INFO(_name, _type, _dir) \
+   { \
+   .name = _name, \
+   .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
+   USB_EP_CAPS_DIR_ ## _dir), \
+   }
 
+   /* everyone has ep0 */
+   EP_INFO(ep0name,CONTROL, ALL),
/* act like a pxa250: fifteen fixed function endpoints */
-   "ep1in-bulk", "ep2out-bulk", "ep3in-iso", "ep4out-iso", "ep5in-int",
-   "ep6in-bulk", "ep7out-bulk", "ep8in-iso", "ep9out-iso", "ep10in-int",
-   "ep11in-bulk", "ep12out-bulk", "ep13in-iso", "ep14out-iso",
-   "ep15in-int",
-
+   EP_INFO("ep1in-bulk",   BULK,   IN),
+   EP_INFO("ep2out-bulk",  BULK,   OUT),
+   EP_INFO("ep3in-iso",ISO,IN),
+   EP_INFO("ep4out-iso",   ISO,OUT),
+   EP_INFO("ep5in-int",INT,IN),
+   EP_INFO("ep6in-bulk",   BULK,   IN),
+   EP_INFO("ep7out-bulk",  BULK,   OUT),
+   EP_INFO("ep8in-iso",ISO,IN),
+   EP_INFO("ep9out-iso",   ISO,OUT),
+   EP_INFO("ep10in-int",   INT,IN),
+   EP_INFO("ep11in-bulk",  BULK,   IN),
+   EP_INFO("ep12out-bulk", BULK,   OUT),
+   EP_INFO("ep13in-iso",   ISO,IN),
+   EP_INFO("ep14out-iso",  ISO,OUT),
+   EP_INFO("ep15in-int",   INT,IN),
/* or like sa1100: two fixed function endpoints */
-   "ep1out-bulk", "ep2in-bulk",
-
+   EP_INFO("ep1out-bulk",  BULK,   OUT),
+   EP_INFO("ep2in-bulk",   BULK,   IN),
/* and now some generic EPs so we have enough in multi config */
-   "ep3out", "ep4in", "ep5out", "ep6out", "ep7in", "ep8out", "ep9in",
-   "ep10out", "ep11out", "ep12in", "ep13out", "ep14in", "ep15out",
+   EP_INFO("ep3out",   ALL,OUT),
+   EP_INFO("ep4in",ALL,IN),
+   EP_INFO("ep5out",   ALL,OUT),
+   EP_INFO("ep6out",   ALL,OUT),
+   EP_INFO("ep7in",ALL,IN),
+   EP_INFO("ep8out",   ALL,OUT),
+   EP_INFO("ep9in",ALL,IN),
+   EP_INFO("ep10out",  ALL,OUT),
+   EP_INFO("ep11out",  ALL,OUT),
+   EP_INFO("ep12in",   ALL,IN),
+   EP_INFO("ep13out",  ALL,OUT),
+   EP_INFO("ep14in",   ALL,IN),
+   EP_INFO("ep15out",  ALL,OUT),
+
+#undef EP_INFO
 };
-#define DUMMY_ENDPOINTSARRAY_SIZE(ep_name)
+
+#define DUMMY_ENDPOINTSARRAY_SIZE(ep_info)
 
 /*-*/
 
@@ -938,9 +972,10 @@ static void init_dummy_udc_hw(struct dummy *dum)
for (i = 0; i < DUMMY_ENDPOINTS; i++) {
struct dummy_ep *ep = &dum->ep[i];
 
-   if (!ep_name[i])
+   if (!ep_info[i].name)
break;
-   ep->ep.name = ep_name[i];
+   ep->ep.name = ep_info[i].name;
+   ep->ep.caps = ep_info[i].caps;
ep->ep.ops = &dummy_ep_ops;
list_add_tail(&ep->ep.ep_list, &dum->gadget.ep_list);
ep->halted = ep->wedged = ep->already_seen =
@@ -1684,7 +1719,7 @@ static void dummy_timer(unsigned long _dum_hcd)
}
 
for (i = 0; i < DUMMY_ENDPOINTS; i++) {
-   if (!ep_name[i])
+   if (!ep_info[i].name)
break;
dum->ep[i].already_seen = 0;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 09/46] usb: gadget: at91_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/at91_udc.c | 33 -
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/gadget/udc/at91_udc.c 
b/drivers/usb/gadget/udc/at91_udc.c
index fc42264..a04b073 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -59,15 +59,29 @@
 #defineDRIVER_VERSION  "3 May 2006"
 
 static const char driver_name [] = "at91_udc";
-static const char * const ep_names[] = {
-   "ep0",
-   "ep1",
-   "ep2",
-   "ep3-int",
-   "ep4",
-   "ep5",
+
+static const struct {
+   const char *name;
+   const struct usb_ep_caps caps;
+} ep_info[] = {
+#define EP_INFO(_name, _type, _dir) \
+   { \
+   .name = _name, \
+   .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
+   USB_EP_CAPS_DIR_ ## _dir), \
+   }
+
+   EP_INFO("ep0",  CONTROL, ALL),
+   EP_INFO("ep1",  ALL,ALL),
+   EP_INFO("ep2",  ALL,ALL),
+   EP_INFO("ep3-int",  INT,ALL),
+   EP_INFO("ep4",  ALL,ALL),
+   EP_INFO("ep5",  ALL,ALL),
+
+#undef EP_INFO
 };
-#define ep0nameep_names[0]
+
+#define ep0nameep_info[0].name
 
 #define VBUS_POLL_TIMEOUT  msecs_to_jiffies(1000)
 
@@ -1830,7 +1844,8 @@ static int at91udc_probe(struct platform_device *pdev)
 
for (i = 0; i < NUM_ENDPOINTS; i++) {
ep = &udc->ep[i];
-   ep->ep.name = ep_names[i];
+   ep->ep.name = ep_info[i].name;
+   ep->ep.caps = ep_info[i].caps;
ep->ep.ops = &at91_ep_ops;
ep->udc = udc;
ep->int_mask = BIT(i);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 11/46] usb: gadget: bdc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/bdc/bdc_ep.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c 
b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index b04980c..f9a8f57 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -1952,12 +1952,18 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir)
ep->bdc = bdc;
ep->dir = dir;
 
+   if (dir)
+   ep->usb_ep.caps.dir_in = true;
+   else
+   ep->usb_ep.caps.dir_out = true;
+
/* ep->ep_num is the index inside bdc_ep */
if (epnum == 1) {
ep->ep_num = 1;
bdc->bdc_ep_array[ep->ep_num] = ep;
snprintf(ep->name, sizeof(ep->name), "ep%d", epnum - 1);
usb_ep_set_maxpacket_limit(&ep->usb_ep, EP0_MAX_PKT_SIZE);
+   ep->usb_ep.caps.type_control = true;
ep->comp_desc = NULL;
bdc->gadget.ep0 = &ep->usb_ep;
} else {
@@ -1971,6 +1977,9 @@ static int init_ep(struct bdc *bdc, u32 epnum, u32 dir)
 dir & 1 ? "in" : "out");
 
usb_ep_set_maxpacket_limit(&ep->usb_ep, 1024);
+   ep->usb_ep.caps.type_iso = true;
+   ep->usb_ep.caps.type_bulk = true;
+   ep->usb_ep.caps.type_int = true;
ep->usb_ep.max_streams = 0;
list_add_tail(&ep->usb_ep.ep_list, &bdc->gadget.ep_list);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 13/46] usb: gadget: fotg210-udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/udc/fotg210-udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/fotg210-udc.c 
b/drivers/usb/gadget/udc/fotg210-udc.c
index e547ea7..960c70c 100644
--- a/drivers/usb/gadget/udc/fotg210-udc.c
+++ b/drivers/usb/gadget/udc/fotg210-udc.c
@@ -1153,6 +1153,17 @@ static int fotg210_udc_probe(struct platform_device 
*pdev)
ep->ep.name = fotg210_ep_name[i];
ep->ep.ops = &fotg210_ep_ops;
usb_ep_set_maxpacket_limit(&ep->ep, (unsigned short) ~0);
+
+   if (i == 0) {
+   ep->ep.caps.type_control = true;
+   } else {
+   ep->ep.caps.type_iso = true;
+   ep->ep.caps.type_bulk = true;
+   ep->ep.caps.type_int = true;
+   }
+
+   ep->ep.caps.dir_in = true;
+   ep->ep.caps.dir_out = true;
}
usb_ep_set_maxpacket_limit(&fotg210->ep[0]->ep, 0x40);
fotg210->gadget.ep0 = &fotg210->ep[0]->ep;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 04/46] staging: emxx_udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Fixed typo in "epc-nulk" to "epc-bulk".

Signed-off-by: Robert Baldyga 
---
 drivers/staging/emxx_udc/emxx_udc.c | 60 ++---
 1 file changed, 29 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index 3b7aa36..0d64bee 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -3153,36 +3153,33 @@ static const struct usb_gadget_ops nbu2ss_gadget_ops = {
.ioctl  = nbu2ss_gad_ioctl,
 };
 
-static const char g_ep0_name[] = "ep0";
-static const char g_ep1_name[] = "ep1-bulk";
-static const char g_ep2_name[] = "ep2-bulk";
-static const char g_ep3_name[] = "ep3in-int";
-static const char g_ep4_name[] = "ep4-iso";
-static const char g_ep5_name[] = "ep5-iso";
-static const char g_ep6_name[] = "ep6-bulk";
-static const char g_ep7_name[] = "ep7-bulk";
-static const char g_ep8_name[] = "ep8in-int";
-static const char g_ep9_name[] = "ep9-iso";
-static const char g_epa_name[] = "epa-iso";
-static const char g_epb_name[] = "epb-bulk";
-static const char g_epc_name[] = "epc-nulk";
-static const char g_epd_name[] = "epdin-int";
-
-static const char *gp_ep_name[NUM_ENDPOINTS] = {
-   g_ep0_name,
-   g_ep1_name,
-   g_ep2_name,
-   g_ep3_name,
-   g_ep4_name,
-   g_ep5_name,
-   g_ep6_name,
-   g_ep7_name,
-   g_ep8_name,
-   g_ep9_name,
-   g_epa_name,
-   g_epb_name,
-   g_epc_name,
-   g_epd_name,
+static const struct {
+   const char *name;
+   const struct usb_ep_caps caps;
+} ep_info[NUM_ENDPOINTS] = {
+#define EP_INFO(_name, _type, _dir) \
+   { \
+   .name = _name, \
+   .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
+   USB_EP_CAPS_DIR_ ## _dir), \
+   }
+
+   EP_INFO("ep0",  CONTROL, ALL),
+   EP_INFO("ep1-bulk", BULK,   ALL),
+   EP_INFO("ep2-bulk", BULK,   ALL),
+   EP_INFO("ep3in-int",INT,IN),
+   EP_INFO("ep4-iso",  INT,ALL),
+   EP_INFO("ep5-iso",  ISO,ALL),
+   EP_INFO("ep6-bulk", ISO,ALL),
+   EP_INFO("ep7-bulk", BULK,   ALL),
+   EP_INFO("ep8in-int",INT,IN),
+   EP_INFO("ep9-iso",  ISO,ALL),
+   EP_INFO("epa-iso",  ISO,ALL),
+   EP_INFO("epb-bulk", BULK,   ALL),
+   EP_INFO("epc-bulk", BULK,   ALL),
+   EP_INFO("epdin-int",INT,IN),
+
+#undef EP_INFO
 };
 
 /*-*/
@@ -3200,7 +3197,8 @@ static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc 
*udc)
ep->desc = NULL;
 
ep->ep.driver_data = NULL;
-   ep->ep.name = gp_ep_name[i];
+   ep->ep.name = ep_info[i].name;
+   ep->ep.caps = ep_info[i].caps;
ep->ep.ops = &nbu2ss_ep_ops;
 
usb_ep_set_maxpacket_limit(&ep->ep,
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 07/46] usb: dwc3: gadget: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/dwc3/gadget.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 333a7c0..8d1f768 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1713,6 +1713,19 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 
*dwc,
return ret;
}
 
+   if (epnum == 0) {
+   dep->endpoint.caps.type_control = true;
+   } else {
+   dep->endpoint.caps.type_iso = true;
+   dep->endpoint.caps.type_bulk = true;
+   dep->endpoint.caps.type_int = true;
+   }
+
+   if (epnum & 1)
+   dep->endpoint.caps.dir_in = true;
+   else
+   dep->endpoint.caps.dir_out = true;
+
INIT_LIST_HEAD(&dep->request_list);
INIT_LIST_HEAD(&dep->req_queued);
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 06/46] usb: dwc2: gadget: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/dwc2/gadget.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 4d47b7c..8771b66 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3289,6 +3289,19 @@ static void s3c_hsotg_initep(struct dwc2_hsotg *hsotg,
usb_ep_set_maxpacket_limit(&hs_ep->ep, epnum ? 1024 : EP0_MPS_LIMIT);
hs_ep->ep.ops = &s3c_hsotg_ep_ops;
 
+   if (epnum == 0) {
+   hs_ep->ep.caps.type_control = true;
+   } else {
+   hs_ep->ep.caps.type_iso = true;
+   hs_ep->ep.caps.type_bulk = true;
+   hs_ep->ep.caps.type_int = true;
+   }
+
+   if (dir_in)
+   hs_ep->ep.caps.dir_in = true;
+   else
+   hs_ep->ep.caps.dir_out = true;
+
/*
 * if we're using dma, we need to set the next-endpoint pointer
 * to be something valid.
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 05/46] usb: chipidea: udc: add ep capabilities support

2015-07-14 Thread Robert Baldyga
Convert endpoint configuration to new capabilities model.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/chipidea/udc.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 764f668..eff7cfb 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1624,6 +1624,20 @@ static int init_eps(struct ci_hdrc *ci)
 
hwep->ep.name  = hwep->name;
hwep->ep.ops   = &usb_ep_ops;
+
+   if (i == 0) {
+   hwep->ep.caps.type_control = true;
+   } else {
+   hwep->ep.caps.type_iso = true;
+   hwep->ep.caps.type_bulk = true;
+   hwep->ep.caps.type_int = true;
+   }
+
+   if (j == TX)
+   hwep->ep.caps.dir_in = true;
+   else
+   hwep->ep.caps.dir_out = true;
+
/*
 * for ep0: maxP defined in desc, for other
 * eps, maxP is set by epautoconfig() called
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 03/46] usb: gadget: add endpoint capabilities helper macros

2015-07-14 Thread Robert Baldyga
Add macros useful while initializing array of endpoint capabilities
structures. These macros makes structure initialization more compact
to decrease number of code lines and increase readability of code.

Signed-off-by: Robert Baldyga 
---
 include/linux/usb/gadget.h | 20 
 1 file changed, 20 insertions(+)

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 6f3e0fb..e6cbc25 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -158,6 +158,26 @@ struct usb_ep_caps {
unsigned dir_out:1;
 };
 
+#define USB_EP_CAPS_TYPE_CONTROL 0x01
+#define USB_EP_CAPS_TYPE_ISO 0x02
+#define USB_EP_CAPS_TYPE_BULK0x04
+#define USB_EP_CAPS_TYPE_INT 0x08
+#define USB_EP_CAPS_TYPE_ALL \
+   (USB_EP_CAPS_TYPE_ISO | USB_EP_CAPS_TYPE_BULK | USB_EP_CAPS_TYPE_INT)
+#define USB_EP_CAPS_DIR_IN   0x01
+#define USB_EP_CAPS_DIR_OUT  0x02
+#define USB_EP_CAPS_DIR_ALL  (USB_EP_CAPS_DIR_IN | USB_EP_CAPS_DIR_OUT)
+
+#define USB_EP_CAPS(_type, _dir) \
+   { \
+   .type_control = !!(_type & USB_EP_CAPS_TYPE_CONTROL), \
+   .type_iso = !!(_type & USB_EP_CAPS_TYPE_ISO), \
+   .type_bulk = !!(_type & USB_EP_CAPS_TYPE_BULK), \
+   .type_int = !!(_type & USB_EP_CAPS_TYPE_INT), \
+   .dir_in = !!(_dir & USB_EP_CAPS_DIR_IN), \
+   .dir_out = !!(_dir & USB_EP_CAPS_DIR_OUT), \
+   }
+
 /**
  * struct usb_ep - device side representation of USB endpoint
  * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 02/46] usb: gadget: add endpoint capabilities flags

2015-07-14 Thread Robert Baldyga
Introduce struct usb_ep_caps which contains information about capabilities
of usb endpoints - supported transfer types and directions. This structure
should be filled by UDC driver for each of its endpoints, and will be
used in epautoconf in new ep matching mechanism which will replace ugly
guessing of endpoint capabilities basing on its name.

Signed-off-by: Robert Baldyga 
---
 include/linux/usb/gadget.h | 21 +
 1 file changed, 21 insertions(+)

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index fcb0a4e..6f3e0fb 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -141,10 +141,29 @@ struct usb_ep_ops {
 };
 
 /**
+ * struct usb_ep_caps - endpoint capabilities description
+ * @type_control:Endpoint supports control type (reserved for ep0).
+ * @type_iso:Endpoint supports isochronous transfers.
+ * @type_bulk:Endpoint supports bulk transfers.
+ * @type_int:Endpoint supports interrupt transfers.
+ * @dir_in:Endpoint supports IN direction.
+ * @dir_out:Endpoint supports OUT direction.
+ */
+struct usb_ep_caps {
+   unsigned type_control:1;
+   unsigned type_iso:1;
+   unsigned type_bulk:1;
+   unsigned type_int:1;
+   unsigned dir_in:1;
+   unsigned dir_out:1;
+};
+
+/**
  * struct usb_ep - device side representation of USB endpoint
  * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
  * @ops: Function pointers used to access hardware-specific operations.
  * @ep_list:the gadget's ep_list holds all of its endpoints
+ * @caps:The structure describing types and directions supported by endoint.
  * @maxpacket:The maximum packet size used on this endpoint.  The initial
  * value can sometimes be reduced (hardware allowing), according to
  *  the endpoint descriptor used to configure the endpoint.
@@ -167,12 +186,14 @@ struct usb_ep_ops {
  * gadget->ep_list.  the control endpoint (gadget->ep0) is not in that list,
  * and is accessed only in response to a driver setup() callback.
  */
+
 struct usb_ep {
void*driver_data;
 
const char  *name;
const struct usb_ep_ops *ops;
struct list_headep_list;
+   struct usb_ep_caps  caps;
boolclaimed;
unsignedmaxpacket:16;
unsignedmaxpacket_limit:16;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 01/46] usb: gadget: encapsulate endpoint claiming mechanism

2015-07-14 Thread Robert Baldyga
So far it was necessary for usb functions to set ep->driver_data in
endpoint obtained from autoconfig to non-null value, to indicate that
endpoint is claimed by function (in autoconfig it was checked if endpoint
has set this field to non-null value, and if it has, it was assumed that
it is claimed). It could cause bugs becouse if some function doesn't
set this field autoconfig could return the same endpoint more than one
time.

To help to avoid such bugs this patch adds claimed flag to struct usb_ep,
and  encapsulates endpoint claiming mechanism inside usb_ep_autoconfig_ss()
and usb_ep_autoconfig_reset(), so now usb functions don't need to perform
any additional actions to mark endpoint obtained from autoconfig as claimed.

Signed-off-by: Robert Baldyga 
---
 drivers/usb/gadget/epautoconf.c | 11 ++-
 include/linux/usb/gadget.h  |  1 +
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 919cdfd..8e00ca7 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -53,7 +53,7 @@ ep_matches (
int num_req_streams = 0;
 
/* endpoint already claimed? */
-   if (NULL != ep->driver_data)
+   if (ep->claimed)
return 0;
 
/* only support ep0 for portable CONTROL traffic */
@@ -240,7 +240,7 @@ find_ep (struct usb_gadget *gadget, const char *name)
  * updated with the assigned number of streams if it is
  * different from the original value. To prevent the endpoint
  * from being returned by a later autoconfig call, claim it by
- * assigning ep->driver_data to some non-null value.
+ * assigning ep->claimed to true.
  *
  * On failure, this returns a null endpoint descriptor.
  */
@@ -323,6 +323,7 @@ struct usb_ep *usb_ep_autoconfig_ss(
 found_ep:
ep->desc = NULL;
ep->comp_desc = NULL;
+   ep->claimed = true;
return ep;
 }
 EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss);
@@ -354,7 +355,7 @@ EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss);
  * descriptor bEndpointAddress.  For bulk endpoints, the wMaxPacket value
  * is initialized as if the endpoint were used at full speed.  To prevent
  * the endpoint from being returned by a later autoconfig call, claim it
- * by assigning ep->driver_data to some non-null value.
+ * by assigning ep->claimed to true.
  *
  * On failure, this returns a null endpoint descriptor.
  */
@@ -373,7 +374,7 @@ EXPORT_SYMBOL_GPL(usb_ep_autoconfig);
  *
  * Use this for devices where one configuration may need to assign
  * endpoint resources very differently from the next one.  It clears
- * state such as ep->driver_data and the record of assigned endpoints
+ * state such as ep->claimed and the record of assigned endpoints
  * used by usb_ep_autoconfig().
  */
 void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
@@ -381,7 +382,7 @@ void usb_ep_autoconfig_reset (struct usb_gadget *gadget)
struct usb_ep   *ep;
 
list_for_each_entry (ep, &gadget->ep_list, ep_list) {
-   ep->driver_data = NULL;
+   ep->claimed = false;
}
gadget->in_epnum = 0;
gadget->out_epnum = 0;
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 4f3dfb7..fcb0a4e 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -173,6 +173,7 @@ struct usb_ep {
const char  *name;
const struct usb_ep_ops *ops;
struct list_headep_list;
+   boolclaimed;
unsignedmaxpacket:16;
unsignedmaxpacket_limit:16;
unsignedmax_streams:16;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] rfkill-gpio: Add support for the Realtek 8723 BT

2015-07-14 Thread Bastien Nocera
On Tue, 2015-07-14 at 15:21 +0200, Johannes Berg wrote:
> On Tue, 2015-07-14 at 08:20 -0500, Larry Finger wrote:
> > On 07/13/2015 05:11 PM, Bastien Nocera wrote:
> > > http://thread.gmane.org/gmane.linux.kernel.wireless.general/12770
> > > 6/
> > > focu
> > > s=127896
> > > 
> > > Signed-off-by: Bastien Nocera 
> > 
> > Bastien,
> > 
> > The subject of this patch needs a bit more detail. I know that you 
> > mean the 
> > RTL8723B versions of the Bluetooth devices. The subject should say 
> > this.
> > 
> > The commit message needs a bit more detail. Referencing the E-mail 
> > thread is OK, 
> > but a bit more is needed. What fails without this change?
> > 
> > To help keep that patches straight, change the next submission to 
> > say 
> > "[PATCH 
> > V2]" in the subject. In addition, after the ---, add a section 
> > saying 
> > what 
> > changed in V2. That info is not retained in the final commit 
> > message 
> > in the 
> > repo, but it can be very useful to a maintainer.
> > 
> 
> And while at it, please use links that include the message-id (e.g.
> mid.gmane.org) so it's searchable even if the archive disappears.

Didn't know that service, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 00/46] usb: gadget: rework ep matching and claiming mechanism

2015-07-14 Thread Robert Baldyga
Hello,

This patch series reworks endpoint matching and claiming mechanism in
epautoconf. From v2 there are couple of new patches adding 'ep_match'
to usb_gadget_ops and removing chip-specific quirk handling from generic
code of autoconfig.

I'm not sure if this patch set isn't too long, as it has 46 patches,
but I decided to send it as single series to avoid problems with patch
applying order.

The aim of whole patchset is to rework epautoconf code to get rid of
things like name-based endpoint matching and UDC name-based quirks in
generic code. These needed to do some modifications in framework like
adding 'endpoint capabilities flags' feature or adding 'match_ep'.

Following paragraphs contain brief description of what modifications are
done by particular parts of this patch set:

Patch (1) introduces new safer endpoint claiming method, basing on new
'claimed' flag. It was discussed here [1]. I proposed this solution over
year ago and it was accepted, but I apparently forgot to send the final
version of my patch.

Patches (2-3) add the 'capabilities flags' structure and helper macros.
This solution is inspired by the 'feature flags' originally proposed
by Felipe Balbi in 2013 [2], but unfortunately implementation of this
feature has never been completed.

Patches (4-36) add' capabilites flags' support to all UDC drivers present
in the kernel tree. It's needed to be done before replacing old endpoint
matching mechanism, otherwise UDC drivers which doesn't set 'capabilities
flags' won't work with new matching function.

Patch (37) finally replaces old endpoint matching method with the new
one basing on capabilities flags.

These changes aims to get rid of code, which guesses endpoint capabilities
basing on it's name, and introduce new better replacement. In result
we have better way to describe types and directions supported by each
endpoint.

For example the old name-based method didn't allow to have endpoint
supporing two types of transfers - there were only ability to support
one or all of endpoint types. The 'capabilities flags' feature supply
precise, flexible and extensible mechanism of description of endpoint
hardware limitations, which is desired for proper endpoint matching.

Patch (38) removes chip-specific quirk from ep_matches() function.

Patches (39-40) remove code modifying endpoint and descriptor structures
from ep_matches() function and cleans it up to make it simpler and more
readable.

Patch (41) add 'match_ep' callback to usb_gadget_ops and make use of
it in epautoconf. This callback allows UDC drivers to supply non-standard
endpoint matching algorithms.

Patches (42-43) move ep_matches() and find_ep() functions outside
epautoconf and rename them to usb_gadget_ep_match_desc() and
gadget_find_ep_by_name(). It's because they may be useful in 'match_ep'
callbacks in UDC drivers to avoid writing repetitive code.

Patches (44-46) move chip-specific enpoint matching algorithms from
generic code of usb_ep_autoconfig_ss() function to UDC controller drivers
using 'match_ep' callback.

In the result we have epautoconf source free of chip-specific code, plus
two new mechanisms allowing to handle non-standard hardware limitations.

[1] https://lkml.org/lkml/2014/6/16/94
[2] http://www.spinics.net/lists/linux-usb/msg99662.html

Best regards,
Robert Baldyga

Changelog:

v3:
- addressed comments from Sergei Shtylyov

v2: https://lkml.org/lkml/2015/7/14/172
- remove PXA quirk from ep_matches() function without behaviour change
  using ep capabilities flags
- separate ep and desc configuration code from ep_match() function
- add 'ep_match' to usb_gadget_ops and move chip-specific endpoint
  matching algorithms from generic code to UDC controller drivers

v1: https://lkml.org/lkml/2015/7/8/436

Robert Baldyga (46):
  usb: gadget: encapsulate endpoint claiming mechanism
  usb: gadget: add endpoint capabilities flags
  usb: gadget: add endpoint capabilities helper macros
  staging: emxx_udc: add ep capabilities support
  usb: chipidea: udc: add ep capabilities support
  usb: dwc2: gadget: add ep capabilities support
  usb: dwc3: gadget: add ep capabilities support
  usb: gadget: amd5536udc: add ep capabilities support
  usb: gadget: at91_udc: add ep capabilities support
  usb: gadget: bcm63xx_udc: add ep capabilities support
  usb: gadget: bdc: add ep capabilities support
  usb: gadget: dummy-hcd: add ep capabilities support
  usb: gadget: fotg210-udc: add ep capabilities support
  usb: gadget: fsl_qe_udc: add ep capabilities support
  usb: gadget: fsl_udc_core: add ep capabilities support
  usb: gadget: fusb300_udc: add ep capabilities support
  usb: gadget: goku_udc: add ep capabilities support
  usb: gadget: gr_udc: add ep capabilities support
  usb: gadget: lpc32xx_udc: add ep capabilities support
  usb: gadget: m66592-udc: add ep capabilities support
  usb: gadget: mv_u3d_core: add ep capabilities support
  usb: gadget: mv_udc_core: add ep capabilities support
  usb: gadget: net2272: add ep capabiliti

Re: [PATCH] rfkill-gpio: Add support for the Realtek 8723 BT

2015-07-14 Thread Bastien Nocera
On Tue, 2015-07-14 at 08:20 -0500, Larry Finger wrote:
> On 07/13/2015 05:11 PM, Bastien Nocera wrote:
> > http://thread.gmane.org/gmane.linux.kernel.wireless.general/127706/
> > focu
> > s=127896
> > 
> > Signed-off-by: Bastien Nocera 
> 
> Bastien,
> 
> The subject of this patch needs a bit more detail. I know that you 
> mean the 
> RTL8723B versions of the Bluetooth devices. The subject should say 
> this.
> 
> The commit message needs a bit more detail. Referencing the E-mail 
> thread is OK, 
> but a bit more is needed. What fails without this change?

Nothing yet, as the current Bluetooth support for this device is
completely in user-space, and doesn't sync up with rfkill.

> To help keep that patches straight, change the next submission to say 
> "[PATCH 
> V2]" in the subject. In addition, after the ---, add a section saying 
> what 
> changed in V2. That info is not retained in the final commit message 
> in the 
> repo, but it can be very useful to a maintainer.


I already submitted this patch? I certainly forgot doing so :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] [SCSI] mpt2sas, mpt3sas: Abort initialization if no memory I/O resources detected

2015-07-14 Thread Sreekanth Reddy
On Tue, Jul 14, 2015 at 10:36:58PM -0700, Yinghai Lu wrote:
> On Tue, Jul 14, 2015 at 9:49 PM, Sreekanth Reddy
>  wrote:
> > Driver crashes if the BIOS do not set up at least one
> > memory I/O resource. This failure can happen if the device is too
> > slow to respond during POST and is missed by the BIOS, but Linux
> > then detects the device later in the boot process.
> 
> But pci subsystem should assign resources to those unassigned BAR.
> 
> Do you mean even kernel can not assign resource to them? or it takes so long 
> for
> mpt FW to get ready?

This is not an issue from mpt FW.

I have just kept the same description provide by Timothy in his
initial patch.

But I observe that their may be chance of getting "unable to handle
kernel NULL pointer dereference" kernel panic if no Memory Resource
available in the PCI subsystem. So agreed to the Timothy proposal of
aborting the driver initialization if it doesn't detect any Memory
resource instead of whole system get into panic state.

> 
> Thanks
> 
> Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] rfkill-gpio: Add support for the Realtek 8723 BT

2015-07-14 Thread Bastien Nocera
On Tue, 2015-07-14 at 17:29 +0200, Marcel Holtmann wrote:
> Hi Bastien,
> 
> > http://thread.gmane.org/gmane.linux.kernel.wireless.general/127706/
> > focu
> > s=127896
> > 
> > Signed-off-by: Bastien Nocera 
> > 
> > ---
> > net/rfkill/rfkill-gpio.c | 1 +
> > 1 file changed, 1 insertion(+)
> > 
> > diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
> > index d5d58d9..9471024 100644
> > --- a/net/rfkill/rfkill-gpio.c
> > +++ b/net/rfkill/rfkill-gpio.c
> > @@ -168,6 +168,7 @@ static const struct acpi_device_id
> > rfkill_acpi_match[] = {
> > { "BCM2E3D", RFKILL_TYPE_BLUETOOTH },
> > { "BCM2E40", RFKILL_TYPE_BLUETOOTH },
> > { "BCM2E64", RFKILL_TYPE_BLUETOOTH },
> > +   { "OBDA8723", RFKILL_TYPE_BLUETOOTH },
> > { "BCM4752", RFKILL_TYPE_GPS },
> > { "LNV4752", RFKILL_TYPE_GPS },
> > { },
> 
> while this is most likely a good start to get people going and 
> testing the hardware, I think long-term some these IDs have to move 
> out of this driver and into a Realtek specific UART slave driver 
> (once we get such a thing upstream).
> 
> I think one example would be what Fred is currently doing for the 
> Broadcom UART devices. Essentially we are currently misusing the 
> RFKILL switch for an on/off switch of the GPIO lines. This would be 
> better handled by the Bluetooth subsystem itself when you power on 
> the controller.

Duly noted. I'll postpone that until I have time to do hardware
enablement on the Bluetooth side of that chipset.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] spi: Force the registration of the spidev devices

2015-07-14 Thread Lucas De Marchi
On Wed, May 13, 2015 at 7:33 PM, Greg Kroah-Hartman
 wrote:
> On Wed, May 13, 2015 at 09:26:40PM +0200, Maxime Ripard wrote:
>> On Wed, May 13, 2015 at 11:17:36AM -0700, Greg Kroah-Hartman wrote:
>> > On Wed, May 13, 2015 at 07:50:34PM +0200, Maxime Ripard wrote:
>> > > Hi Greg,
>> > >
>> > > On Wed, May 13, 2015 at 08:37:40AM -0700, Greg Kroah-Hartman wrote:
>> > > > On Wed, May 13, 2015 at 12:26:04PM +0100, Mark Brown wrote:
>> > > > > On Tue, May 12, 2015 at 10:33:24PM +0200, Maxime Ripard wrote:
>> > > > >
>> > > > > > While this is nicer than the DT solution because of its accurate 
>> > > > > > hardware
>> > > > > > representation, it's still not perfect because you might not have 
>> > > > > > access to the
>> > > > > > DT, or you might be driving a completely generic device (such as a
>> > > > > > microcontroller) that might be used for something else in a 
>> > > > > > different
>> > > > > > context/board.
>> > > > >
>> > > > > Greg, you're copied on this because this seems to be a generic 
>> > > > > problem
>> > > > > that should perhaps be solved at a driver model level - having a way 
>> > > > > to
>> > > > > bind userspace access to devices that we don't otherwise have a 
>> > > > > driver
>> > > > > for.  The subsystem could specify the UIO driver to use when no other
>> > > > > driver is available.
>> > > >
>> > > > That doesn't really work.  I've been talking to the ACPI people about
>> > > > this, and the problem is "don't otherwise have a driver for" is an
>> > > > impossible thing to prove, as you never know when a driver is going to
>> > > > be loaded from userspace.
>> > > >
>> > > > You can easily bind drivers to devices today from userspace, why not
>> > > > just use the built-in functionality you have today if you "know" that
>> > > > there is no driver for this hardware.
>> > >
>> > > What we're really after here is that we want to have an spidev
>> > > instance when we don't even have a device.
>> >
>> > That's crazy, just create a device, things do not work without one.
>>
>> Our use case is this one: we want to export spidev files so that "dev
>> boards" with a header that allows to plug virtually anything on it
>> (Raspberry Pi, Cubieboards, Xplained, and all the likes) without
>> having to change the kernel and / or device tree.
>
> You want to do that on a bus that is not self-describing or dynamic?
> I too want a pony.  Please go kick the hardware engineer who designed
> such a mess, we solved this problem 20+ years ago with "real" busses.

Mind you we are talking about buses created more than 20+ years ago.
(Unfortunately) They are still used today for all kind of sensors.
Boards like RPi, beaglebone, minnowboard expose the pins so we can
actually talk to those sensors, plugging in anyone we'd like to.  For
some of them for example there are IIO drivers that we could use the
driver model to allow binding them. But spidev/i2c-dev allow userspace
to talk directly to them. And you don't know what *others* will plug
into that bus... might even be their own microntrollers with no
identification at all.

Without something like the patch in the first message, people need to
create DT overlays for platforms that support that. ACPI doesn't
support overlays (yet) so we need to keep awful external platform
drivers[1] just to make spidev to work.

-- 
Lucas De Marchi

[1] 
https://github.com/MinnowBoard/minnow-max-extras/blob/master/modules/low-speed-spidev/low-speed-spidev.c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: DRA7: Provide proper IO map table

2015-07-14 Thread Tony Lindgren
* Nishanth Menon  [150622 08:14]:
> DRA7 uses OMAP5 IO table at the moment. This is purely spurious since
> the OMAP5 and DRA7 register maps are different in many aspects.
> 
> AM57xx/DRA7 TRM Reference: http://www.ti.com/lit/ug/spruhz6/spruhz6.pdf
> 
> NOTE: Most of the drivers are already doing ioremap, so, there should'nt
> be any functional improvement involved here, other than making the
> initial iotable more accurate.
> 
> Fixes: a3a9384a1157 ("ARM: DRA7: Reuse io tables and add a new .init_early")
> Signed-off-by: Nishanth Menon 

Is this needed for v4.2-rc or can this wait for v4.3 merge window?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[] array to store persistent cpuid <-> apicid mapping.

2015-07-14 Thread Tang Chen


On 07/15/2015 01:35 PM, Jiang Liu wrote:

On 2015/7/15 11:33, Tang Chen wrote:

Hi Mika,

On 07/07/2015 07:14 PM, Mika Penttilä wrote:

I think you forgot to reserve CPU 0 for BSP in cpuid mask.

Sorry for the late reply.

I'm not familiar with BSP.  Do you mean in get_cpuid(),
I should reserve 0 for physical cpu0 in BSP ?

Would you please share more detail ?

BSP stands for "Bootstrapping Processor". In other word,
BSP is CPU0.
.



Ha, how foolish I am.

And yes, cpu0 is not reserved when apicid == boot_cpu_physical_apicid
comes true.

Will update the patch.

Thanks. :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ARM: imx: mx6ul: PINCTRL_IMX6UL

2015-07-14 Thread Valentin Rothberg
Hi Shawn,

On Wed, Jul 15, 2015 at 8:18 AM, Shawn Guo  wrote:
> On Wed, Jul 15, 2015 at 08:02:43AM +0200, Valentin Rothberg wrote:
>> Hi Frank,
>>
>> your commit 022d0716bb7e ("ARM: imx: add i.mx6ul msl support") has
>> shown up in today's linux-next tree (i.e., next-20150715) adding the
>> following lines of Kconfig code:
>>
>> +config SOC_IMX6UL
>> +   bool "i.MX6 UltraLite support"
>> +   select PINCTRL_IMX6UL
>> [...]
>>
>> The select on PINCTRL_IMX6UL is currently a NOP, since the option is
>> nowhere defined in Kconfig.  I did some research on the web, but could
>> not find any hint that this option is being added somewhere.  Do you
>> know if there is a patch queued somewhere that adds this Kconfig
>> option?
>>
>> I detected the issue with scripts/checkkconfigsymbols.py.
>
> Valentin,
>
> LinusW queued the pinctrl driver patch for 4.3, which should show up on
> linux-next quite soon, I believe.
>
> Shawn

thanks for your answer.  I should have been able to find that, sorry
for the noise.

Thanks,
 Valentin

> [1] http://thread.gmane.org/gmane.linux.kernel.gpio/8992/focus=127904
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ARM: imx: mx6ul: PINCTRL_IMX6UL

2015-07-14 Thread Shawn Guo
On Wed, Jul 15, 2015 at 08:02:43AM +0200, Valentin Rothberg wrote:
> Hi Frank,
> 
> your commit 022d0716bb7e ("ARM: imx: add i.mx6ul msl support") has
> shown up in today's linux-next tree (i.e., next-20150715) adding the
> following lines of Kconfig code:
> 
> +config SOC_IMX6UL
> +   bool "i.MX6 UltraLite support"
> +   select PINCTRL_IMX6UL
> [...]
> 
> The select on PINCTRL_IMX6UL is currently a NOP, since the option is
> nowhere defined in Kconfig.  I did some research on the web, but could
> not find any hint that this option is being added somewhere.  Do you
> know if there is a patch queued somewhere that adds this Kconfig
> option?
> 
> I detected the issue with scripts/checkkconfigsymbols.py.

Valentin,

LinusW queued the pinctrl driver patch for 4.3, which should show up on
linux-next quite soon, I believe.

Shawn

[1] http://thread.gmane.org/gmane.linux.kernel.gpio/8992/focus=127904
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 3/6] cpufreq: powernv: Register for OCC related opal_message notification

2015-07-14 Thread Joel Stanley
Hello,

On Mon, 2015-07-13 at 19:39 +0530, Shilpasri G Bhat wrote:
> diff --git a/drivers/cpufreq/powernv-cpufreq.c 
> b/drivers/cpufreq/powernv-cpufreq.c
> index d0c18c9..1f59958 100644
> --- a/drivers/cpufreq/powernv-cpufreq.c
> +++ b/drivers/cpufreq/powernv-cpufreq.c
> @@ -414,6 +415,71 @@ static struct notifier_block powernv_cpufreq_reboot_nb = 
> {
>   .notifier_call = powernv_cpufreq_reboot_notifier,
>  };
>  
> +static char throttle_reason[][30] = {
> + "No throttling",
> + "Power Cap",
> + "Processor Over Temperature",
> + "Power Supply Failure",
> + "Over Current",
> + "OCC Reset"
> +  };
> +
> +static int powernv_cpufreq_occ_msg(struct notifier_block *nb,
> +unsigned long msg_type, void *_msg)
> +{
> + struct opal_msg *msg = _msg;
> + struct opal_occ_msg omsg;
> +
> + if (msg_type != OPAL_MSG_OCC)
> + return 0;
> +
> + memcpy(&omsg, msg->params, sizeof(omsg));

You need to ensure the of the members of struct opal_occ_msg are in the
correct byte order when copying them over.

Have you tested this code with in a little endian configuration?

Do the messages you're sending make sense for a system that has a BMC
instead of a FSP?

Cheers,

Joel

> +
> + switch (omsg.type) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 5/6] locking/pvqspinlock: Opportunistically defer kicking to unlock time

2015-07-14 Thread Raghavendra K T

On 07/15/2015 07:43 AM, Waiman Long wrote:

Performing CPU kicking at lock time can be a bit faster if there
is no kick-ahead. On the other hand, deferring it to unlock time is
preferrable when kick-ahead can be performed or when the VM guest is
having too few vCPUs that a vCPU may be kicked twice before getting
the lock. This patch implements the deferring kicking when either
one of the above 2 conditions is true.

Linux kernel builds were run in KVM guest on an 8-socket, 4
cores/socket Westmere-EX system and a 4-socket, 8 cores/socket
Haswell-EX system. Both systems are configured to have 32 physical
CPUs. The kernel build times before and after the patch were:

WestmereHaswell
   Patch32 vCPUs48 vCPUs32 vCPUs48 vCPUs
   -
   Before patch   3m27.4s10m32.0s2m00.8s14m52.5s
   After patch   3m01.3s 9m50.9s 2m00.5s13m28.1s

On Westmere, both 32/48 vCPUs case showed some sizeable increase
in performance. For Haswell, there was some improvement in the
overcommitted (48 vCPUs) case.

Signed-off-by: Waiman Long 
---


Hi Waiman,

For virtual guests, from my experiments, lock waiter preemption was the
main concern especially with fair locks.
I find that these set of patches are in right direction to address them.

Thanks for the patches.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


next-20150714 - busted IPv6 source address selection...

2015-07-14 Thread Valdis Kletnieks
next-20150714 w/ one ethernet commit reverted. -0706 w/ same revert works.

"ip addr show" for the wireless says:

5: wlp3s0b1:  mtu 1500 qdisc fq_codel state UP 
group default qlen 1000
link/ether bc:85:56:1f:4f:6d brd ff:ff:ff:ff:ff:ff
inet 172.30.42.75/27 brd 172.30.42.95 scope global dynamic wlp3s0b1
   valid_lft 80952sec preferred_lft 80952sec
inet6 2601:5c0:c100:9243:449b:a30:2f54:5b/64 scope global temporary dynamic 
   valid_lft 7181sec preferred_lft 1781sec
inet6 2601:5c0:c100:9243:be85:56ff:fe1f:4f6d/64 scope global mngtmpaddr 
dynamic 
   valid_lft 7181sec preferred_lft 1781sec
inet6 fe80::be85:56ff:fe1f:4f6d/64 scope link 
   valid_lft forever preferred_lft forever

but outbound packets have a bogus source address:

23:01:52.938986 IP6 a835::100:0:200:0.41360 > 2001:500:19::1.domain: 41835% 
[1au] ? c0.info.afilias-nst.info. (53)
23:05:54.131991 IP6 a835::100:0:200:0 > 2001:468:c80:2105:211:43ff:feda:d769: 
ICMP6, echo request, seq 56, length 64

Interestingly enough, link-local addresses manage to get it wrong
in another fashion:

23:02:52.806011 IP6 fe80::120d:7fff:fe64:ca0b.60625 > ff02::c.ssdp: UDP, length 
411

I suspected this commit mostly because it's the only one that seems to
touch source selection recebntly...

commit 9131f3de24db4dc12199aede7d931e6703e97f3b
Author: YOSHIFUJI Hideaki/吉藤英明 
Date:   Fri Jul 10 16:58:31 2015 +0900

ipv6: Do not iterate over all interfaces when finding source address on 
specific interface.

Reverting this commit make things work again.



pgpoV8eNFGwxS.pgp
Description: PGP signature


[PATCH perf/core ] [BUGFIX] perf build-test: Add linux/export.h and lib/rbtree.c to MANIFEST

2015-07-14 Thread Masami Hiramatsu
Since linux/export.h and lib/rbtree.c are not listed in MANIFEST,
`make build-test` always fails as below (Note, to get these messages,
I've removed /dev/null redirect in tests/perf-targz-src-pkg);

  
CC   util/hweight.o
  ../../lib/hweight.c:1:26: fatal error: linux/export.h:
  No such file or directory
   #include 
  ^
  compilation terminated.
  make[3]: *** [util/hweight.o] Error 1
  

  
GEN  common-cmds.h
  make[1]: *** No rule to make target `../../lib/rbtree.c',
  needed by `python/perf.so'.  Stop.
  make[1]: *** Waiting for unfinished jobs
  

Signed-off-by: Masami Hiramatsu 
---
 tools/perf/MANIFEST |2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 09dc0aa..adce9de 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -58,7 +58,9 @@ include/linux/list.h
 include/linux/hash.h
 include/linux/stringify.h
 lib/hweight.c
+lib/rbtree.c
 include/linux/swab.h
+include/linux/export.h
 arch/*/include/asm/unistd*.h
 arch/*/include/uapi/asm/unistd*.h
 arch/*/include/uapi/asm/perf_regs.h


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/6] cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()

2015-07-14 Thread Baolin Wang
The cputime_to_timespec() and timespec_to_cputime() functions are
not year 2038 safe on 32bit systems due to that the struct timepsec
will overflow in 2038 year. This patch introduces cputime_to_timespec64()
and timespec64_to_cputime() functions which use struct timespec64.
And converts arch specific implementations in arch/s390 and arch/powerpc.

Signed-off-by: Baolin Wang 
---
 arch/powerpc/include/asm/cputime.h|6 +++---
 arch/s390/include/asm/cputime.h   |8 
 include/asm-generic/cputime_jiffies.h |   10 +-
 include/asm-generic/cputime_nsecs.h   |6 +++---
 include/linux/cputime.h   |   16 
 5 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/include/asm/cputime.h 
b/arch/powerpc/include/asm/cputime.h
index e245255..5dda5c0 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -154,9 +154,9 @@ static inline cputime_t secs_to_cputime(const unsigned long 
sec)
 }
 
 /*
- * Convert cputime <-> timespec
+ * Convert cputime <-> timespec64
  */
-static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p)
+static inline void cputime_to_timespec64(const cputime_t ct, struct timespec64 
*p)
 {
u64 x = (__force u64) ct;
unsigned int frac;
@@ -168,7 +168,7 @@ static inline void cputime_to_timespec(const cputime_t ct, 
struct timespec *p)
p->tv_nsec = x;
 }
 
-static inline cputime_t timespec_to_cputime(const struct timespec *p)
+static inline cputime_t timespec64_to_cputime(const struct timespec64 *p)
 {
u64 ct;
 
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 221b454..3319b51 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -81,16 +81,16 @@ static inline cputime_t secs_to_cputime(const unsigned int 
s)
 }
 
 /*
- * Convert cputime to timespec and back.
+ * Convert cputime to timespec64 and back.
  */
-static inline cputime_t timespec_to_cputime(const struct timespec *value)
+static inline cputime_t timespec64_to_cputime(const struct timespec64 *value)
 {
unsigned long long ret = value->tv_sec * CPUTIME_PER_SEC;
return (__force cputime_t)(ret + __div(value->tv_nsec * 
CPUTIME_PER_USEC, NSEC_PER_USEC));
 }
 
-static inline void cputime_to_timespec(const cputime_t cputime,
-  struct timespec *value)
+static inline void cputime_to_timespec64(const cputime_t cputime,
+struct timespec64 *value)
 {
unsigned long long __cputime = (__force unsigned long long) cputime;
value->tv_nsec = (__cputime % CPUTIME_PER_SEC) * NSEC_PER_USEC / 
CPUTIME_PER_USEC;
diff --git a/include/asm-generic/cputime_jiffies.h 
b/include/asm-generic/cputime_jiffies.h
index fe386fc..54e034c 100644
--- a/include/asm-generic/cputime_jiffies.h
+++ b/include/asm-generic/cputime_jiffies.h
@@ -44,12 +44,12 @@ typedef u64 __nocast cputime64_t;
 #define secs_to_cputime(sec)   jiffies_to_cputime((sec) * HZ)
 
 /*
- * Convert cputime to timespec and back.
+ * Convert cputime to timespec64 and back.
  */
-#define timespec_to_cputime(__val) \
-   jiffies_to_cputime(timespec_to_jiffies(__val))
-#define cputime_to_timespec(__ct,__val)\
-   jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
+#define timespec64_to_cputime(__val)   \
+   jiffies_to_cputime(timespec64_to_jiffies(__val))
+#define cputime_to_timespec64(__ct,__val)  \
+   jiffies_to_timespec64(cputime_to_jiffies(__ct),__val)
 
 /*
  * Convert cputime to timeval and back.
diff --git a/include/asm-generic/cputime_nsecs.h 
b/include/asm-generic/cputime_nsecs.h
index 0419485..c0cafc0 100644
--- a/include/asm-generic/cputime_nsecs.h
+++ b/include/asm-generic/cputime_nsecs.h
@@ -71,14 +71,14 @@ typedef u64 __nocast cputime64_t;
(__force cputime_t)((__secs) * NSEC_PER_SEC)
 
 /*
- * Convert cputime <-> timespec (nsec)
+ * Convert cputime <-> timespec64 (nsec)
  */
-static inline cputime_t timespec_to_cputime(const struct timespec *val)
+static inline cputime_t timespec64_to_cputime(const struct timespec64 *val)
 {
u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec;
return (__force cputime_t) ret;
 }
-static inline void cputime_to_timespec(const cputime_t ct, struct timespec 
*val)
+static inline void cputime_to_timespec64(const cputime_t ct, struct timespec64 
*val)
 {
u32 rem;
 
diff --git a/include/linux/cputime.h b/include/linux/cputime.h
index f2eb2ee..cd638a0 100644
--- a/include/linux/cputime.h
+++ b/include/linux/cputime.h
@@ -13,4 +13,20 @@
usecs_to_cputime((__nsecs) / NSEC_PER_USEC)
 #endif
 
+static inline cputime_t timespec_to_cputime(const struct timespec *ts)
+{
+   struct timespec64 ts64 = timespec_to_timespec64(*ts);
+
+   return timespec64_to_cputime(&ts64);
+}
+
+static inline void cputime_to_timespec(const cputime_t cputime,
+ 

[PATCH 5/6] time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()

2015-07-14 Thread Baolin Wang
The conversion between struct timespec and jiffies is not year 2038
safe on 32bit systems. Introduce timespec64_to_jiffies() and
jiffies_to_timespec64() functions which use struct timespec64 to
make it ready for 2038 issue.

Signed-off-by: Baolin Wang 
---
 include/linux/jiffies.h |   22 +++---
 kernel/time/time.c  |   20 +---
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 535fd3b..bf96d9f 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -416,9 +416,25 @@ static inline unsigned long usecs_to_jiffies(const 
unsigned int u)
}
 }
 
-extern unsigned long timespec_to_jiffies(const struct timespec *value);
-extern void jiffies_to_timespec(const unsigned long jiffies,
-   struct timespec *value);
+extern unsigned long timespec64_to_jiffies(const struct timespec64 *value);
+extern void jiffies_to_timespec64(const unsigned long jiffies,
+ struct timespec64 *value);
+static inline unsigned long timespec_to_jiffies(const struct timespec *value)
+{
+   struct timespec64 ts = timespec_to_timespec64(*value);
+
+   return timespec64_to_jiffies(&ts);
+}
+
+static inline void jiffies_to_timespec(const unsigned long jiffies,
+  struct timespec *value)
+{
+   struct timespec64 ts;
+
+   jiffies_to_timespec64(jiffies, &ts);
+   *value = timespec64_to_timespec(ts);
+}
+
 extern unsigned long timeval_to_jiffies(const struct timeval *value);
 extern void jiffies_to_timeval(const unsigned long jiffies,
   struct timeval *value);
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 5d00da4..6692f5a 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -546,7 +546,7 @@ EXPORT_SYMBOL(__usecs_to_jiffies);
  * value to a scaled second value.
  */
 static unsigned long
-__timespec_to_jiffies(unsigned long sec, long nsec)
+__timespec64_to_jiffies(u64 sec, long nsec)
 {
nsec = nsec + TICK_NSEC - 1;
 
@@ -554,22 +554,28 @@ __timespec_to_jiffies(unsigned long sec, long nsec)
sec = MAX_SEC_IN_JIFFIES;
nsec = 0;
}
-   return (((u64)sec * SEC_CONVERSION) +
+   return ((sec * SEC_CONVERSION) +
(((u64)nsec * NSEC_CONVERSION) >>
 (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC;
 
 }
 
+static unsigned long
+__timespec_to_jiffies(unsigned long sec, long nsec)
+{
+   return __timespec64_to_jiffies((u64)sec, nsec);
+}
+
 unsigned long
-timespec_to_jiffies(const struct timespec *value)
+timespec64_to_jiffies(const struct timespec64 *value)
 {
-   return __timespec_to_jiffies(value->tv_sec, value->tv_nsec);
+   return __timespec64_to_jiffies(value->tv_sec, value->tv_nsec);
 }
 
-EXPORT_SYMBOL(timespec_to_jiffies);
+EXPORT_SYMBOL(timespec64_to_jiffies);
 
 void
-jiffies_to_timespec(const unsigned long jiffies, struct timespec *value)
+jiffies_to_timespec64(const unsigned long jiffies, struct timespec64 *value)
 {
/*
 * Convert jiffies to nanoseconds and separate with
@@ -580,7 +586,7 @@ jiffies_to_timespec(const unsigned long jiffies, struct 
timespec *value)
NSEC_PER_SEC, &rem);
value->tv_nsec = rem;
 }
-EXPORT_SYMBOL(jiffies_to_timespec);
+EXPORT_SYMBOL(jiffies_to_timespec64);
 
 /*
  * We could use a similar algorithm to timespec_to_jiffies (with a
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


ARM: imx: mx6ul: PINCTRL_IMX6UL

2015-07-14 Thread Valentin Rothberg
Hi Frank,

your commit 022d0716bb7e ("ARM: imx: add i.mx6ul msl support") has
shown up in today's linux-next tree (i.e., next-20150715) adding the
following lines of Kconfig code:

+config SOC_IMX6UL
+   bool "i.MX6 UltraLite support"
+   select PINCTRL_IMX6UL
[...]

The select on PINCTRL_IMX6UL is currently a NOP, since the option is
nowhere defined in Kconfig.  I did some research on the web, but could
not find any hint that this option is being added somewhere.  Do you
know if there is a patch queued somewhere that adds this Kconfig
option?

I detected the issue with scripts/checkkconfigsymbols.py.

Kind regards,
 Valentin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] time: Introduce do_sys_settimeofday64()

2015-07-14 Thread Baolin Wang
The do_sys_settimeofday() function uses a timespec, which is not year
2038 safe on 32bit systems.

Thus this patch introduces do_sys_settimeofday64(), which allows us to
transition users of do_sys_settimeofday() to using 64bit time types.

Signed-off-by: Baolin Wang 
---
 include/linux/timekeeping.h |   15 +--
 kernel/time/time.c  |8 
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 657ea03..dc60400 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -11,8 +11,19 @@ extern int timekeeping_suspended;
  */
 extern void do_gettimeofday(struct timeval *tv);
 extern int do_settimeofday64(const struct timespec64 *ts);
-extern int do_sys_settimeofday(const struct timespec *tv,
-  const struct timezone *tz);
+extern int do_sys_settimeofday64(const struct timespec64 *tv,
+const struct timezone *tz);
+static inline int do_sys_settimeofday(const struct timespec *tv,
+ const struct timezone *tz)
+{
+   struct timespec64 ts64;
+
+   if (!tv)
+   return -EINVAL;
+
+   ts64 = timespec_to_timespec64(*tv);
+   return do_sys_settimeofday64(&ts64, tz);
+}
 
 /*
  * Kernel time accessors
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 85d5bb1..5d00da4 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -160,15 +160,15 @@ static inline void warp_clock(void)
  * various programs will get confused when the clock gets warped.
  */
 
-int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz)
+int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone 
*tz)
 {
static int firsttime = 1;
int error = 0;
 
-   if (tv && !timespec_valid(tv))
+   if (tv && !timespec64_valid(tv))
return -EINVAL;
 
-   error = security_settime(tv, tz);
+   error = security_settime64(tv, tz);
if (error)
return error;
 
@@ -186,7 +186,7 @@ int do_sys_settimeofday(const struct timespec *tv, const 
struct timezone *tz)
}
}
if (tv)
-   return do_settimeofday(tv);
+   return do_settimeofday64(tv);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] security: Introduce security_settime64()

2015-07-14 Thread Baolin Wang
security_settime() returns a timespec, which is not year 2038 safe
on 32bit systems. Thus this patch introduces the security_settime64()
function with timespec64 type.

We also convert the cap_settime() helper function to use the 64bit types.

Signed-off-by: Baolin Wang 
---
 include/linux/lsm_hooks.h |5 +++--
 include/linux/security.h  |   20 +---
 security/commoncap.c  |2 +-
 security/security.c   |2 +-
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 9429f05..d791f35 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1191,7 +1191,8 @@
  * Return 0 if permission is granted.
  * @settime:
  * Check permission to change the system time.
- * struct timespec and timezone are defined in include/linux/time.h
+ * struct timespec64 is defined in include/linux/time64.h and timezone
+ * is defined in include/linux/time.h
  * @ts contains new time
  * @tz contains new timezone
  * Return 0 if permission is granted.
@@ -1324,7 +1325,7 @@ union security_list_options {
int (*quotactl)(int cmds, int type, int id, struct super_block *sb);
int (*quota_on)(struct dentry *dentry);
int (*syslog)(int type);
-   int (*settime)(const struct timespec *ts, const struct timezone *tz);
+   int (*settime)(const struct timespec64 *ts, const struct timezone *tz);
int (*vm_enough_memory)(struct mm_struct *mm, long pages);
 
int (*bprm_set_creds)(struct linux_binprm *bprm);
diff --git a/include/linux/security.h b/include/linux/security.h
index 79d85dd..105fc27 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -69,7 +69,7 @@ struct timezone;
 /* These functions are in security/commoncap.c */
 extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
   int cap, int audit);
-extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
+extern int cap_settime(const struct timespec64 *ts, const struct timezone *tz);
 extern int cap_ptrace_access_check(struct task_struct *child, unsigned int 
mode);
 extern int cap_ptrace_traceme(struct task_struct *parent);
 extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, 
kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -206,7 +206,13 @@ int security_capable_noaudit(const struct cred *cred, 
struct user_namespace *ns,
 int security_quotactl(int cmds, int type, int id, struct super_block *sb);
 int security_quota_on(struct dentry *dentry);
 int security_syslog(int type);
-int security_settime(const struct timespec *ts, const struct timezone *tz);
+int security_settime64(const struct timespec64 *ts, const struct timezone *tz);
+static inline int security_settime(const struct timespec *ts, const struct 
timezone *tz)
+{
+   struct timespec64 ts64 = timespec_to_timespec64(*ts);
+
+   return security_settime64(&ts64, tz);
+}
 int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
 int security_bprm_set_creds(struct linux_binprm *bprm);
 int security_bprm_check(struct linux_binprm *bprm);
@@ -457,10 +463,18 @@ static inline int security_syslog(int type)
return 0;
 }
 
+static inline int security_settime64(const struct timespec64 *ts,
+const struct timezone *tz)
+{
+   return cap_settime(ts, tz);
+}
+
 static inline int security_settime(const struct timespec *ts,
   const struct timezone *tz)
 {
-   return cap_settime(ts, tz);
+   struct timespec64 ts64 = timespec_to_timespec64(*ts);
+
+   return cap_settime(&ts64, tz);
 }
 
 static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long 
pages)
diff --git a/security/commoncap.c b/security/commoncap.c
index d103f5a4..17b1f79 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -111,7 +111,7 @@ int cap_capable(const struct cred *cred, struct 
user_namespace *targ_ns,
  * Determine whether the current process may set the system clock and timezone
  * information, returning 0 if permission granted, -ve if denied.
  */
-int cap_settime(const struct timespec *ts, const struct timezone *tz)
+int cap_settime(const struct timespec64 *ts, const struct timezone *tz)
 {
if (!capable(CAP_SYS_TIME))
return -EPERM;
diff --git a/security/security.c b/security/security.c
index 595fffa..8d0dbd6 100644
--- a/security/security.c
+++ b/security/security.c
@@ -213,7 +213,7 @@ int security_syslog(int type)
return call_int_hook(syslog, 0, type);
 }
 
-int security_settime(const struct timespec *ts, const struct timezone *tz)
+int security_settime64(const struct timespec64 *ts, const struct timezone *tz)
 {
return call_int_hook(settime, 0, ts, tz);
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
Mor

[PATCH 2/6] timekeeping: Introduce current_kernel_time64()

2015-07-14 Thread Baolin Wang
The current_kernel_time() is not year 2038 safe on 32bit systems
since it returns a timespec value. Introduce current_kernel_time64()
which returns a timespec64 value.

Signed-off-by: Baolin Wang 
---
 include/linux/timekeeping.h |9 -
 kernel/time/timekeeping.c   |6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 3aa72e6..657ea03 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -18,10 +18,17 @@ extern int do_sys_settimeofday(const struct timespec *tv,
  * Kernel time accessors
  */
 unsigned long get_seconds(void);
-struct timespec current_kernel_time(void);
+struct timespec64 current_kernel_time64(void);
 /* does not take xtime_lock */
 struct timespec __current_kernel_time(void);
 
+static inline struct timespec current_kernel_time(void)
+{
+   struct timespec64 now = current_kernel_time64();
+
+   return timespec64_to_timespec(now);
+}
+
 /*
  * timespec based interfaces
  */
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index bca3667..2d58742 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1874,7 +1874,7 @@ struct timespec __current_kernel_time(void)
return timespec64_to_timespec(tk_xtime(tk));
 }
 
-struct timespec current_kernel_time(void)
+struct timespec64 current_kernel_time64(void)
 {
struct timekeeper *tk = &tk_core.timekeeper;
struct timespec64 now;
@@ -1886,9 +1886,9 @@ struct timespec current_kernel_time(void)
now = tk_xtime(tk);
} while (read_seqcount_retry(&tk_core.seq, seq));
 
-   return timespec64_to_timespec(now);
+   return now;
 }
-EXPORT_SYMBOL(current_kernel_time);
+EXPORT_SYMBOL(current_kernel_time64);
 
 struct timespec64 get_monotonic_coarse64(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] time: Introduce struct itimerspec64

2015-07-14 Thread Baolin Wang
The struct itimerspec is not year 2038 safe on 32bit systems due to
the limitation of the struct timespec members. Introduce itimerspec64
which uses struct timespec64 instead and provide conversion functions.

Signed-off-by: Baolin Wang 
---
 include/linux/time64.h |   35 +++
 1 file changed, 35 insertions(+)

diff --git a/include/linux/time64.h b/include/linux/time64.h
index 77b5df2..367d5af 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -12,11 +12,18 @@ typedef __s64 time64_t;
  */
 #if __BITS_PER_LONG == 64
 # define timespec64 timespec
+#define itimerspec64 itimerspec
 #else
 struct timespec64 {
time64_ttv_sec; /* seconds */
longtv_nsec;/* nanoseconds */
 };
+
+struct itimerspec64 {
+   struct timespec64 it_interval;
+   struct timespec64 it_value;
+};
+
 #endif
 
 /* Parameters used to convert the timespec values: */
@@ -45,6 +52,16 @@ static inline struct timespec64 timespec_to_timespec64(const 
struct timespec ts)
return ts;
 }
 
+static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 
*its64)
+{
+   return *its64;
+}
+
+static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec 
*its)
+{
+   return *its;
+}
+
 # define timespec64_equal  timespec_equal
 # define timespec64_comparetimespec_compare
 # define set_normalized_timespec64 set_normalized_timespec
@@ -77,6 +94,24 @@ static inline struct timespec64 timespec_to_timespec64(const 
struct timespec ts)
return ret;
 }
 
+static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 
*its64)
+{
+   struct itimerspec ret;
+
+   ret.it_interval = timespec64_to_timespec(its64->it_interval);
+   ret.it_value = timespec64_to_timespec(its64->it_value);
+   return ret;
+}
+
+static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec 
*its)
+{
+   struct itimerspec64 ret;
+
+   ret.it_interval = timespec_to_timespec64(its->it_interval);
+   ret.it_value = timespec_to_timespec64(its->it_value);
+   return ret;
+}
+
 static inline int timespec64_equal(const struct timespec64 *a,
   const struct timespec64 *b)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/6] Introduce 64bit accessors and structures required to address y2038 issues in the posix_clock subsystem

2015-07-14 Thread Baolin Wang
This patch series change the 32-bit time types (timespec/itimerspec) to
the 64-bit types (timespec64/itimerspec64), and add new 64bit accessor
functions, which are required in order to avoid y2038 issues in the
posix_clock subsystem.

In order to avoid spamming people too much, I'm only sending the first
few patches of the patch series, and left the other patches for later.

And if you are interested in the whole patch series, see:
https://git.linaro.org/people/baolin.wang/upstream_0627.git

Thoughts and feedback would be appreciated.

Baolin Wang (6):
  time: Introduce struct itimerspec64
  timekeeping: Introduce current_kernel_time64()
  security: Introduce security_settime64()
  time: Introduce do_sys_settimeofday64()
  time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
  cputime: Introduce cputime_to_timespec64()/timespec64_to_cputime()

 arch/powerpc/include/asm/cputime.h|6 +++---
 arch/s390/include/asm/cputime.h   |8 
 include/asm-generic/cputime_jiffies.h |   10 +-
 include/asm-generic/cputime_nsecs.h   |6 +++---
 include/linux/cputime.h   |   16 +++
 include/linux/jiffies.h   |   22 ++---
 include/linux/lsm_hooks.h |5 +++--
 include/linux/security.h  |   20 ---
 include/linux/time64.h|   35 +
 include/linux/timekeeping.h   |   24 +++---
 kernel/time/time.c|   28 +++---
 kernel/time/timekeeping.c |6 +++---
 security/commoncap.c  |2 +-
 security/security.c   |2 +-
 14 files changed, 148 insertions(+), 42 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] [SCSI] mpt2sas, mpt3sas: Abort initialization if no memory I/O resources detected

2015-07-14 Thread Yinghai Lu
On Tue, Jul 14, 2015 at 9:49 PM, Sreekanth Reddy
 wrote:
> Driver crashes if the BIOS do not set up at least one
> memory I/O resource. This failure can happen if the device is too
> slow to respond during POST and is missed by the BIOS, but Linux
> then detects the device later in the boot process.

But pci subsystem should assign resources to those unassigned BAR.

Do you mean even kernel can not assign resource to them? or it takes so long for
mpt FW to get ready?

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/5] x86, acpi, cpu-hotplug: Introduce apicid_to_cpuid[] array to store persistent cpuid <-> apicid mapping.

2015-07-14 Thread Jiang Liu
On 2015/7/15 11:33, Tang Chen wrote:
> Hi Mika,
> 
> On 07/07/2015 07:14 PM, Mika Penttilä wrote:
>> I think you forgot to reserve CPU 0 for BSP in cpuid mask.
> 
> Sorry for the late reply.
> 
> I'm not familiar with BSP.  Do you mean in get_cpuid(),
> I should reserve 0 for physical cpu0 in BSP ?
> 
> Would you please share more detail ?

BSP stands for "Bootstrapping Processor". In other word,
BSP is CPU0.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC v4 17/25] powerpc, fbdev: Use arch_nvram_ops methods instead of nvram_read_byte() and nvram_write_byte()

2015-07-14 Thread Finn Thain

On Tue, 14 Jul 2015, Benjamin Herrenschmidt wrote:

> On Tue, 2015-07-14 at 17:58 +1000, Finn Thain wrote:
> > Make use of arch_nvram_ops in device drivers so that the nvram_* 
> > function exports can be removed.
> > 
> > Since they are no longer global symbols, rename the PPC32 nvram_* 
> > functions appropriately.
> > 
> > Add the missing CONFIG_NVRAM test to imsttfb to avoid a build failure.
> > 
> > Add a CONFIG_PPC32 test to matroxfb because PPC64 doesn't implement 
> > the read_byte() method.
> 
> This is a bit fishy in a way because some of that nvram stuff is really 
> about powermac/apple nvram offsets, ie, "XPRAM".

Yes, the generalization that PPC64 does not have XPRAM is wrong, but that 
wasn't originally my doing. If we were to address that issue, this patch 
series may not be the best place to do so.

The situation presently is that CONFIG_NVRAM cannot be enabled on PPC64. I 
took advantage of that simplification, despite the corner cases where it 
fails.

The corner cases are found among PPC64 systems with Matrox cards. The 
other PowerMac video drivers are not really relevant here due to "depends 
on PPC32" or "#if defined(CONFIG_PPC32)", meaning that nvram_read_byte() 
isn't a problem there.

Perhaps only dual-boot systems are at issue because AFAIK only Mac OS 
offers a user friendly way to edit XPRAM settings (?) Further, does the 
video mode setting in XPRAM relate only to the MacOS main screen and not 
to other devices? That is, are we concerned here only with dual-boot PPC64 
machines with one matrox card, as the main screen, and no Linux desktop 
environment and no video mode settings on the kernel command line?

> Maybe we should have a dedicated accessor for "mac_xpram" and NULL-check 
> it rather than using ifdef's ?

I wanted arch_nvram_ops to be const data, which means a NULL check won't 
work, because defined(CONFIG_PPC_PMAC) does not imply availability of 
XPRAM at run-time.

There is a similar situation in the m68k portion of this patch series: a 
multi-platform kernel binary might run on an Atari or a Mac. On m68k I 
resolved this with MACH_IS_MAC(), which is analogous to 
machine_is(powermac).

So I can see how to implement XPRAM for matroxfb and imsttfb on PPC64. But 
this is an enhancement that I would defer unless the present limitation is 
already problematic.

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/36] PCI: Add support for more than two alt_size under same bridge

2015-07-14 Thread Yijing Wang
On 2015/7/15 13:08, Yinghai Lu wrote:
> On Tue, Jul 14, 2015 at 8:07 PM, Yijing Wang  wrote:
>> On 2015/7/7 7:39, Yinghai Lu wrote:
>>> Need to increase size to make sure it could fit all alt entries.
>>>
>>> So at last, we use 8M/17M as parent bridge alt_align/alt_size.
>>
>> Tested-by: Yijing Wang 
> 
> Thanks for testing.
> 
>>
>> Hi Yinghai, does this patch depend on the previous items in this patchset ?
> 
> Yes, it depends most of patches from patch1 to this patch.
> 
>> Could you provide another version of this patch for stable branch, eg. 3.10 
>> stable ?
> 
> That is RHEL 7 kernel, right ?

Yes.

> 
> After those patches get into upstream, I will try to port them to 3.10 stable.

Thanks very much!

> 
> Thanks
> 
> Yinghai
> 
> .
> 


-- 
Thanks!
Yijing

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: Re: [PATCH 1/3] panic: Disable crash_kexec_post_notifiers if kdump is not available

2015-07-14 Thread Masami Hiramatsu
On 2015/07/15 3:23, Vivek Goyal wrote:
> On Tue, Jul 14, 2015 at 01:01:12PM -0500, Eric W. Biederman wrote:
>> Vivek Goyal  writes:
>>
>>> On Tue, Jul 14, 2015 at 05:29:53PM +, dwal...@fifo99.com wrote:
>>>
>>> [..]
 If a machine is failing, there are high chance it can't deliver you the
 notification. Detecting that failure suing some kind of polling 
 mechanism
 might be more reliable. And it will make even kdump mechanism more
 reliable so that it does not have to run panic notifiers after the 
 crash.
>>>
>>> I think what your suggesting is that my company should change how it's 
>>> hardware works
>>> and that's not really an option for me. This isn't a simple thing like 
>>> checking over the
>>> network if the machine is down or not, this is way more complex 
>>> hardware design.
>>
>> That means you are ready to live with an unreliable design. There might 
>> be
>> cases where notifier does not get run properly and you will not do switch
>> despite the fact that OS has failed. I was just trying to nudge you in
>> a direction which could be more reliable mechanism.
>
> Sigh I see some deep confusion going on here.
>
> The panic notifiers are just that panic notifiers.  They have not been
> nor should they be tied to kexec.   If those notifiers force a switch
> over of between machines I fail to see why you would care if it was
> kexec or another panic situation that is forcing that switchover.

 Hidehiro isn't fixing the failover situation on my side, he's fixing 
 register
 information collection when crash_kexec_post_notifiers is used.
>>>
>>> Sure. Given that we have created this new parameter, let us fix it so that
>>> we can capture the other cpu register state in crash dump.
>>>
>>> I am little disappointed that it was not tested well when this parameter was
>>> introuced. We should have atleast tested it to the extent to see if there
>>> is proper cpu state present for all cpus in the crash dump.
>>>
>>> At that point of time it looked like a simple modification
>>> to allow panic notifiers before crash_kexec().
>>
>> Either that or we say no one cares enough, and it known broken so let's
>> just revert the fool thing.
> 
> Masami, you introduced this option. Are you fine with the revert? Is it
> really being used and tested?

Actually, it is tested but under very limited situation. I think we
need a clear acceptance criteria, IOW, we need a testset for kdump
so that we can make things better.
Would you have it? maybe we can push it into kselftest.

>> I honestly can't see how to support panic notifiers, before kexec.
>> There is no way to tell what is being done and all of the pieces
>> including smp_send_stop are known to be buggy.
> 
> we should be able to replace smp_send_stop() with what crash_kexec() is
> doing to stop the machine? If yes, then it should be fine I guess. This
> parameter description clearly says that specify it at your own risk. So
> we are not issuing a big support statement for successful kdump after
> panic notifiers. If it is something fixable, otherwise user needs
> to deal with it.

Agreed (as I've sent in other replay).

Thank you,

-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu...@hitachi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] CLK: TI: add dpll_clksel_mac_clk node

2015-07-14 Thread Tony Lindgren
* Tero Kristo  [150714 06:30]:
> On 07/14/2015 02:06 PM, Tony Lindgren wrote:
> >* Keerthy  [150625 06:48]:
> >>
> >>On Thursday 18 June 2015 02:36 PM, Mugunthan V N wrote:
> >>>On Thursday 18 June 2015 01:31 PM, Keerthy wrote:
> The series adds the missing clock node needed for cpsw.
> 
> Keerthy (2):
>    CLK: TI: add dpll_clksel_mac_clk node
>    ARM: dts: am4372: Set the default clock rate for dpll_clksel_mac_clk
>  clock
> 
>   arch/arm/boot/dts/am4372.dtsi| 7 +--
>   arch/arm/boot/dts/am43xx-clocks.dtsi | 9 +
>   drivers/clk/ti/clk-43xx.c| 1 +
>   3 files changed, 15 insertions(+), 2 deletions(-)
> 
> >>>
> >>>Tested-by: Mugunthan V N 
> >>
> >>Thanks Mugunthan.
> >>
> >>A gentle ping on this series.
> >
> >Tero, care to review this series?
> 
> Acked-by: Tero Kristo 
> 
> I guess this should go through your tree as this is mostly dts changes?

Actually I don't have anything coming for the clock dtsi files for
v4.3 merge window, so it's best that you queue these. For the dts
changes, please feel free to add:

Acked-by: Tony Lindgren 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/36] PCI: Add support for more than two alt_size under same bridge

2015-07-14 Thread Yinghai Lu
On Tue, Jul 14, 2015 at 8:07 PM, Yijing Wang  wrote:
> On 2015/7/7 7:39, Yinghai Lu wrote:
>> Need to increase size to make sure it could fit all alt entries.
>>
>> So at last, we use 8M/17M as parent bridge alt_align/alt_size.
>
> Tested-by: Yijing Wang 

Thanks for testing.

>
> Hi Yinghai, does this patch depend on the previous items in this patchset ?

Yes, it depends most of patches from patch1 to this patch.

> Could you provide another version of this patch for stable branch, eg. 3.10 
> stable ?

That is RHEL 7 kernel, right ?

After those patches get into upstream, I will try to port them to 3.10 stable.

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 05/23] staging: rtl8192e: Remove unused fields from rtllib_stats

2015-07-14 Thread Sudip Mukherjee
On Wed, Jul 15, 2015 at 10:27:20AM +0530, Sudip Mukherjee wrote:
> On Tue, Jul 14, 2015 at 10:04:08PM +0200, Mateusz Kulikowski wrote:
> > None of them are used in the driver.
> > 
> > Signed-off-by: Mateusz Kulikowski 
> > ---
> >  drivers/staging/rtl8192e/rtllib.h | 19 ---
> >  1 file changed, 19 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8192e/rtllib.h 
> > b/drivers/staging/rtl8192e/rtllib.h
> > index 8ba92ed..dc0653a 100644
> > --- a/drivers/staging/rtl8192e/rtllib.h
> > +++ b/drivers/staging/rtl8192e/rtllib.h
> > @@ -691,27 +691,8 @@ struct rtllib_frag_entry {
> >  };
> >  
> >  struct rtllib_stats {
> > -   unsigned int tx_unicast_frames;
> > -   unsigned int tx_multicast_frames;
> > -   unsigned int tx_fragments;
> > -   unsigned int tx_unicast_octets;
> > -   unsigned int tx_multicast_octets;
> > -   unsigned int tx_deferred_transmissions;
> > -   unsigned int tx_single_retry_frames;
> > -   unsigned int tx_multiple_retry_frames;
> > -   unsigned int tx_retry_limit_exceeded;
> > unsigned int tx_discards;
> > -   unsigned int rx_unicast_frames;
> > -   unsigned int rx_multicast_frames;
> > -   unsigned int rx_fragments;
> > -   unsigned int rx_unicast_octets;
> > -   unsigned int rx_multicast_octets;
> > -   unsigned int rx_fcs_errors;
> > -   unsigned int rx_discards_no_buffer;
> > -   unsigned int tx_discards_wrong_sa;
> > unsigned int rx_discards_undecryptable;
> Dan had commented before that tx_discards and rx_discards_undecryptable
> are also not used. Their only uses are:
>  ieee->ieee_stats.rx_discards_undecryptable++ and
>  ieee->ieee_stats.tx_discards++

Ok, next patch does that. Sorry for the noise.
 
regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 05/23] staging: rtl8192e: Remove unused fields from rtllib_stats

2015-07-14 Thread Sudip Mukherjee
On Tue, Jul 14, 2015 at 10:04:08PM +0200, Mateusz Kulikowski wrote:
> None of them are used in the driver.
> 
> Signed-off-by: Mateusz Kulikowski 
> ---
>  drivers/staging/rtl8192e/rtllib.h | 19 ---
>  1 file changed, 19 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192e/rtllib.h 
> b/drivers/staging/rtl8192e/rtllib.h
> index 8ba92ed..dc0653a 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -691,27 +691,8 @@ struct rtllib_frag_entry {
>  };
>  
>  struct rtllib_stats {
> - unsigned int tx_unicast_frames;
> - unsigned int tx_multicast_frames;
> - unsigned int tx_fragments;
> - unsigned int tx_unicast_octets;
> - unsigned int tx_multicast_octets;
> - unsigned int tx_deferred_transmissions;
> - unsigned int tx_single_retry_frames;
> - unsigned int tx_multiple_retry_frames;
> - unsigned int tx_retry_limit_exceeded;
>   unsigned int tx_discards;
> - unsigned int rx_unicast_frames;
> - unsigned int rx_multicast_frames;
> - unsigned int rx_fragments;
> - unsigned int rx_unicast_octets;
> - unsigned int rx_multicast_octets;
> - unsigned int rx_fcs_errors;
> - unsigned int rx_discards_no_buffer;
> - unsigned int tx_discards_wrong_sa;
>   unsigned int rx_discards_undecryptable;
Dan had commented before that tx_discards and rx_discards_undecryptable
are also not used. Their only uses are:
 ieee->ieee_stats.rx_discards_undecryptable++ and
 ieee->ieee_stats.tx_discards++

regards
sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH RFC] vfs: add a O_NOMTIME flag

2015-07-14 Thread NeilBrown
On Tue, 14 Jul 2015 15:13:00 +0200 Pavel Machek  wrote:

> Hi!
> 
> > BTW When you "swap" to a file the mtime doesn't get updated.  No one seems 
> > to
> > complain about that.  I guess it is a rather narrow use-case though.
> 
> Actually yes, I'd like to complain.
> 
> It was not swap, it was mount -o loop, but I guess that's the same
> case. Then rsync refused to work on that file... and being on slow ARM
> system it took me a while to figure out WTF is going on.
> 
> So yes, we have problems with mtime, and yes, they matter.
>   Pavel

Odd...
I assume you mean
  mount -o loop /some/file  /mountpoint

and then when you write to the filesystem on /mountpoint the mtime
of /some/file doesn't get updated?
I think it should.
 drivers/block/loop.c uses vfs_iter_write() to write to a file.
 That calls f_op->write_iter which will typically call
 generic_file_write_iter() which will call file_update_time() to update
 the time stamps.

What filesystem was /some/file on?
I just did some testing on ext4 and it seems to do the right thing
mtime gets updated.

NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] MAINTAINERS: Update LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) maintainers list

2015-07-14 Thread Sreekanth Reddy
Updating maintainers list for the entry LSILOGIC MPT FUSION DRIVERS in
MAINTAINERS file

Signed-off-by: Sreekanth Reddy 
---
 MAINTAINERS | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2d3d55c..c3cd5c9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6348,10 +6348,9 @@ S:   Maintained
 F: arch/arm/mach-lpc32xx/
 
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
-M: Nagalakshmi Nandigama 
-M: Praveen Krishnamoorthy 
+M: Sathya Prakash 
 M: Sreekanth Reddy 
-M: Abhijit Mahajan 
+M: Chaitra Basappa 
 L: mpt-fusionlinux@avagotech.com
 L: linux-s...@vger.kernel.org
 W: http://www.lsilogic.com/support
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] [SCSI] mpt2sas, mpt3sas: Abort initialization if no memory I/O resources detected

2015-07-14 Thread Sreekanth Reddy
Driver crashes if the BIOS do not set up at least one
memory I/O resource. This failure can happen if the device is too
slow to respond during POST and is missed by the BIOS, but Linux
then detects the device later in the boot process.

Changes in v3:
   Rearranged the code to remove the code redundancy

Signed-off-by: Sreekanth Reddy 
---
 drivers/scsi/mpt2sas/mpt2sas_base.c | 16 +---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 16 +---
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c 
b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 11248de..6dec7cf 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1557,7 +1557,8 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
goto out_fail;
}
 
-   for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) {
+   for (i = 0, memap_sz = 0, pio_sz = 0; (i < DEVICE_COUNT_RESOURCE) &&
+(!memap_sz || !pio_sz); i++) {
if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
if (pio_sz)
continue;
@@ -1572,16 +1573,17 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
chip_phys = (u64)ioc->chip_phys;
memap_sz = pci_resource_len(pdev, i);
ioc->chip = ioremap(ioc->chip_phys, memap_sz);
-   if (ioc->chip == NULL) {
-   printk(MPT2SAS_ERR_FMT "unable to map "
-   "adapter memory!\n", ioc->name);
-   r = -EINVAL;
-   goto out_fail;
-   }
}
}
}
 
+   if (ioc->chip == NULL) {
+   printk(MPT2SAS_ERR_FMT "unable to map adapter memory! "
+  "or resource not found\n", ioc->name);
+   r = -EINVAL;
+   goto out_fail;
+   }
+
_base_mask_interrupts(ioc);
 
r = _base_get_ioc_facts(ioc, CAN_SLEEP);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c 
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 14a781b..43f87e9 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1843,7 +1843,8 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
goto out_fail;
}
 
-   for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) {
+   for (i = 0, memap_sz = 0, pio_sz = 0; (i < DEVICE_COUNT_RESOURCE) &&
+(!memap_sz || !pio_sz); i++) {
if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
if (pio_sz)
continue;
@@ -1856,15 +1857,16 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
chip_phys = (u64)ioc->chip_phys;
memap_sz = pci_resource_len(pdev, i);
ioc->chip = ioremap(ioc->chip_phys, memap_sz);
-   if (ioc->chip == NULL) {
-   pr_err(MPT3SAS_FMT "unable to map adapter 
memory!\n",
-   ioc->name);
-   r = -EINVAL;
-   goto out_fail;
-   }
}
}
 
+   if (ioc->chip == NULL) {
+   pr_err(MPT3SAS_FMT "unable to map adapter memory! "
+   " or resource not found\n", ioc->name);
+   r = -EINVAL;
+   goto out_fail;
+   }
+
_base_mask_interrupts(ioc);
 
r = _base_get_ioc_facts(ioc, CAN_SLEEP);
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] staging: sm7xxfb: define new macros

2015-07-14 Thread Sudip Mukherjee
On Tue, Jul 14, 2015 at 08:05:08PM -0700, Greg Kroah-Hartman wrote:
> On Tue, Jul 07, 2015 at 01:44:36PM +0530, Sudip Mukherjee wrote:
> > +#define mmio_addr  0x00c0
> > +#define seqw17
> 
> Odd, empty macros are not good, because:
> 
> > -#ifdef __BIG_ENDIAN
> > if (sfb->fb->var.bits_per_pixel == 32)
> > -   smtc_seqw(0x17, 0x30);
> > -#endif
> > +   seqw17;
> 
> That just looks wrong :(
I think it will look better in c file if I make it as
#define seqw17()
I will respin the patches and send.

regards
sudip 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/4] Add Broadcom North Star 2 support

2015-07-14 Thread Ray Jui
This patch series adds Broadcom North Star 2 (NS2) SoC support. NS2 is an ARMv8
based SoC and under the Broadcom iProc family.

Sorry for tying this with the Broadcom iProc PCIe driver fixes for ARM64. I
have to tie them together because iProc PCIe support is enabled by default
when ARCH_BCM_IPROC is enabled. Without the fixes in the iProc PCIe driver,
enabling CONFIG_ARCH_BCM_IPROC would break the build for arm64 defconfig. Let
me know if there's a better way to handle this.

This patch series is generated based on v4.2-rc2 and tested on Broadcom NS2 SVK

Code available on GITHUB: https://github.com/Broadcom/arm64-linux.git
branch is ns2-core-v2

Changes from V1:
- Took Arnd's advice to tweak the location of struct pci_sys_data within
struct iproc_pcie. This helps to get rid of most of the CONFIG_ARM wrap in
iProc PCIe core driver
- Use stdout-path and alias for serial console in NS2 SVK dts
- Add all 4 CPU descriptions in NS2 dtsi
- Remove "clock-frequency" property in the armv8 timer node so timer frequency
can be determined based on readings from CNTFRQ_EL0
- Remove config flag ARCH_BCM_NS2. Leave only ARCH_BCM_IPROC for all Broadcom
arm64 SoCs as advised

Ray Jui (4):
  PCI: iproc: enable arm64 support for iProc PCIe
  PCI: iproc: Fix ARM64 dependency in Kconfig
  arm64: Add Broadcom iProc family support
  arm64: dts: Add Broadcom North Star 2 support

 Documentation/devicetree/bindings/arm/bcm/ns2.txt |9 ++
 arch/arm64/Kconfig|5 +
 arch/arm64/boot/dts/Makefile  |1 +
 arch/arm64/boot/dts/broadcom/Makefile |5 +
 arch/arm64/boot/dts/broadcom/ns2-svk.dts  |   60 +++
 arch/arm64/boot/dts/broadcom/ns2.dtsi |  118 +
 arch/arm64/configs/defconfig  |2 +
 drivers/pci/host/Kconfig  |2 +-
 drivers/pci/host/pcie-iproc.c |   15 +--
 drivers/pci/host/pcie-iproc.h |8 +-
 10 files changed, 211 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/ns2.txt
 create mode 100644 arch/arm64/boot/dts/broadcom/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2-svk.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2.dtsi

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 2/4] PCI: iproc: Fix ARM64 dependency in Kconfig

2015-07-14 Thread Ray Jui
Allow Broadcom iProc PCIe core driver to be compiled for ARM64

Signed-off-by: Ray Jui 
Reviewed-by: Vikram Prakash 
Reviewed-by: Scott Branden 
---
 drivers/pci/host/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index c132bdd..d2c6144 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -117,7 +117,7 @@ config PCI_VERSATILE
 
 config PCIE_IPROC
tristate "Broadcom iProc PCIe controller"
-   depends on OF && ARM
+   depends on OF && (ARM || ARM64)
default n
help
  This enables the iProc PCIe core controller support for Broadcom's
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/4] arm64: Add Broadcom iProc family support

2015-07-14 Thread Ray Jui
This patch adds support to Broadcom's iProc family of arm64 based SoCs
in the arm64 Kconfig and defconfig files

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
---
 arch/arm64/Kconfig   |5 +
 arch/arm64/configs/defconfig |2 ++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 318175f..969ef4a 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -162,6 +162,11 @@ source "kernel/Kconfig.freezer"
 
 menu "Platform selection"
 
+config ARCH_BCM_IPROC
+   bool "Broadcom iProc SoC Family"
+   help
+ This enables support for Broadcom iProc based SoCs
+
 config ARCH_EXYNOS
bool
help
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 4e17e7e..c83d51f 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -31,6 +31,7 @@ CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 # CONFIG_IOSCHED_DEADLINE is not set
+CONFIG_ARCH_BCM_IPROC=y
 CONFIG_ARCH_EXYNOS7=y
 CONFIG_ARCH_FSL_LS2085A=y
 CONFIG_ARCH_HISI=y
@@ -102,6 +103,7 @@ CONFIG_SERIO_AMBAKMI=y
 CONFIG_LEGACY_PTY_COUNT=16
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_DW=y
 CONFIG_SERIAL_8250_MT6577=y
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/4] PCI: iproc: enable arm64 support for iProc PCIe

2015-07-14 Thread Ray Jui
This patch enables arm64 support to the iProc PCIe driver

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
---
 drivers/pci/host/pcie-iproc.c |   15 ---
 drivers/pci/host/pcie-iproc.h |8 ++--
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c
index d77481e..8a556d5 100644
--- a/drivers/pci/host/pcie-iproc.c
+++ b/drivers/pci/host/pcie-iproc.c
@@ -58,11 +58,6 @@
 #define SYS_RC_INTX_EN   0x330
 #define SYS_RC_INTX_MASK 0xf
 
-static inline struct iproc_pcie *sys_to_pcie(struct pci_sys_data *sys)
-{
-   return sys->private_data;
-}
-
 /**
  * Note access to the configuration registers are protected at the higher layer
  * by 'pci_lock' in drivers/pci/access.c
@@ -71,8 +66,7 @@ static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus 
*bus,
unsigned int devfn,
int where)
 {
-   struct pci_sys_data *sys = bus->sysdata;
-   struct iproc_pcie *pcie = sys_to_pcie(sys);
+   struct iproc_pcie *pcie = bus->sysdata;
unsigned slot = PCI_SLOT(devfn);
unsigned fn = PCI_FUNC(devfn);
unsigned busno = bus->number;
@@ -208,10 +202,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct 
list_head *res)
 
iproc_pcie_reset(pcie);
 
-   pcie->sysdata.private_data = pcie;
-
-   bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops,
- &pcie->sysdata, res);
+   bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, pcie, res);
if (!bus) {
dev_err(pcie->dev, "unable to create PCI root bus\n");
ret = -ENOMEM;
@@ -229,7 +220,9 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct 
list_head *res)
 
pci_scan_child_bus(bus);
pci_assign_unassigned_bus_resources(bus);
+#ifdef CONFIG_ARM
pci_fixup_irqs(pci_common_swizzle, pcie->map_irq);
+#endif
pci_bus_add_devices(bus);
 
return 0;
diff --git a/drivers/pci/host/pcie-iproc.h b/drivers/pci/host/pcie-iproc.h
index ba0a108..0ee9673 100644
--- a/drivers/pci/host/pcie-iproc.h
+++ b/drivers/pci/host/pcie-iproc.h
@@ -18,18 +18,22 @@
 
 /**
  * iProc PCIe device
+ * @sysdata: Per PCI controller data. This needs to be kept at the beginning of
+ * struct iproc_pcie, to enable support of both ARM32 and ARM64 platforms with
+ * minimal changes in the iProc PCIe core driver
  * @dev: pointer to device data structure
  * @base: PCIe host controller I/O register base
  * @resources: linked list of all PCI resources
- * @sysdata: Per PCI controller data
  * @root_bus: pointer to root bus
  * @phy: optional PHY device that controls the Serdes
  * @irqs: interrupt IDs
  */
 struct iproc_pcie {
+#ifdef CONFIG_ARM
+   struct pci_sys_data sysdata;
+#endif
struct device *dev;
void __iomem *base;
-   struct pci_sys_data sysdata;
struct pci_bus *root_bus;
struct phy *phy;
int irqs[IPROC_PCIE_MAX_NUM_IRQS];
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 4/4] arm64: dts: Add Broadcom North Star 2 support

2015-07-14 Thread Ray Jui
Add Broadcom NS2 device tree binding document. Also add initial device
tree dtsi for Broadcom North Star 2 (NS2) SoC and board support for NS2
SVK board

Signed-off-by: Jon Mason 
Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
---
 Documentation/devicetree/bindings/arm/bcm/ns2.txt |9 ++
 arch/arm64/boot/dts/Makefile  |1 +
 arch/arm64/boot/dts/broadcom/Makefile |5 +
 arch/arm64/boot/dts/broadcom/ns2-svk.dts  |   60 +++
 arch/arm64/boot/dts/broadcom/ns2.dtsi |  118 +
 5 files changed, 193 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/ns2.txt
 create mode 100644 arch/arm64/boot/dts/broadcom/Makefile
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2-svk.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/ns2.dtsi

diff --git a/Documentation/devicetree/bindings/arm/bcm/ns2.txt 
b/Documentation/devicetree/bindings/arm/bcm/ns2.txt
new file mode 100644
index 000..35f056f
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/bcm/ns2.txt
@@ -0,0 +1,9 @@
+Broadcom North Star 2 (NS2) device tree bindings
+
+
+Boards with NS2 shall have the following properties:
+
+Required root node property:
+
+NS2 SVK board
+compatible = "brcm,ns2-svk", "brcm,ns2";
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 38913be..9f95941 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -1,6 +1,7 @@
 dts-dirs += amd
 dts-dirs += apm
 dts-dirs += arm
+dts-dirs += broadcom
 dts-dirs += cavium
 dts-dirs += exynos
 dts-dirs += freescale
diff --git a/arch/arm64/boot/dts/broadcom/Makefile 
b/arch/arm64/boot/dts/broadcom/Makefile
new file mode 100644
index 000..e21fe66
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -0,0 +1,5 @@
+dtb-$(CONFIG_ARCH_BCM_IPROC) += ns2-svk.dtb
+
+always := $(dtb-y)
+subdir-y   := $(dts-dirs)
+clean-files:= *.dtb
diff --git a/arch/arm64/boot/dts/broadcom/ns2-svk.dts 
b/arch/arm64/boot/dts/broadcom/ns2-svk.dts
new file mode 100644
index 000..a43d93f
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/ns2-svk.dts
@@ -0,0 +1,60 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ ** Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ ** Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in
+ *  the documentation and/or other materials provided with the
+ *  distribution.
+ ** Neither the name of Broadcom Corporation nor the names of its
+ *  contributors may be used to endorse or promote products derived
+ *  from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/dts-v1/;
+
+#include "ns2.dtsi"
+
+/ {
+   model = "Broadcom NS2 SVK";
+   compatible = "brcm,ns2-svk", "brcm,ns2";
+
+   aliases {
+   serial0 = &uart3;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   bootargs = "earlycon=uart8250,mmio32,0x6613";
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x0 0x8000 0x 0x4000>;
+   };
+
+   soc: soc {
+   uart3: serial@6613 {
+   status = "ok";
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/broadcom/ns2.dtsi 
b/arch/arm64/boot/dts/broadcom/ns2.dtsi
new file mode 100644
index 000..3c92d92
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/ns2.dtsi
@@ -0,0 +1,118 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ ** Red

  1   2   3   4   5   6   7   8   9   10   >