From 90d423faa0ed53cfda9f12d119f6938dd1ab515d Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Tue, 26 Nov 2013 16:49:38 -0800 Subject: ARM: shmobile: mackerel: clk_round_rate() can return a zero to indicate an error Treat both negative and zero return values from clk_round_rate() as errors. This is needed since subsequent patches will convert clk_round_rate()'s return value to be an unsigned type, rather than a signed type, since some clock sources can generate rates higher than (2^31)-1 Hz. Eventually, when calling clk_round_rate(), only a return value of zero will be considered a error. All other values will be considered valid rates. The comparison against values less than 0 is kept to preserve the correct behavior in the meantime. Signed-off-by: Paul Walmsley Acked-by: Laurent Pinchart Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/board-mackerel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-shmobile/board-mackerel.c') diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index af06753eb809..d90d2f11071b 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -548,9 +548,9 @@ static void __init hdmi_init_pm_clock(void) clk_get_rate(&sh7372_pllc2_clk)); rate = clk_round_rate(&sh7372_pllc2_clk, 594000000); - if (rate < 0) { + if (rate <= 0) { pr_err("Cannot get suitable rate: %ld\n", rate); - ret = rate; + ret = -EINVAL; goto out; } -- cgit v1.2.3-59-g8ed1b From 3a8067f77fcef7771fb12f14bef847e0b6201e0b Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 28 Nov 2013 16:17:58 +0100 Subject: ARM: shmobile: mackerel: Use pinconf API to configure pin pull-down The USB0 and USB1 VBUS pins must be pulled down. Add corresponding configuration entries in the pinctrl map table instead of manually poking the pin control registers. Signed-off-by: Laurent Pinchart Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/board-mackerel.c | 17 +++++++++-------- arch/arm/mach-shmobile/sh-gpio.h | 19 ------------------- 2 files changed, 9 insertions(+), 27 deletions(-) (limited to 'arch/arm/mach-shmobile/board-mackerel.c') diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index d90d2f11071b..207acf0e07da 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -1311,6 +1312,10 @@ static struct i2c_board_info i2c1_devices[] = { }, }; +static unsigned long pin_pulldown_conf[] = { + PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_DOWN, 0), +}; + static const struct pinctrl_map mackerel_pinctrl_map[] = { /* ADXL34X */ PIN_MAP_MUX_GROUP_DEFAULT("1-0053", "pfc-sh7372", @@ -1396,17 +1401,19 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = { /* USBHS0 */ PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372", "usb0_vbus", "usb0"), + PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.0", "pfc-sh7372", + "usb0_vbus", pin_pulldown_conf), /* USBHS1 */ PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372", "usb1_vbus", "usb1"), + PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.&", "pfc-sh7372", + "usb1_vbus", pin_pulldown_conf), PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372", "usb1_otg_id_0", "usb1"), }; #define GPIO_PORT9CR IOMEM(0xE6051009) #define GPIO_PORT10CR IOMEM(0xE605100A) -#define GPIO_PORT167CR IOMEM(0xE60520A7) -#define GPIO_PORT168CR IOMEM(0xE60520A8) #define SRCR4 IOMEM(0xe61580bc) #define USCCR1 IOMEM(0xE6058144) static void __init mackerel_init(void) @@ -1446,12 +1453,6 @@ static void __init mackerel_init(void) gpio_request_one(151, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */ - /* USBHS0 */ - gpio_request_pulldown(GPIO_PORT168CR); /* VBUS0_0 pull down */ - - /* USBHS1 */ - gpio_request_pulldown(GPIO_PORT167CR); /* VBUS0_1 pull down */ - /* FSI2 port A (ak4643) */ gpio_request_one(161, GPIOF_OUT_INIT_LOW, NULL); /* slave */ diff --git a/arch/arm/mach-shmobile/sh-gpio.h b/arch/arm/mach-shmobile/sh-gpio.h index e834763ac2a5..2c4141413db9 100644 --- a/arch/arm/mach-shmobile/sh-gpio.h +++ b/arch/arm/mach-shmobile/sh-gpio.h @@ -26,23 +26,4 @@ static inline void __init gpio_direction_none(void __iomem * addr) __raw_writeb(0x00, addr); } -static inline void __init gpio_request_pullup(void __iomem * addr) -{ - u8 data = __raw_readb(addr); - - data &= 0x0F; - data |= 0xC0; - __raw_writeb(data, addr); -} - -static inline void __init gpio_request_pulldown(void __iomem * addr) -{ - u8 data = __raw_readb(addr); - - data &= 0x0F; - data |= 0xA0; - - __raw_writeb(data, addr); -} - #endif /* __ASM_ARCH_GPIO_H */ -- cgit v1.2.3-59-g8ed1b From b58c8e7b43ad804ad18b30f882b16da2e3d4ed9d Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 14 Dec 2013 15:45:01 +0100 Subject: ARM: shmobile: mackerel: Fix USBHS pinconf entry Fix a typo in the USBHS1 pinconf entry that prevented the pull-down from being enabled. Signed-off-by: Laurent Pinchart Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/board-mackerel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/mach-shmobile/board-mackerel.c') diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 207acf0e07da..b3ee96e31b82 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -1406,7 +1406,7 @@ static const struct pinctrl_map mackerel_pinctrl_map[] = { /* USBHS1 */ PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372", "usb1_vbus", "usb1"), - PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.&", "pfc-sh7372", + PIN_MAP_CONFIGS_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372", "usb1_vbus", pin_pulldown_conf), PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs.1", "pfc-sh7372", "usb1_otg_id_0", "usb1"), -- cgit v1.2.3-59-g8ed1b