All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <monstr-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
To: balbi-l0cyMroinI0@public.gmane.org
Cc: Subbaraya Sundeep Bhatta
	<subbaraya.sundeep.bhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Subbaraya Sundeep Bhatta
	<sbhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2 2/2] usb: gadget: Add xilinx axi usb2 device support
Date: Thu, 03 Apr 2014 17:23:28 +0200	[thread overview]
Message-ID: <533D7CF0.2000702@monstr.eu> (raw)
In-Reply-To: <20140403145853.GD14162-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

>> +struct xusb_udc {
>> +	struct usb_gadget gadget;
>> +	struct xusb_ep ep[8];
>> +	struct usb_gadget_driver *driver;
>> +	struct cmdbuf ch9cmd;
>> +	u32 usb_state;
>> +	u32 remote_wkp;
>> +	unsigned int (*read_fn)(void __iomem *);
>> +	void (*write_fn)(void __iomem *, u32, u32);
> 
> why do you need these to be function pointers ? Because of endianness ?
> generic readl()/writel() already take care of that.

readl from asm-generic/io.h is converting value from little endian IO
to cpu endianness.
This IP exists also in big endian version.
It means we have to support all possible combinations.
IP little and reading it on little or big endian CPU
IP big and reading it on little or big endian CPU.

Look below.

>> +	spin_lock_init(&udc->lock);
>> +
>> +	/* Check for IP endianness */
>> +	udc->write_fn = xudc_write32_be;
>> +	udc->read_fn = xudc_read32_be;
>> +	udc->write_fn(udc->base_address, XUSB_TESTMODE_OFFSET, TEST_J);
>> +	if ((udc->read_fn(udc->base_address + XUSB_TESTMODE_OFFSET))
>> +			!= TEST_J) {
>> +		udc->write_fn = xudc_write32;
>> +		udc->read_fn = xudc_read32;
>> +	}
> 
> hmm... isn't there a configuration register to check this out ?

Sundeep can tell us if there is any configuration register but
I don't think so in connection to my experience with Xilinx soft IPs.

Endian detection directly on IP itself came from my discussion
on drivers/spi/spi-xilinx.c that this is only one way how to do it.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <monstr@monstr.eu>
To: balbi@ti.com
Cc: Subbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org,
	Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>
Subject: Re: [PATCH v2 2/2] usb: gadget: Add xilinx axi usb2 device support
Date: Thu, 03 Apr 2014 17:23:28 +0200	[thread overview]
Message-ID: <533D7CF0.2000702@monstr.eu> (raw)
In-Reply-To: <20140403145853.GD14162@saruman.home>

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]

>> +struct xusb_udc {
>> +	struct usb_gadget gadget;
>> +	struct xusb_ep ep[8];
>> +	struct usb_gadget_driver *driver;
>> +	struct cmdbuf ch9cmd;
>> +	u32 usb_state;
>> +	u32 remote_wkp;
>> +	unsigned int (*read_fn)(void __iomem *);
>> +	void (*write_fn)(void __iomem *, u32, u32);
> 
> why do you need these to be function pointers ? Because of endianness ?
> generic readl()/writel() already take care of that.

readl from asm-generic/io.h is converting value from little endian IO
to cpu endianness.
This IP exists also in big endian version.
It means we have to support all possible combinations.
IP little and reading it on little or big endian CPU
IP big and reading it on little or big endian CPU.

Look below.

>> +	spin_lock_init(&udc->lock);
>> +
>> +	/* Check for IP endianness */
>> +	udc->write_fn = xudc_write32_be;
>> +	udc->read_fn = xudc_read32_be;
>> +	udc->write_fn(udc->base_address, XUSB_TESTMODE_OFFSET, TEST_J);
>> +	if ((udc->read_fn(udc->base_address + XUSB_TESTMODE_OFFSET))
>> +			!= TEST_J) {
>> +		udc->write_fn = xudc_write32;
>> +		udc->read_fn = xudc_read32;
>> +	}
> 
> hmm... isn't there a configuration register to check this out ?

Sundeep can tell us if there is any configuration register but
I don't think so in connection to my experience with Xilinx soft IPs.

Endian detection directly on IP itself came from my discussion
on drivers/spi/spi-xilinx.c that this is only one way how to do it.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  parent reply	other threads:[~2014-04-03 15:23 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1396510519-8555-1-git-send-email-sbhatta@xilinx.com>
2014-04-03  7:35 ` [PATCH v2 2/2] usb: gadget: Add xilinx axi usb2 device support Subbaraya Sundeep Bhatta
2014-04-03  7:35   ` Subbaraya Sundeep Bhatta
     [not found]   ` <113d0620-4003-417d-806b-0b79ae692829-+Ck8Kgl/v0/RNLY4SpiB+rjjLBE8jN/0@public.gmane.org>
2014-04-03 14:58     ` Felipe Balbi
2014-04-03 14:58       ` Felipe Balbi
     [not found]       ` <20140403145853.GD14162-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-03 15:23         ` Michal Simek [this message]
2014-04-03 15:23           ` Michal Simek
     [not found]           ` <533D7CF0.2000702-pSz03upnqPeHXe+LvDLADg@public.gmane.org>
2014-04-07  9:01             ` sundeep subbaraya
2014-04-07  9:01               ` sundeep subbaraya
     [not found]       ` <CALHRZupk2ywMNKjzAtCPgg=9-KsDqrVBAKFNoHOoSJOQ4FDJkA@mail.gmail.com>
     [not found]         ` <CALHRZupk2ywMNKjzAtCPgg=9-KsDqrVBAKFNoHOoSJOQ4FDJkA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-07  9:06           ` Fwd: " sundeep subbaraya
2014-04-07  9:06             ` sundeep subbaraya
     [not found]             ` <CALHRZuqtEpK98vTS=RQ+f3yu-L_M1SnZSJOMTaBnDT8z+YqccQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-07 16:35               ` Felipe Balbi
2014-04-07 16:35                 ` Felipe Balbi
2014-04-08 16:01                 ` sundeep subbaraya
     [not found]                   ` <CALHRZuotnNf-sCaeQJQ_PnSVET=+GvZ_PmvF7E3oEg8bKZ8a2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-08 21:24                     ` Felipe Balbi
2014-04-08 21:24                       ` Felipe Balbi
2014-04-16 10:39       ` sundeep subbaraya
2014-04-16 18:02         ` Felipe Balbi
2014-04-16 18:02           ` Felipe Balbi
     [not found]           ` <20140416180228.GK28035-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-17  9:31             ` sundeep subbaraya
2014-04-17  9:31               ` sundeep subbaraya
     [not found]               ` <CALHRZuq6=TMryHtbjTw7rYoGwbu2w0BTdxiOA95HYS3_CG6vwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-17 15:01                 ` Felipe Balbi
2014-04-17 15:01                   ` Felipe Balbi
2014-04-18 14:04                   ` sundeep subbaraya
2014-04-21 16:08                     ` Felipe Balbi
2014-04-21 16:39                       ` Alan Stern
     [not found]                         ` <Pine.LNX.4.44L0.1404211228190.1201-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-04-22  7:28                           ` sundeep subbaraya
2014-04-22  7:28                             ` sundeep subbaraya
2014-04-22 13:57                             ` Alan Stern
2014-04-22 14:49                             ` Felipe Balbi
     [not found]                               ` <20140422144944.GF5524-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-04-23  4:27                                 ` sundeep subbaraya
2014-04-23  4:27                                   ` sundeep subbaraya
     [not found]                                   ` <CALHRZuoq32qoh70hbb2LtVJNgkwB1j6bvzmYONmxcn3mBnGONQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-30 16:54                                     ` Felipe Balbi
2014-04-30 16:54                                       ` Felipe Balbi
2014-05-25 17:40                                       ` sundeep subbaraya
2014-07-02 16:46                                         ` Felipe Balbi
     [not found]                                           ` <20140702164629.GI5541-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-07-07  6:28                                             ` sundeep subbaraya
2014-07-07  6:28                                               ` sundeep subbaraya
     [not found]         ` <CALHRZuoCtEz5-CmU17dUpVS_MjSDdYVLMSvgXq_RwxLj_KJMDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-16 20:08           ` Paul Zimmerman
2014-04-16 20:08             ` Paul Zimmerman
     [not found]             ` <A2CA0424C0A6F04399FB9E1CD98E03046D18F4A6-Yu2iAY70zvrYN67daEjeMPufCSb+aD3WLzEdoUbNIic@public.gmane.org>
2014-04-17 14:27               ` sundeep subbaraya
2014-04-17 14:27                 ` sundeep subbaraya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=533D7CF0.2000702@monstr.eu \
    --to=monstr-psz03upnqpehxe+lvdladg@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sbhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
    --cc=subbaraya.sundeep.bhatta-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.