public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 01/11] Add support for MX35 processor
Date: Thu, 20 Jan 2011 11:19:17 +0100	[thread overview]
Message-ID: <4D380C25.20901@denx.de> (raw)
In-Reply-To: <20110120092540.376C3D301D7@gemini.denx.de>

On 01/20/2011 10:25 AM, Wolfgang Denk wrote:
> Dear Stefano Babic,
> 
> In message <1295513194-16158-2-git-send-email-sbabic@denx.de> you wrote:
>> The patch adds basic support for the Freescale's i.MX35
>> (arm1136 based) processor.
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
> 
> checkpatch says:
> 
> [U-Boot] [PATCH V2 01/11] Add support for MX35 processor
> total: 7 errors, 8 warnings, 2109 lines checked

Mmmhh...checkpatch says:

total: 0 errors, 8 warnings, 2109 lines checked

0001-Add-support-for-MX35-processor.patch has style problems, please
review.  If any of these errors
are false positives report them to the maintainer, see

Warnings are only related to typedef ("do not add typedef"), so I do not
know where the errors are coming from. Do you use the --no-tree option
as I usually set?

> 
>> +u32 imx_get_uartclk(void)
>> +{
>> +	u32 freq;
>> +	struct ccm_regs *ccm =
>> +		(struct ccm_regs *)IMX_CCM_BASE;
>> +	u32 pdr4 = readl(&ccm->pdr4);
>> +
>> +	if (readl(&ccm->pdr3) & MXC_CCM_PDR3_UART_M_U)
>> +		freq = get_mcu_main_clk();
>> +	else
>> +		freq = decode_pll(readl(&ccm->ppctl),
>> +			CONFIG_MX35_HCLK_FREQ);
> 
> Braces needed

checkpatch (and generally accepted in linux, as I can see) requires that
single statements must not be surrounded by braces. checkpatch returns a
warning, explaining that braces are not needed.

I see in the past some comments requiring to remove braces, but it you
prefer to add them. IMHO it is better to follow the same codestyle as
linux, using the same tools as checkpatch. I do not know why we have two
different results from checkpatch, I try to investigate. I had prefer to
use always braces in if statement, to avoid possible errors if some code
is added, but since checkpatch complains about it I was convinced to
remove them.

> 
>> +	case USB_CLK:
>> +		usb_prdf = (reg4 >> 25) & 0x7;
>> +		usb_podf = (reg4 >> 22) & 0x7;
>> +		if (reg4 & 0x200)
>> +			pll = get_mcu_main_clk();
>> +		else
>> +			pll = decode_pll(readl(&ccm->ppctl),
>> +				CONFIG_MX35_HCLK_FREQ);
> 
> Ditto. Please fix globally.

See my previous comment. I would prefer to not have a different rule in
u-boot, and not go against some provided tool (we use both checkpatch)
if not strictly required.

> 
> Indeed they should.  Why don't you autogenerate these, then?
> 
> We have all the tools in place, use them.

I will see how to use them.

> 
> 
>> +#define NFC_BUF_SIZE			0x1000
>> +#define NFC_BUFSIZE_REG_OFF             (0 + 0x00)
>> +#define RAM_BUFFER_ADDRESS_REG_OFF      (0 + 0x04)
>> +#define NAND_FLASH_ADD_REG_OFF          (0 + 0x06)
>> +#define NAND_FLASH_CMD_REG_OFF          (0 + 0x08)
>> +#define NFC_CONFIGURATION_REG_OFF       (0 + 0x0A)
>> +#define ECC_STATUS_RESULT_REG_OFF       (0 + 0x0C)
>> +#define ECC_RSLT_MAIN_AREA_REG_OFF      (0 + 0x0E)
>> +#define ECC_RSLT_SPARE_AREA_REG_OFF     (0 + 0x10)
>> +#define NF_WR_PROT_REG_OFF              (0 + 0x12)
>> +#define NAND_FLASH_WR_PR_ST_REG_OFF     (0 + 0x18)
>> +#define NAND_FLASH_CONFIG1_REG_OFF      (0 + 0x1A)
>> +#define NAND_FLASH_CONFIG2_REG_OFF      (0 + 0x1C)
>> +#define UNLOCK_START_BLK_ADD_REG_OFF    (0 + 0x20)
>> +#define UNLOCK_END_BLK_ADD_REG_OFF      (0 + 0x22)
> 
> Why has this not been converted into a C struct?

I will check, I think I do not require anymore. NAND driver is in
mainline and does not require them. Probably I can remove them. In the
code I post now I do not use them at all, so probably I can remove them
without problems.

> 
> ...
>> +typedef enum iomux_pin_config {
>> +	MUX_CONFIG_FUNC = 0,	/*!< used as function */
>> +	MUX_CONFIG_ALT1,	/*!< used as alternate function 1 */
>> +	MUX_CONFIG_ALT2,	/*!< used as alternate function 2 */
>> +	MUX_CONFIG_ALT3,	/*!< used as alternate function 3 */
>> +	MUX_CONFIG_ALT4,	/*!< used as alternate function 4 */
>> +	MUX_CONFIG_ALT5,	/*!< used as alternate function 5 */
>> +	MUX_CONFIG_ALT6,	/*!< used as alternate function 6 */
>> +	MUX_CONFIG_ALT7,	/*!< used as alternate function 7 */
>> +	MUX_CONFIG_SION = 0x1 << 4,	/*!< used as LOOPBACK:MUX SION bit */
>> +	MUX_CONFIG_GPIO = MUX_CONFIG_ALT5,	/*!< used as GPIO */
>> +} iomux_pin_cfg_t;
> 
> /*!<  ???

I forget to remove them, thanks.

> ...
>> +/*!
>> + * Request ownership for an IO pin. This function has to be the first one
>> + * being called before that pin is used. The caller has to check the
>> + * return value to make sure it returns 0.
>> + *
>> + * @param  pin		a name defined by \b iomux_pin_name_t
>> + * @param  cfg		an input function as defined in \b #iomux_pin_cfg_t
> 
> \b  ???
> 
>> + * @param  pin		a name defined by \b iomux_pin_name_t
>> + * @param  cfg		an input function as defined in \b #iomux_pin_cfg_t
> 
> "iomux_pin_name_t", but "#iomux_pin_cfg_t"  ???

I'll fix them

>> +typedef enum iomux_pins {
> ...
>> +	MX35_PIN_A0 = _MXC_BUILD_NON_GPIO_PIN(0x28, 0x368),
>> +	MX35_PIN_A1 = _MXC_BUILD_NON_GPIO_PIN(0x2C, 0x36C),
>> +	MX35_PIN_A2 = _MXC_BUILD_NON_GPIO_PIN(0x30, 0x370),
>> +	MX35_PIN_A3 = _MXC_BUILD_NON_GPIO_PIN(0x34, 0x374),
>> +	MX35_PIN_A4 = _MXC_BUILD_NON_GPIO_PIN(0x38, 0x378),
>> +	MX35_PIN_A5 = _MXC_BUILD_NON_GPIO_PIN(0x3C, 0x37C),
>> +	MX35_PIN_A6 = _MXC_BUILD_NON_GPIO_PIN(0x40, 0x380),
>> +	MX35_PIN_A7 = _MXC_BUILD_NON_GPIO_PIN(0x44, 0x384),
>> +	MX35_PIN_A8 = _MXC_BUILD_NON_GPIO_PIN(0x48, 0x388),
>> +	MX35_PIN_A9 = _MXC_BUILD_NON_GPIO_PIN(0x4C, 0x38C),
>> +	MX35_PIN_A10 = _MXC_BUILD_NON_GPIO_PIN(0x50, 0x390),
>> +	MX35_PIN_MA10 = _MXC_BUILD_NON_GPIO_PIN(0x54, 0x394),
>> +	MX35_PIN_A11 = _MXC_BUILD_NON_GPIO_PIN(0x58, 0x398),
>> +	MX35_PIN_A12 = _MXC_BUILD_NON_GPIO_PIN(0x5C, 0x39C),
>> +	MX35_PIN_A13 = _MXC_BUILD_NON_GPIO_PIN(0x60, 0x3A0),
>> +	MX35_PIN_A14 = _MXC_BUILD_NON_GPIO_PIN(0x64, 0x3A4),
>> +	MX35_PIN_A15 = _MXC_BUILD_NON_GPIO_PIN(0x68, 0x3A8),
>> +	MX35_PIN_A16 = _MXC_BUILD_NON_GPIO_PIN(0x6C, 0x3AC),
>> +	MX35_PIN_A17 = _MXC_BUILD_NON_GPIO_PIN(0x70, 0x3B0),
>> +	MX35_PIN_A18 = _MXC_BUILD_NON_GPIO_PIN(0x74, 0x3B4),
>> +	MX35_PIN_A19 = _MXC_BUILD_NON_GPIO_PIN(0x78, 0x3B8),
>> +	MX35_PIN_A20 = _MXC_BUILD_NON_GPIO_PIN(0x7C, 0x3BC),
>> +	MX35_PIN_A21 = _MXC_BUILD_NON_GPIO_PIN(0x80, 0x3C0),
>> +	MX35_PIN_A22 = _MXC_BUILD_NON_GPIO_PIN(0x84, 0x3C4),
>> +	MX35_PIN_A23 = _MXC_BUILD_NON_GPIO_PIN(0x88, 0x3C8),
>> +	MX35_PIN_A24 = _MXC_BUILD_NON_GPIO_PIN(0x8C, 0x3CC),
>> +	MX35_PIN_A25 = _MXC_BUILD_NON_GPIO_PIN(0x90, 0x3D0),
> 
> Note: the following remark is a question, NOT a change request:
> 
> Would it not be possible to reduce all these terrible lists?  As far
> as I can tell, the list is built sequentially, with both arguments to
> _MXC_BUILD_NON_GPIO_PIN() being incremented by 4 for the next
> register.  This begs for automatic code generation, doesn't it?

I do not know if it helps. The list follows exactly the description in
user manual, and, if you can see a rule for MX35_PIN_A*, it is not so
simply to find one for other pins, specially for the MXC_BUILD_GPIO_PIN.
At least, the list is at the moment coherent for all i.MX processors
(ok, ugly for all). The name of the pin cannot be generated, and it is
the name found in manual. Miore as generated, the list is sorted....

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2011-01-20 10:19 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-20  8:46 [U-Boot] Adding support for MX35 Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 01/11] Add support for MX35 processor Stefano Babic
2011-01-20  9:25   ` Wolfgang Denk
2011-01-20 10:19     ` Stefano Babic [this message]
2011-01-20 11:52       ` Wolfgang Denk
2011-01-20 17:49   ` [U-Boot] [PATCH V3 " Stefano Babic
2011-02-01 17:50     ` Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 02/11] serial_mxc: add support for Freescale's i.MX35 processor Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 03/11] mxc_i2c: Add support for the " Stefano Babic
2011-01-21  6:28   ` Heiko Schocher
2011-01-20  8:46 ` [U-Boot] [PATCH V2 04/11] I2C: mxc_i2c: get rid of __REG access Stefano Babic
2011-01-20  9:27   ` Wolfgang Denk
2011-01-20 10:23     ` Stefano Babic
2011-01-20 17:50   ` [U-Boot] [PATCH V3 " Stefano Babic
2011-01-21  6:30     ` Heiko Schocher
2011-01-20  8:46 ` [U-Boot] [PATCH V2 05/11] I2C: mxc_i2c: address failure with mx35 processor Stefano Babic
2011-01-20  9:30   ` Wolfgang Denk
2011-01-20 10:27     ` Stefano Babic
2011-01-20 17:51   ` [U-Boot] [PATCH V3 " Stefano Babic
2011-01-21  6:36     ` Heiko Schocher
2011-01-21  9:08       ` Stefano Babic
2011-01-21  9:21         ` Heiko Schocher
2011-01-20  8:46 ` [U-Boot] [PATCH V2 06/11] Add basic support for Freescale's mc9sdz60 Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 07/11] SPI: mxc_spi: add support for i.MX35 processor Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 08/11] SPI: mxc_spi: fix swapping bug and add missing swapping in unaligned rx case Stefano Babic
2011-01-20  9:32   ` Wolfgang Denk
2011-01-20 10:29     ` Stefano Babic
2011-01-20 11:59       ` Wolfgang Denk
2011-01-20 17:53   ` [U-Boot] [PATCH V3 " Stefano Babic
2011-02-01 17:53     ` Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 09/11] SPI: mxc_spi: add SPI clock calculation and setup to the driver Stefano Babic
2011-02-01 17:58   ` Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 10/11] SPI: mxc_spi: replace fixed offsets with structures Stefano Babic
2011-01-20  9:33   ` Wolfgang Denk
2011-01-20 10:30     ` Stefano Babic
2011-01-20  8:46 ` [U-Boot] [PATCH V2 11/11] Add support for Freescale's mx35pdk board Stefano Babic
2011-01-20  9:41   ` Wolfgang Denk
2011-01-20 10:45     ` Stefano Babic
2011-01-20 12:03       ` Wolfgang Denk
2011-01-20 17:53   ` [U-Boot] [PATCH V3 " Stefano Babic
2011-01-20 18:05     ` [U-Boot] [PATCH V4 " Stefano Babic
2011-02-01 17:51       ` Stefano Babic
2011-02-01 17:51     ` [U-Boot] [PATCH V3 " Stefano Babic
2011-01-20  9:52 ` [U-Boot] Adding support for MX35 Wolfgang Denk
2011-01-20 10:50   ` Stefano Babic
2011-01-20 12:04     ` Wolfgang Denk

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=4D380C25.20901@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /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