On Tuesday, January 31, 2017, Geert Uytterhoeven wrote:
> > This may become something like:
> >
> > #define ALT_FUNC_1       0
> > #define ALT_FUNC_2       1
> > #define ALT_FUNC_3       2
> > #define ALT_FUNC_4       3
> > #define ALT_FUNC_5       4
> > #define ALT_FUNC_6       5
> > #define ALT_FUNC_7       6
> > #define ALT_FUNC_8       7


ALT_FUNC_1 is still too long if you're going to OR things on 1 line in the DT.

I personally like:
#define ALT_1       0


> > #define PIN(b, p) b p
> > #define PIN_MUX(func, conf)     \
> >         ((func & 0xf) | ((conf) << 16))
> >
> > and in DTS sources you would describe a pin as
> >
> > pins = <PIN(bank, pin) PIN_MUX(ALT_FUNC_1, INPUT | BIDIRECTIONAL)>;
> >
> > We can drop the PIN macro as it does not bring anything I agree, but
> > it's nicer to see imho
> 
> ... you can keep plain 1-based numbers for alternate functions, and use
> the definitions for flags, e.g.:
> 
>      pins = <PIN(bank, pin) (1 | INPUT_MODE | BIDIRECTIONAL)>;


To Geert's point, nothing is going to be "shorter" than just using
'1','2','3',etc..


I also think "BIDIRECTIONAL" >> "BIDIR"

Or....we could make life easy on people and #define the pins that
are tricky:


#define I2C             BIDIRECTIONAL
#define SDHI_DATA       BIDIRECTIONAL
#define SDHI_CTRL /* none */
#define RSPI    /* none */
#define ETHERNET        /* none */


Chris

Reply via email to