mirror of
https://github.com/torvalds/linux.git
synced 2026-11-26 16:33:17 +00:00
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
53 lines
1.5 KiB
C
53 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* QE USB routines
|
|
*
|
|
* Copyright 2006 Freescale Semiconductor, Inc.
|
|
* Shlomi Gridish <[email protected]>
|
|
* Jerry Huang <[email protected]>
|
|
* Copyright (c) MontaVista Software, Inc. 2008.
|
|
* Anton Vorontsov <[email protected]>
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/export.h>
|
|
#include <linux/io.h>
|
|
#include <soc/fsl/qe/immap_qe.h>
|
|
#include <soc/fsl/qe/qe.h>
|
|
|
|
int qe_usb_clock_set(enum qe_clock clk, int rate)
|
|
{
|
|
struct qe_mux __iomem *mux = &qe_immr->qmx;
|
|
unsigned long flags;
|
|
u32 val;
|
|
|
|
switch (clk) {
|
|
case QE_CLK3: val = QE_CMXGCR_USBCS_CLK3; break;
|
|
case QE_CLK5: val = QE_CMXGCR_USBCS_CLK5; break;
|
|
case QE_CLK7: val = QE_CMXGCR_USBCS_CLK7; break;
|
|
case QE_CLK9: val = QE_CMXGCR_USBCS_CLK9; break;
|
|
case QE_CLK13: val = QE_CMXGCR_USBCS_CLK13; break;
|
|
case QE_CLK17: val = QE_CMXGCR_USBCS_CLK17; break;
|
|
case QE_CLK19: val = QE_CMXGCR_USBCS_CLK19; break;
|
|
case QE_CLK21: val = QE_CMXGCR_USBCS_CLK21; break;
|
|
case QE_BRG9: val = QE_CMXGCR_USBCS_BRG9; break;
|
|
case QE_BRG10: val = QE_CMXGCR_USBCS_BRG10; break;
|
|
default:
|
|
pr_err("%s: requested unknown clock %d\n", __func__, clk);
|
|
return -EINVAL;
|
|
}
|
|
|
|
if (qe_clock_is_brg(clk))
|
|
qe_setbrg(clk, rate, 1);
|
|
|
|
spin_lock_irqsave(&cmxgcr_lock, flags);
|
|
|
|
clrsetbits_be32(&mux->cmxgcr, QE_CMXGCR_USBCS, val);
|
|
|
|
spin_unlock_irqrestore(&cmxgcr_lock, flags);
|
|
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL(qe_usb_clock_set);
|