public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Gross <mgross@linux.intel.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
	Sebastien.Bouchard@ca.kontron.com, mark.gross@intel.com
Subject: Re: Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade
Date: Thu, 6 Oct 2005 10:31:36 -0700	[thread overview]
Message-ID: <200510061031.36271.mgross@linux.intel.com> (raw)
In-Reply-To: <20051006172427.GB22974@mipter.zuzino.mipt.ru>

On Thursday 06 October 2005 10:24, Alexey Dobriyan wrote:
> > --- linux-2.6.14-rc2-mm2/drivers/char/tlclk.c
> > +++ linux-2.6.14-rc2-mm2-tlclk/drivers/char/tlclk.c
> 
> Can you drop ioctl part of interface and leave only sysfs one?
> 

I would like to keep if for a little while because the hardware validation 
guys are still using test harnesses written for the 2.4 kernel driver 
version.  However; I am willing to pull this block if that would help in 
getting this driver into the kernel.

--mgross


> > +#ifdef TLCLK_IOCTL
> > +static int
> > +tlclk_ioctl(struct inode *inode,
> > +     struct file *filp, unsigned int cmd, unsigned long arg)
> > +{
> > + unsigned long flags;
> > + unsigned char val;
> > + int ret_val = 0;
> > +
> > + val = (unsigned char)arg;
> > + if (_IOC_TYPE(cmd) != TLCLK_IOC_MAGIC)
> > +  return -ENOTTY;
> > +
> > + if (_IOC_NR(cmd) > TLCLK_IOC_MAXNR)
> > +  return -ENOTTY;
> > +
> > + spin_lock_irqsave(&event_lock, flags);
> > + switch (cmd) {
> > + case IOCTL_RESET:
> > +		SET_PORT_BITS(TLCLK_REG4, 0xfd, val);
> > +		break;
> > +	case IOCTL_MODE_SELECT:
> > +		SET_PORT_BITS(TLCLK_REG0, 0xcf, val);
> > +		break;
> > +	case IOCTL_REFALIGN:
> > +		/* GENERATING 0 to 1 transistion */
> > +		SET_PORT_BITS(TLCLK_REG0, 0xf7, 0);
> > +		udelay(2);
> > +		SET_PORT_BITS(TLCLK_REG0, 0xf7, 0x08);
> > +		udelay(2);
> > +		SET_PORT_BITS(TLCLK_REG0, 0xf7, 0);
> > +		break;
> > +	case IOCTL_HARDWARE_SWITCHING:
> > +		SET_PORT_BITS(TLCLK_REG0, 0x7f, val);
> > +		break;
> > +	case IOCTL_HARDWARE_SWITCHING_MODE:
> > +		SET_PORT_BITS(TLCLK_REG0, 0xbf, val);
> > +		break;
> > +	case IOCTL_FILTER_SELECT:
> > +		SET_PORT_BITS(TLCLK_REG0, 0xfb, val);
> > +		break;
> > +	case IOCTL_SELECT_REF_FREQUENCY:
> > +		SET_PORT_BITS(TLCLK_REG1, 0xfd, val);
> > +		break;
> > +	case IOCTL_SELECT_REDUNDANT_CLOCK:
> > +		SET_PORT_BITS(TLCLK_REG1, 0xfe, val);
> > +		break;
> > +	case IOCTL_SELECT_AMCB1_TRANSMIT_CLOCK:
> > +		if ((val == CLK_8kHz) || (val == CLK_16_384MHz)) {
> > +			SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x5);
> > +			SET_PORT_BITS(TLCLK_REG1, 0xfb, ~val);
> > +		} else if (val >= CLK_8_592MHz) {
> > +			SET_PORT_BITS(TLCLK_REG3, 0xf8, 0x7);
> > +			switch (val) {
> > +			case CLK_8_592MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 1);
> > +				break;
> > +			case CLK_11_184MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 0);
> > +				break;
> > +			case CLK_34_368MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 3);
> > +				break;
> > +			case CLK_44_736MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 2);
> > +				break;
> > +			}
> > +		} else
> > +			SET_PORT_BITS(TLCLK_REG3, 0xf8, val);
> > +		break;
> > +	case IOCTL_SELECT_AMCB2_TRANSMIT_CLOCK:
> > +		if ((val == CLK_8kHz) || (val == CLK_16_384MHz)) {
> > +			SET_PORT_BITS(TLCLK_REG3, 0xc7, 0x28);
> > +			SET_PORT_BITS(TLCLK_REG1, 0xfb, ~val);
> > +		} else if (val >= CLK_8_592MHz) {
> > +			SET_PORT_BITS(TLCLK_REG3, 0xc7, 0x38);
> > +			switch (val) {
> > +			case CLK_8_592MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 1);
> > +				break;
> > +			case CLK_11_184MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 0);
> > +				break;
> > +			case CLK_34_368MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 3);
> > +				break;
> > +			case CLK_44_736MHz:
> > +				SET_PORT_BITS(TLCLK_REG0, 0xfc, 2);
> > +				break;
> > +			}
> > +		} else
> > +			SET_PORT_BITS(TLCLK_REG3, 0xc7, val << 3);
> > +		break;
> > +	case IOCTL_TEST_MODE:
> > +		SET_PORT_BITS(TLCLK_REG4, 0xfd, 2);
> > +		break;
> > +	case IOCTL_ENABLE_CLKA0_OUTPUT:
> > +		SET_PORT_BITS(TLCLK_REG2, 0xfe, val);
> > +		break;
> > +	case IOCTL_ENABLE_CLKB0_OUTPUT:
> > +		SET_PORT_BITS(TLCLK_REG2, 0xfd, val << 1);
> > +		break;
> > +	case IOCTL_ENABLE_CLKA1_OUTPUT:
> > +		SET_PORT_BITS(TLCLK_REG2, 0xfb, val << 2);
> > +		break;
> > +	case IOCTL_ENABLE_CLKB1_OUTPUT:
> > +		SET_PORT_BITS(TLCLK_REG2, 0xf7, val << 3);
> > +		break;
> > +	case IOCTL_ENABLE_CLK3A_OUTPUT:
> > +		SET_PORT_BITS(TLCLK_REG3, 0xbf, val << 6);
> > +		break;
> > +	case IOCTL_ENABLE_CLK3B_OUTPUT:
> > +		SET_PORT_BITS(TLCLK_REG3, 0x7f, val << 7);
> > +		break;
> > +	case IOCTL_READ_ALARMS:
> > +		ret_val = (inb(TLCLK_REG2) & 0xf0);
> > +		break;
> > +	case IOCTL_READ_INTERRUPT_SWITCH:
> > +		ret_val = inb(TLCLK_REG6);
> > +		break;
> > +	case IOCTL_READ_CURRENT_REF:
> > +		ret_val = ((inb(TLCLK_REG1) & 0x08) >> 3);
> > +		break;
> > +	}
> > +	spin_unlock_irqrestore(&event_lock, flags);
> > +
> > +	return ret_val;
> > +}
> > +#endif
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
--mgross
BTW: This may or may not be the opinion of my employer, more likely not.  

  reply	other threads:[~2005-10-06 17:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-06 15:03 Fwd: Telecom Clock Driver for MPCBL0010 ATCA computer blade Mark Gross
2005-10-06 16:52 ` Jesper Juhl
2005-10-06 17:28   ` Mark Gross
2005-10-07 12:21     ` Jesper Juhl
2005-10-06 17:24 ` Fwd: " Alexey Dobriyan
2005-10-06 17:31   ` Mark Gross [this message]
2005-10-06 18:20 ` Greg KH
2005-10-06 22:54   ` Mark Gross
2005-10-06 23:15     ` Greg KH
2005-10-12 22:30       ` Mark Gross
2005-10-12 22:49         ` Greg KH
2005-10-12 23:36           ` Mark Gross
2005-10-13  1:14             ` Greg KH
2005-10-13 21:36               ` Mark Gross
2005-10-13 22:08                 ` Jesper Juhl
2005-10-13 22:40                   ` Greg KH
     [not found]                     ` <9a8748490510131547s127f3167j6c9427ff3d97f878@mail.gmail.com>
     [not found]                       ` <20051014001547.GA4647@kroah.com>
2005-10-14  1:28                         ` Jesper Juhl
2005-10-06 23:45     ` Alexey Dobriyan

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=200510061031.36271.mgross@linux.intel.com \
    --to=mgross@linux.intel.com \
    --cc=Sebastien.Bouchard@ca.kontron.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.gross@intel.com \
    /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