Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7053acbd authored by Eric Miao's avatar Eric Miao Committed by Russell King
Browse files

[ARM] 4304/1: removes the unnecessary bit number from CKENnn_XXXX



This patch removes the unnecessary bit number from CKENnn_XXXX
definitions for PXA, so that

	CKEN0_PWM0 --> CKEN_PWM0
	CKEN1_PWM1 --> CKEN_PWM1
	...
	CKEN24_CAMERA --> CKEN_CAMERA

The reasons for the change of these defitions are:

1. they do not scale - they are currently valid for pxa2xx, but
definitely not valid for pxa3xx, e.g., pxa3xx has bit 3 for camera
instead of bit 24

2. they are unnecessary - the peripheral name within the definition
has already announced its usage, we don't need those bit numbers
to know which peripheral we are going to enable/disable clock for

3. they are inconvenient - think about this: a driver programmer
for pxa has to remember which bit in the CKEN register to turn
on/off

Another change in the patch is to make the definitions equal to its
clock bit index, so that

   #define CKEN_CAMERA  (24)

instead of

   #define CKEN_CAMERA  (1 << 24)

this change, however, will add a run-time bit shift operation in
pxa_set_cken(), but the benefit of this change is that it scales
when bit index exceeds 32, e.g., pxa3xx has two registers CKENA
and CKENB, totally 64 bit for this, suppose CAMERA clock enabling
bit is CKENB:10, one can simply define CKEN_CAMERA to be (32 + 10)
and so that pxa_set_cken() need minimum change to adapt to that.

Signed-off-by: default avatareric miao <eric.y.miao@gmail.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a79220b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ static struct resource pxa_spi_nssp_resources[] = {

static struct pxa2xx_spi_master pxa_nssp_master_info = {
	.ssp_type = PXA25x_NSSP, /* Type of SSP */
	.clock_enable = CKEN9_NSSP, /* NSSP Peripheral clock */
	.clock_enable = CKEN_NSSP, /* NSSP Peripheral clock */
	.num_chipselect = 1, /* Matches the number of chips attached to NSSP */
	.enable_dma = 1, /* Enables NSSP DMA */
};
+2 −2
Original line number Diff line number Diff line
@@ -164,9 +164,9 @@ void pxa_set_cken(int clock, int enable)
	local_irq_save(flags);

	if (enable)
		CKEN |= clock;
		CKEN |= (1 << clock);
	else
		CKEN &= ~clock;
		CKEN &= ~(1 << clock);

	local_irq_restore(flags);
}
+2 −2
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ static void lpd270_backlight_power(int on)
{
	if (on) {
		pxa_gpio_mode(GPIO16_PWM0_MD);
		pxa_set_cken(CKEN0_PWM0, 1);
		pxa_set_cken(CKEN_PWM0, 1);
		PWM_CTRL0 = 0;
		PWM_PWDUTY0 = 0x3ff;
		PWM_PERVAL0 = 0x3ff;
@@ -242,7 +242,7 @@ static void lpd270_backlight_power(int on)
		PWM_CTRL0 = 0;
		PWM_PWDUTY0 = 0x0;
		PWM_PERVAL0 = 0x3FF;
		pxa_set_cken(CKEN0_PWM0, 0);
		pxa_set_cken(CKEN_PWM0, 0);
	}
}

+1 −1
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ static struct resource pxa_ssp_resources[] = {

static struct pxa2xx_spi_master pxa_ssp_master_info = {
	.ssp_type	= PXA25x_SSP,
	.clock_enable	= CKEN3_SSP,
	.clock_enable	= CKEN_SSP,
	.num_chipselect	= 0,
};

+2 −2
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ static void mainstone_backlight_power(int on)
{
	if (on) {
		pxa_gpio_mode(GPIO16_PWM0_MD);
		pxa_set_cken(CKEN0_PWM0, 1);
		pxa_set_cken(CKEN_PWM0, 1);
		PWM_CTRL0 = 0;
		PWM_PWDUTY0 = 0x3ff;
		PWM_PERVAL0 = 0x3ff;
@@ -274,7 +274,7 @@ static void mainstone_backlight_power(int on)
		PWM_CTRL0 = 0;
		PWM_PWDUTY0 = 0x0;
		PWM_PERVAL0 = 0x3FF;
		pxa_set_cken(CKEN0_PWM0, 0);
		pxa_set_cken(CKEN_PWM0, 0);
	}
}

Loading