lkml.org 
[lkml]   [2004]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Second Attempt: Driver model usage on embedded processors
Dan Malek wrote:

> Why don't you just use the feature_call() model like we currently
> use for PowerPC on the PMac? Isolate those places in the driver
> that need that information and call the function with a
> selector/information
> request (and varargs) to get it.


> For example,
> a driver could:
>
> feature_call(SOC_FTR, Fast_Ethernet1, INIT_IO_PINS);
>
> to configure the IO pins associated with the device, then it could:
>
> feature_call(SOC_FTR, Fast_Ethernet1, GET_CLKS, &txclk, &rxclk);
>
> to get the routing for the transmit and receive clocks, and finally:
>
> feature_call(SOC_FTR, Fast_Ethernet1, GET_PHY_IRQ, &phy_irq);
>
> to get the external interrupt number associated with the PHY.
>

FWIW, I really like this model.

Just as another example, for the I2C driver i2c-mpc, almost the only
variation between model is the clock selection and that forced to put
some processor specific stuff into the driver. With that model, you could
easly avoid theses platform/cpu specific stuff and isolate them.

USB with some really alike bus glues comes to mind too ...

Being able to do "action" in plus of just passing parameters is really nice
IMHO.


Sylvain
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.060 / U:1.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site