public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: peter.chen@freescale.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/7] usb: chipidea: add otg file
Date: Mon, 24 Dec 2012 16:33:59 +0800	[thread overview]
Message-ID: <20121224083357.GB21391@nchen-desktop> (raw)
In-Reply-To: <87mwy0ms6h.fsf@ashishki-desk.ger.corp.intel.com>

On Thu, Nov 29, 2012 at 03:53:26PM +0200, Alexander Shishkin wrote:
> Peter Chen <peter.chen@freescale.com> writes:
> 
> > diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> > index d738603..8702871 100644
> > --- a/drivers/usb/chipidea/ci.h
> > +++ b/drivers/usb/chipidea/ci.h
> > @@ -129,6 +129,7 @@ struct hw_bank {
> >   * @vbus_active: is VBUS active
> >   * @transceiver: pointer to USB PHY, if any
> >   * @hcd: pointer to usb_hcd for ehci host driver
> > + * @otg: for otg support
> >   */
> >  struct ci13xxx {
> >  	struct device			*dev;
> > @@ -164,6 +165,7 @@ struct ci13xxx {
> >  	bool				global_phy;
> >  	struct usb_phy			*transceiver;
> >  	struct usb_hcd			*hcd;
> > +	struct usb_otg      otg;
> 
> Can you indent the "otg" so that it's aligned with the rest?
will change
> 
> >  };
> >  
> >  static inline struct ci_role_driver *ci_role(struct ci13xxx *ci)
> > diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
> > new file mode 100644
> > index 0000000..7dea3b3
> > --- /dev/null
> > +++ b/drivers/usb/chipidea/otg.c
> > @@ -0,0 +1,60 @@
> > +/*
> > + * otg.c - ChipIdea USB IP core OTG driver
> > + *
> > + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> > + *
> > + * Author: Peter 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.
> > + */
> > +
> > +#include <linux/platform_device.h>
> > +#include <linux/module.h>
> > +#include <linux/io.h>
> > +#include <linux/irq.h>
> > +#include <linux/kernel.h>
> > +#include <linux/slab.h>
> 
> Most of these look unnecessary.
> 
> > +#include <linux/usb/gadget.h>
> > +#include <linux/usb/otg.h>
> > +#include <linux/usb/chipidea.h>
> > +
> > +#include "ci.h"
> > +#include "udc.h"
> > +#include "bits.h"
> > +#include "host.h"
> > +#include "debug.h"
> 
> And these.
will change
> 
> > +
> > +static int ci_otg_set_peripheral(struct usb_otg *otg,
> > +		struct usb_gadget *periph)
> > +{
> > +	otg->gadget = periph;
> > +
> > +	return 0;
> > +}
> > +
> > +static int ci_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
> > +{
> > +	otg->host = host;
> > +
> > +	return 0;
> > +}
> > +
> > +/**
> > + * ci_hdrc_otg_init - initialize device related bits
> > + * ci: the controller
> > + *
> > + * This function create otg struct, if the device can switch between
> > + * device and host.
> > + */
> > +int ci_hdrc_otg_init(struct ci13xxx *ci)
> > +{
> > +	/* Useless at current */
> > +	ci->otg.set_peripheral = ci_otg_set_peripheral;
> > +	ci->otg.set_host = ci_otg_set_host;
> > +	if (!IS_ERR_OR_NULL(ci->transceiver))
> > +		ci->transceiver->otg = &ci->otg;
> > +
> > +	return 0;
> > +}
> > diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h
> > new file mode 100644
> > index 0000000..b4c6b3e
> > --- /dev/null
> > +++ b/drivers/usb/chipidea/otg.h
> > @@ -0,0 +1,6 @@
> > +#ifndef __DRIVERS_USB_CHIPIDEA_OTG_H
> > +#define __DRIVERS_USB_CHIPIDEA_OTG_H
> > +
> > +int ci_hdrc_otg_init(struct ci13xxx *ci);
> 
> Can you put it to ci.h instead?

I think we may have more complicated operation for otg, so keep one
otg header is accepted, like host.h, udc.h.
> 
> Thanks,
> --
> Alex
> 

-- 

Best Regards,
Peter Chen

  reply	other threads:[~2012-12-24  8:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26  9:11 [PATCH v3 0/7] Add fully tested id switch and vbus connect detect support for Chipidea Peter Chen
2012-11-26  9:11 ` [PATCH v3 1/7] Revert "USB: chipidea: add vbus detect for udc" Peter Chen
2012-11-26  9:11 ` [PATCH v3 2/7] usb: chipidea: add otg file Peter Chen
2012-11-29 13:53   ` Alexander Shishkin
2012-12-24  8:33     ` Peter Chen [this message]
2012-11-26  9:11 ` [PATCH v3 3/7] usb: chipidea: add otg id switch and vbus connect/disconnect detect Peter Chen
2012-11-29 14:30   ` Alexander Shishkin
2012-12-24  9:02     ` Peter Chen
2012-11-26  9:11 ` [PATCH v3 4/7] usb: chipidea: consolidate ci_role_driver's API for both roles Peter Chen
2012-11-26  9:11 ` [PATCH v3 5/7] usb: chipidea: udc: add pullup/pulldown dp at hw_device_state Peter Chen
2012-11-26  9:11 ` [PATCH v3 6/7] usb: chipidea: udc: retire the flag CI13_PULLUP_ON_VBUS Peter Chen
2012-11-26  9:11 ` [PATCH v3 7/7] usb: chipidea: imx: add internal vbus regulator control Peter Chen

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=20121224083357.GB21391@nchen-desktop \
    --to=peter.chen@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox