usb: gadget: atmel: access the PMC using regmap
Use regmap to access the PMC to avoid using at91_pmc_read and at91_pmc_write. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
6c38bda9ae
commit
4747639f01
@ -17,7 +17,9 @@
|
|||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
|
#include <linux/mfd/syscon.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
#include <linux/usb/ch9.h>
|
#include <linux/usb/ch9.h>
|
||||||
#include <linux/usb/gadget.h>
|
#include <linux/usb/gadget.h>
|
||||||
#include <linux/usb/atmel_usba_udc.h>
|
#include <linux/usb/atmel_usba_udc.h>
|
||||||
@ -1888,20 +1890,15 @@ static int atmel_usba_stop(struct usb_gadget *gadget)
|
|||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
static void at91sam9rl_toggle_bias(struct usba_udc *udc, int is_on)
|
static void at91sam9rl_toggle_bias(struct usba_udc *udc, int is_on)
|
||||||
{
|
{
|
||||||
unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
|
regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN,
|
||||||
|
is_on ? AT91_PMC_BIASEN : 0);
|
||||||
if (is_on)
|
|
||||||
at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
|
|
||||||
else
|
|
||||||
at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void at91sam9g45_pulse_bias(struct usba_udc *udc)
|
static void at91sam9g45_pulse_bias(struct usba_udc *udc)
|
||||||
{
|
{
|
||||||
unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
|
regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN, 0);
|
||||||
|
regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN,
|
||||||
at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN));
|
AT91_PMC_BIASEN);
|
||||||
at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct usba_udc_errata at91sam9rl_errata = {
|
static const struct usba_udc_errata at91sam9rl_errata = {
|
||||||
@ -1938,6 +1935,9 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
|
|||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
udc->errata = match->data;
|
udc->errata = match->data;
|
||||||
|
udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc");
|
||||||
|
if (udc->errata && IS_ERR(udc->pmc))
|
||||||
|
return ERR_CAST(udc->pmc);
|
||||||
|
|
||||||
udc->num_ep = 0;
|
udc->num_ep = 0;
|
||||||
|
|
||||||
|
@ -354,6 +354,8 @@ struct usba_udc {
|
|||||||
struct dentry *debugfs_root;
|
struct dentry *debugfs_root;
|
||||||
struct dentry *debugfs_regs;
|
struct dentry *debugfs_regs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct regmap *pmc;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct usba_ep *to_usba_ep(struct usb_ep *ep)
|
static inline struct usba_ep *to_usba_ep(struct usb_ep *ep)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user