public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@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 10:25:40 +0100	[thread overview]
Message-ID: <20110120092540.376C3D301D7@gemini.denx.de> (raw)
In-Reply-To: <1295513194-16158-2-git-send-email-sbabic@denx.de>

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

Please fix.

> +u32 get_cpu_rev(void)
> +{
> +	int reg;
> +	struct iim_regs *iim =
> +		(struct iim_regs *)IIM_BASE_ADDR;
> +	reg = readl(&iim->iim_srev);
> +	if (!reg) {
> +		reg = readw(ROMPATCH_REV);
> +		reg <<= 4;
> +	} else
> +		reg += CHIP_REV_1_0;

If there are braces for the "if", then there shall also be braces for
the "else" ("Use braces in both branches.")

> +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.

> +	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.

> index 0000000..c1dc62a
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-mx35/asm-offsets.h
> @@ -0,0 +1,21 @@
> +/*
> + * needed for lowlevel_init.S
> + *
> + * These should be auto-generated
> + */
> +/* CCM */
> +#define CLKCTL_CCMR		0x00
> +#define CLKCTL_PDR0		0x04
> +#define CLKCTL_PDR1		0x08
> +#define CLKCTL_PDR2		0x0C
> +#define CLKCTL_PDR3		0x10
> +#define CLKCTL_PDR4		0x14
> +#define CLKCTL_RCSR		0x18
> +#define CLKCTL_MPCTL		0x1C
> +#define CLKCTL_PPCTL		0x20
> +#define CLKCTL_ACMR		0x24
> +#define CLKCTL_COSR		0x28
> +#define CLKCTL_CGR0		0x2C
> +#define CLKCTL_CGR1		0x30
> +#define CLKCTL_CGR2		0x34
> +#define CLKCTL_CGR3		0x38

Indeed they should.  Why don't you autogenerate these, then?

We have all the tools in place, 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?

...
> +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;

/*!<  ???

> +/*!

/*!  ???

...
> +/*!
> + * 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"  ???

...
> +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?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human race has one really effective weapon, and that is laughter.
                                                         - Mark Twain

  reply	other threads:[~2011-01-20  9:25 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 [this message]
2011-01-20 10:19     ` Stefano Babic
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=20110120092540.376C3D301D7@gemini.denx.de \
    --to=wd@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