Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39c0cb02 authored by Russell King's avatar Russell King
Browse files

ARM: ICST: merge common ICST VCO structures



The structures for the ICST307 and ICST525 VCO devices are
identical, so merge them together.

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent b830b9b5
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@
 */
 */
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 3, 6 };


unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco)
unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco)
{
{
	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
}
}
@@ -36,10 +36,10 @@ EXPORT_SYMBOL(icst307_khz);
 */
 */
static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };
static unsigned char idx2s[8] = { 1, 6, 3, 4, 7, 5, 2, 0 };


struct icst307_vco
struct icst_vco
icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq)
icst307_khz_to_vco(const struct icst_params *p, unsigned long freq)
{
{
	struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	unsigned long f;
	unsigned long f;
	unsigned int i = 0, rd, best = (unsigned int)-1;
	unsigned int i = 0, rd, best = (unsigned int)-1;


@@ -96,10 +96,10 @@ icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq)


EXPORT_SYMBOL(icst307_khz_to_vco);
EXPORT_SYMBOL(icst307_khz_to_vco);


struct icst307_vco
struct icst_vco
icst307_ps_to_vco(const struct icst307_params *p, unsigned long period)
icst307_ps_to_vco(const struct icst_params *p, unsigned long period)
{
{
	struct icst307_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	unsigned long f, ps;
	unsigned long f, ps;
	unsigned int i = 0, rd, best = (unsigned int)-1;
	unsigned int i = 0, rd, best = (unsigned int)-1;


+7 −7
Original line number Original line Diff line number Diff line
@@ -21,7 +21,7 @@
 */
 */
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };
static unsigned char s2div[8] = { 10, 2, 8, 4, 5, 7, 9, 6 };


unsigned long icst525_khz(const struct icst525_params *p, struct icst525_vco vco)
unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco)
{
{
	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
	return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * s2div[vco.s]);
}
}
@@ -33,10 +33,10 @@ EXPORT_SYMBOL(icst525_khz);
 */
 */
static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };
static unsigned char idx2s[] = { 1, 3, 4, 7, 5, 2, 6, 0 };


struct icst525_vco
struct icst_vco
icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq)
icst525_khz_to_vco(const struct icst_params *p, unsigned long freq)
{
{
	struct icst525_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	unsigned long f;
	unsigned long f;
	unsigned int i = 0, rd, best = (unsigned int)-1;
	unsigned int i = 0, rd, best = (unsigned int)-1;


@@ -94,10 +94,10 @@ icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq)


EXPORT_SYMBOL(icst525_khz_to_vco);
EXPORT_SYMBOL(icst525_khz_to_vco);


struct icst525_vco
struct icst_vco
icst525_ps_to_vco(const struct icst525_params *p, unsigned long period)
icst525_ps_to_vco(const struct icst_params *p, unsigned long period)
{
{
	struct icst525_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	struct icst_vco vco = { .s = 1, .v = p->vd_max, .r = p->rd_max };
	unsigned long f, ps;
	unsigned long f, ps;
	unsigned int i = 0, rd, best = (unsigned int)-1;
	unsigned int i = 0, rd, best = (unsigned int)-1;


+32 −0
Original line number Original line Diff line number Diff line
/*
 *  arch/arm/include/asm/hardware/icst.h
 *
 *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
 *
 * 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.
 *
 *  Support functions for calculating clocks/divisors for the ICST
 *  clock generators.  See http://www.icst.com/ for more information
 *  on these devices.
 */
#ifndef ASMARM_HARDWARE_ICST_H
#define ASMARM_HARDWARE_ICST_H

struct icst_params {
	unsigned long	ref;
	unsigned long	vco_max;	/* inclusive */
	unsigned short	vd_min;		/* inclusive */
	unsigned short	vd_max;		/* inclusive */
	unsigned char	rd_min;		/* inclusive */
	unsigned char	rd_max;		/* inclusive */
};

struct icst_vco {
	unsigned short	v;
	unsigned char	r;
	unsigned char	s;
};

#endif
+4 −17
Original line number Original line Diff line number Diff line
@@ -16,23 +16,10 @@
#ifndef ASMARM_HARDWARE_ICST307_H
#ifndef ASMARM_HARDWARE_ICST307_H
#define ASMARM_HARDWARE_ICST307_H
#define ASMARM_HARDWARE_ICST307_H


struct icst307_params {
#include <asm/hardware/icst.h>
	unsigned long	ref;
	unsigned long	vco_max;	/* inclusive */
	unsigned short	vd_min;		/* inclusive */
	unsigned short	vd_max;		/* inclusive */
	unsigned char	rd_min;		/* inclusive */
	unsigned char	rd_max;		/* inclusive */
};


struct icst307_vco {
unsigned long icst307_khz(const struct icst_params *p, struct icst_vco vco);
	unsigned short	v;
struct icst_vco icst307_khz_to_vco(const struct icst_params *p, unsigned long freq);
	unsigned char	r;
struct icst_vco icst307_ps_to_vco(const struct icst_params *p, unsigned long period);
	unsigned char	s;
};

unsigned long icst307_khz(const struct icst307_params *p, struct icst307_vco vco);
struct icst307_vco icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq);
struct icst307_vco icst307_ps_to_vco(const struct icst307_params *p, unsigned long period);


#endif
#endif
+4 −17
Original line number Original line Diff line number Diff line
@@ -14,23 +14,10 @@
#ifndef ASMARM_HARDWARE_ICST525_H
#ifndef ASMARM_HARDWARE_ICST525_H
#define ASMARM_HARDWARE_ICST525_H
#define ASMARM_HARDWARE_ICST525_H


struct icst525_params {
#include <asm/hardware/icst.h>
	unsigned long	ref;
	unsigned long	vco_max;	/* inclusive */
	unsigned short	vd_min;		/* inclusive */
	unsigned short	vd_max;		/* inclusive */
	unsigned char	rd_min;		/* inclusive */
	unsigned char	rd_max;		/* inclusive */
};


struct icst525_vco {
unsigned long icst525_khz(const struct icst_params *p, struct icst_vco vco);
	unsigned short	v;
struct icst_vco icst525_khz_to_vco(const struct icst_params *p, unsigned long freq);
	unsigned char	r;
struct icst_vco icst525_ps_to_vco(const struct icst_params *p, unsigned long period);
	unsigned char	s;
};

unsigned long icst525_khz(const struct icst525_params *p, struct icst525_vco vco);
struct icst525_vco icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq);
struct icst525_vco icst525_ps_to_vco(const struct icst525_params *p, unsigned long period);


#endif
#endif
Loading