All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 04/34] musb: sunxi: Add fifo config
Date: Sun, 11 Feb 2018 12:29:04 +0100	[thread overview]
Message-ID: <91af51d0-0c67-00c2-4175-adfc7fef6b2e@denx.de> (raw)
In-Reply-To: <CAD6G_RSvj955_XcxoEmh087KziFYDg_G6u+ZOB0bXVOSw0ej6g@mail.gmail.com>

On 02/11/2018 11:59 AM, Jagan Teki wrote:
> On Tue, Feb 6, 2018 at 8:11 PM, Marek Vasut <marex@denx.de> wrote:
>> On 02/06/2018 03:25 PM, Jagan Teki wrote:
>>> Unlike other Allwinner SOC's H3/H5/V3s OTG support 4 endpoints
>>> with relevant fifo configs, rest all have 5 endpoints.
>>> So add the fifo configs and defer them based on udevice_id compatible.
>>>
>>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
>>> ---
>>>  drivers/usb/musb-new/sunxi.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
>>>  1 file changed, 43 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
>>> index 0b7ff9f..562d311 100644
>>> --- a/drivers/usb/musb-new/sunxi.c
>>> +++ b/drivers/usb/musb-new/sunxi.c
>>> @@ -301,13 +301,52 @@ static const struct musb_platform_ops sunxi_musb_ops = {
>>>  #define SUNXI_MUSB_MAX_EP_NUM                6
>>>  #define SUNXI_MUSB_RAM_BITS          11
>>>
>>> +static struct musb_fifo_cfg sunxi_musb_mode_cfg[] = {
>>> +     MUSB_EP_FIFO_SINGLE(1, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(1, FIFO_RX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(2, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(2, FIFO_RX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(3, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(3, FIFO_RX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(4, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(4, FIFO_RX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(5, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(5, FIFO_RX, 512),
>>
>> Generate all this programatically with a loop ?
>>
>>> +};
>>> +
>>> +/* H3/V3s OTG supports only 4 endpoints */
>>> +#define SUNXI_MUSB_MAX_EP_NUM_H3     5
>>> +
>>> +static struct musb_fifo_cfg sunxi_musb_mode_cfg_h3[] = {
>>> +     MUSB_EP_FIFO_SINGLE(1, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(1, FIFO_RX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(2, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(2, FIFO_RX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(3, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(3, FIFO_RX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(4, FIFO_TX, 512),
>>> +     MUSB_EP_FIFO_SINGLE(4, FIFO_RX, 512),
>>> +};
>>> +
>>>  static struct musb_hdrc_config musb_config = {
>>> +     .fifo_cfg       = sunxi_musb_mode_cfg,
>>> +     .fifo_cfg_size  = ARRAY_SIZE(sunxi_musb_mode_cfg),
>>>       .multipoint     = true,
>>>       .dyn_fifo       = true,
>>>       .num_eps        = SUNXI_MUSB_MAX_EP_NUM,
>>>       .ram_bits       = SUNXI_MUSB_RAM_BITS,
>>>  };
>>>
>>> +static struct musb_hdrc_config musb_config_h3 = {
>>> +     .fifo_cfg       = sunxi_musb_mode_cfg_h3,
>>> +     .fifo_cfg_size  = ARRAY_SIZE(sunxi_musb_mode_cfg_h3),
>>> +     .multipoint     = true,
>>> +     .dyn_fifo       = true,
>>> +     .soft_con       = true,
>>> +     .num_eps        = SUNXI_MUSB_MAX_EP_NUM_H3,
>>> +     .ram_bits       = SUNXI_MUSB_RAM_BITS,
>>> +};
>>> +
>>>  static int musb_usb_probe(struct udevice *dev)
>>>  {
>>>       struct sunxi_glue *glue = dev_get_priv(dev);
>>> @@ -328,7 +367,10 @@ static int musb_usb_probe(struct udevice *dev)
>>>
>>>       pdata.power = 250;
>>>       pdata.platform_ops = &sunxi_musb_ops;
>>> -     pdata.config = &musb_config;
>>> +     if (!device_is_compatible(dev, "allwinner,sun8i-h3-musb"))
>>
>> Instead of this, use the compatible's .data to pass the
>> musb_config(_h3). Then you can do
>> pdata.config = dev_get_driver_data(dev);
> 
> We've only diff with H3 compared to all other SOC's

_for_ _now_ . You cannot predict what AW will roll out next.

> and this make
> assigning same musb_config to non-H3 platforms, which will increasing
> some bytes(as of now 16bytes we have a10,a33, a31 and h3). compatible
> check here look suitable, I think.

The driver data are in the U-Boot binary anyway, just not used and thus
set to 0 . By adding this check, you're actually growing the size.

The driver data are there for this exact purpose -- associating metadata
with compatible strings, metadata which are to be used by the driver (ie
in probe() function). What you're doing here with the compatible check
is wrong.

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2018-02-11 11:29 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 14:25 [U-Boot] [PATCH v4 00/34] phy: sunxi: Add Allwinner sun4i USB PHY Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 01/34] usb: sunxi: Simplify ccm reg base code Jagan Teki
2018-02-06 14:37   ` Marek Vasut
2018-02-11 10:39     ` Jagan Teki
2018-02-11 11:24       ` Marek Vasut
2018-02-06 14:25 ` [U-Boot] [PATCH v4 02/34] musb: sunxi: Add proper macros instead of numericals Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 03/34] musb: sunxi: Use simple way to fill musb_hdrc pdata Jagan Teki
2018-02-06 14:39   ` Marek Vasut
2018-02-11 10:44     ` Jagan Teki
2018-02-11 11:25       ` Marek Vasut
2018-02-06 14:25 ` [U-Boot] [PATCH v4 04/34] musb: sunxi: Add fifo config Jagan Teki
2018-02-06 14:41   ` Marek Vasut
2018-02-11 10:59     ` Jagan Teki
2018-02-11 11:29       ` Marek Vasut [this message]
2018-02-06 14:25 ` [U-Boot] [PATCH v4 05/34] sunxi: clock: Fix clock gating for H3/H5/A64 Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 06/34] musb: sunxi: Add OTG device clkgate and reset for H3/H5 Jagan Teki
2018-02-06 14:43   ` Marek Vasut
2018-02-06 14:25 ` [U-Boot] [PATCH v4 07/34] sunxi: clock: Fix OHCI clock gating " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 08/34] musb: sunxi: Add support for H3/H5A64 Jagan Teki
2018-02-06 14:44   ` Marek Vasut
2018-02-06 14:25 ` [U-Boot] [PATCH v4 09/34] phy: Add Allwinner A64 USB PHY driver Jagan Teki
2018-02-06 14:47   ` Marek Vasut
2018-02-06 14:25 ` [U-Boot] [PATCH v4 10/34] phy: sun4i-usb: Add id_detect and vbus_detect ops Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 11/34] phy: sun4i-usb: Add H3/H5 PHY config Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 12/34] phy: sun4i-usb: Add V3S " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 13/34] phy: sun4i-usb: Add A83T USB " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 14/34] phy: sun4i-usb: Add A10/A13/A20 " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 15/34] phy: sun4i-usb: Add A31 " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 16/34] phy: sun4i-usb: Add A33 USB " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 17/34] phy: sun4i-usb: Add A23 " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 18/34] device-tree-bindings: phy: Sync sun4i-usb-phy bindings Jagan Teki
2018-02-06 14:49   ` Marek Vasut
2018-02-06 14:25 ` [U-Boot] [PATCH v4 19/34] board: sunxi: Use generic-phy for board_usb_cable_connected Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 20/34] phy: sun4i-usb: Add a sunxi specific function for setting squelch-detect Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 21/34] usb: sunxi: Switch to use generic-phy Jagan Teki
2018-02-06 14:51   ` Marek Vasut
2018-02-06 14:25 ` [U-Boot] [PATCH v4 22/34] sunxi: Drop legacy usb_phy.c Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 23/34] sunxi: h3: Sync OTG and HCI nodes from Linux DT Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 24/34] arm64: allwinner: a64: bananapi-m64: Sync usb_otg node from Linux Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 25/34] configs: bananapi-m64: Enable USB OTG peripheral mode Jagan Teki
2018-02-06 15:47   ` Maxime Ripard
2018-02-06 14:25 ` [U-Boot] [PATCH v4 26/34] ARM: dts: sun8i: a83t: Sync usbphy node from Linux Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 27/34] arm64: allwinner: a64: bananapi-m64: Sync usb host nodes " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 28/34] ARM: dts: sun8i-h3: bananapi-m2-plus: Sync usb otg " Jagan Teki
2018-02-06 14:25 ` [U-Boot] [PATCH v4 29/34] configs: bananapi-m2-plus: Enable USB OTG peripheral mode Jagan Teki
2018-02-06 14:26 ` [U-Boot] [PATCH v4 30/34] arm64: allwinner: h5: orangepi-pc2: Order nodes in alphabetic Jagan Teki
2018-02-06 14:26 ` [U-Boot] [PATCH v4 31/34] arm64: allwinner: h5: orangepi-pc2: Sync usb otg nodes from Linux Jagan Teki
2018-02-06 14:26 ` [U-Boot] [PATCH v4 32/34] configs: orangepi-pc2: Enable USB OTG peripheral mode Jagan Teki
2018-02-06 14:26 ` [U-Boot] [PATCH v4 33/34] arm64: allwinner: h5: orangepi-prime: Sync usb otg nodes from Linux Jagan Teki
2018-02-06 14:26 ` [U-Boot] [PATCH v4 34/34] configs: orangepi-prime: Enable USB OTG peripheral mode Jagan Teki

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=91af51d0-0c67-00c2-4175-adfc7fef6b2e@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.