[U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Robert Deliën
This patch fixes a small bug that allowed unintended manipulation of non-existing GPIO pins within a pin bank, clobbering reserved bits. Signed-off-by: Robert Deliën diff --git a/arch/arm/include/asm/arch-mx28/iomux.h b/arch/arm/include/asm/arch-mx28/iomux.h index 7abdf58..829d9a8 100644 --- a/

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Marek Vasut
> This patch fixes a small bug that allowed unintended manipulation of > non-existing GPIO pins within a pin bank, clobbering reserved bits. > > Signed-off-by: Robert Deliën > diff --git a/arch/arm/include/asm/arch-mx28/iomux.h > b/arch/arm/include/asm/arch-mx28/iomux.h index 7abdf58..829d9a8 100

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Marek Vasut
> Hi Marek, > > > Hey, this looks reasonable. Did you send similar patch to Linux too ? > > No, I'm not at that yet. I'm just starting to explore the New U-Boot: It's > been since version 1.1.2 that I have actually contributed something. > > My current project requires a mechanism to manipulate

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Robert Deliën
> To make things simple for users, there's standard layout. It's actually at > sector 2048 btw. Got that. > That's what happens internally, it's just that some pieces (like sector > offset > of the partition!) need to be filled into the bootstream header by the > mxsboot > utility -- see mxs

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Marek Vasut
> > To make things simple for users, there's standard layout. It's actually > > at sector 2048 btw. > > Got that. > > > That's what happens internally, it's just that some pieces (like sector > > offset of the partition!) need to be filled into the bootstream header > > by the mxsboot utility --

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Marek Vasut
> This patch fixes a small bug that allowed unintended manipulation of > non-existing GPIO pins within a pin bank, clobbering reserved bits. > > Signed-off-by: Robert Deliën > diff --git a/arch/arm/include/asm/arch-mx28/iomux.h > b/arch/arm/include/asm/arch-mx28/iomux.h index 7abdf58..829d9a8 100

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Robert Deliën
> Careful here !! > > The driver _should_ work for MX233 too! What I'd like to see is you > introducing > a function like: > > int mxs_gpio_is_valid(gpio) > { > char mxs_banks[PINCTRL_BANKS] = PINCTRL_BANK_COUNTS; > > if (PAD_PIN(gpio) > mxs_bank[PAD_BANK(gpio)]) > return -EINVAL; > > r

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Mike Frysinger
On Tuesday 22 November 2011 09:41:48 Robert Deliën wrote: > + switch(PAD_BANK(gp)) { needs a space after that "switch" > + case 0: > + bank_pins = MXS_BANK0_PINS; > + break; > + case 1: > + bank_pins = MXS_BANK1_PINS; > + b

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Robert Deliën
> static const int all_bank_pins[] = { > MXS_BANK0_PINS, > MXS_BANK1_PINS, > MXS_BANK2_PINS, > MXS_BANK3_PINS, > MXS_BANK4_PINS, > }; > bank_pins = all_bank_pins[PAD_PANK(gp)]; Good one! But how about the changes Marek suggested about name_to_gpio_number? Robert. __

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-22 Thread Marek Vasut
> > Careful here !! > > > > The driver _should_ work for MX233 too! What I'd like to see is you > > introducing a function like: > > > > int mxs_gpio_is_valid(gpio) > > { > > char mxs_banks[PINCTRL_BANKS] = PINCTRL_BANK_COUNTS; > > > > if (PAD_PIN(gpio) > mxs_bank[PAD_BANK(gpio)]) > > > > r

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-23 Thread Robert Deliën
> Careful here !! > > The driver _should_ work for MX233 too! What I'd like to see is you > introducing > a function like: > > int mxs_gpio_is_valid(gpio) > { > char mxs_banks[PINCTRL_BANKS] = PINCTRL_BANK_COUNTS; > > if (PAD_PIN(gpio) > mxs_bank[PAD_BANK(gpio)]) > return -EINVAL; > > return

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-23 Thread Marek Vasut
> > Careful here !! > > > > The driver _should_ work for MX233 too! What I'd like to see is you > > introducing a function like: > > > > int mxs_gpio_is_valid(gpio) > > { > > char mxs_banks[PINCTRL_BANKS] = PINCTRL_BANK_COUNTS; > > > > if (PAD_PIN(gpio) > mxs_bank[PAD_BANK(gpio)]) > > return -EI

Re: [U-Boot] [PATCH] M28: Added guarding for reserved bits in GPIO driver

2011-11-23 Thread Robert Deliën
And are you sure the amound of pins in bank 0, 1, 2 is the same on mx233 and mx28 ? Yes, I'm sure they're not ;-). I went through the manual and changed it into this: static const int mxs_bank_pins[] = { #ifdefined(CONFIG_MX23) MX23_BANK0_PINS, MX23_BANK1_PINS, MX23_BANK2_PINS #elifdefine